From 2cf1ba619b10e0da8b1647e7e663809593d92be8 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 14 Apr 2022 13:19:29 +0200 Subject: [PATCH] Update cypress import paths --- .../integration/frontend/modules/snapshots.spec.js | 4 ++-- .../frontend/objectives/objectives-visibility.spec.js | 4 ++-- .../ui/{onboarding.spec.js => onboarding.spec.ts} | 2 +- client/cypress/integration/frontend/ui/sidebar.spec.js | 2 +- .../integration/frontend/users/new-student.spec.js | 2 +- .../frontend/users/school-class-management.spec.js | 6 +++--- client/cypress/integration/frontend/users/team.spec.js | 4 ++-- client/cypress/plugins/index.js | 8 +++++--- client/cypress/support/index.d.ts | 2 +- client/cypress/tsconfig.json | 8 ++++++++ 10 files changed, 26 insertions(+), 16 deletions(-) rename client/cypress/integration/frontend/ui/{onboarding.spec.js => onboarding.spec.ts} (96%) create mode 100644 client/cypress/tsconfig.json diff --git a/client/cypress/integration/frontend/modules/snapshots.spec.js b/client/cypress/integration/frontend/modules/snapshots.spec.js index 07a69898..4ce3dd67 100644 --- a/client/cypress/integration/frontend/modules/snapshots.spec.js +++ b/client/cypress/integration/frontend/modules/snapshots.spec.js @@ -1,5 +1,5 @@ -import module from '../../fixtures/module.minimal'; -import {getMinimalMe} from '../../support/helpers'; +import module from '../../../fixtures/module.minimal'; +import {getMinimalMe} from '../../../support/helpers'; describe('Snapshot', () => { const operations = isTeacher => ({ diff --git a/client/cypress/integration/frontend/objectives/objectives-visibility.spec.js b/client/cypress/integration/frontend/objectives/objectives-visibility.spec.js index 57b032da..3a0f4267 100644 --- a/client/cypress/integration/frontend/objectives/objectives-visibility.spec.js +++ b/client/cypress/integration/frontend/objectives/objectives-visibility.spec.js @@ -1,5 +1,5 @@ -import {getMe} from '../../support/helpers'; -import mocks from '../../fixtures/mocks'; +import {getMe} from '../../../support/helpers'; +import mocks from '../../../fixtures/mocks'; const modules = { 'lohn-und-budget': { diff --git a/client/cypress/integration/frontend/ui/onboarding.spec.js b/client/cypress/integration/frontend/ui/onboarding.spec.ts similarity index 96% rename from client/cypress/integration/frontend/ui/onboarding.spec.js rename to client/cypress/integration/frontend/ui/onboarding.spec.ts index 13d5bd54..1281e42d 100644 --- a/client/cypress/integration/frontend/ui/onboarding.spec.js +++ b/client/cypress/integration/frontend/ui/onboarding.spec.ts @@ -1,4 +1,4 @@ -import {assertStartPage} from '../../support/helpers'; +import {assertStartPage} from '../../../support/helpers'; describe('Onboarding', () => { beforeEach(() => { diff --git a/client/cypress/integration/frontend/ui/sidebar.spec.js b/client/cypress/integration/frontend/ui/sidebar.spec.js index cb165926..da638cff 100644 --- a/client/cypress/integration/frontend/ui/sidebar.spec.js +++ b/client/cypress/integration/frontend/ui/sidebar.spec.js @@ -1,4 +1,4 @@ -import {getMinimalMe} from '../../support/helpers'; +import {getMinimalMe} from '../../../support/helpers'; describe('Sidebar', () => { beforeEach(() => { diff --git a/client/cypress/integration/frontend/users/new-student.spec.js b/client/cypress/integration/frontend/users/new-student.spec.js index a710b1c6..a5a019a1 100644 --- a/client/cypress/integration/frontend/users/new-student.spec.js +++ b/client/cypress/integration/frontend/users/new-student.spec.js @@ -1,4 +1,4 @@ -import {getMinimalMe} from '../../support/helpers'; +import {getMinimalMe} from '../../../support/helpers'; // const me = require('../../fixtures/me.new-student.json'); diff --git a/client/cypress/integration/frontend/users/school-class-management.spec.js b/client/cypress/integration/frontend/users/school-class-management.spec.js index 88d6782c..7d2877f1 100644 --- a/client/cypress/integration/frontend/users/school-class-management.spec.js +++ b/client/cypress/integration/frontend/users/school-class-management.spec.js @@ -1,7 +1,7 @@ -import {hasOperationName} from '../../support/graphql'; +import {hasOperationName} from '../../../support/graphql'; -const me = require('../../fixtures/me.join-class.json'); -const {getMinimalMe} = require('../../support/helpers'); +const me = require('../../../fixtures/me.join-class.json'); +const {getMinimalMe} = require('../../../support/helpers'); const MeQuery = getMinimalMe({}); const {me: teacher} = MeQuery; diff --git a/client/cypress/integration/frontend/users/team.spec.js b/client/cypress/integration/frontend/users/team.spec.js index 95d65e6d..d65641fb 100644 --- a/client/cypress/integration/frontend/users/team.spec.js +++ b/client/cypress/integration/frontend/users/team.spec.js @@ -1,5 +1,5 @@ -import {getMinimalMe} from '../../support/helpers'; -import {hasOperationName} from '../../support/graphql'; +import {getMinimalMe} from '../../../support/helpers'; +import {hasOperationName} from '../../../support/graphql'; const teacher = getMinimalMe(); diff --git a/client/cypress/plugins/index.js b/client/cypress/plugins/index.js index 00a3e8ae..9ff61e4a 100644 --- a/client/cypress/plugins/index.js +++ b/client/cypress/plugins/index.js @@ -10,11 +10,13 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) +require("tsconfig-paths").register(); -import {readFileSync} from 'fs'; -import {resolve} from 'path'; +const {readFileSync} = require('fs'); +const {resolve} = require('path'); +// import webpackPreprocessor from '@cypress/webpack-preprocessor'; -module.exports = (on, config) => { +module.exports = (on) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config on('task', { diff --git a/client/cypress/support/index.d.ts b/client/cypress/support/index.d.ts index fcf7f476..254a699d 100644 --- a/client/cypress/support/index.d.ts +++ b/client/cypress/support/index.d.ts @@ -16,7 +16,7 @@ declare namespace Cypress { * @example * cy.getByDataCy('my-new-button') */ - getByDataCy(selector: string): Chainable + getByDataCy(selector: string): Chainable selectClass(schoolClass: string): void diff --git a/client/cypress/tsconfig.json b/client/cypress/tsconfig.json new file mode 100644 index 00000000..f87a578b --- /dev/null +++ b/client/cypress/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["es5", "dom"], + "types": ["cypress"] + }, + "include": ["**/*.ts"] +}