From 9b2ae39c7edb38af0defedbfb5f8308a491260bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Tue, 7 Nov 2023 09:58:44 +0100 Subject: [PATCH] Remove Cypress tests The Cypress test setup hasn't been working in ages. Also the spec files haven't been maintained, so most of them would probably need to be rewritten should we want the Cypress test up and running again. --- .gitignore | 3 - cypress.json | 4 - package-lock.json | 22 --- package.json | 3 - src/config/firebaseConfig.js | 2 +- tests/README.md | 28 ---- tests/e2e/.eslintrc.js | 7 - tests/e2e/config.js | 50 ------ tests/e2e/plugins/index.js | 44 ----- .../00 Environment/environment_variables.js | 15 -- .../e2e/specs/01 Login/01 login_error_spec.js | 36 ---- .../01 Login/02 login_admin_user_spec.js | 22 --- .../02 Navigation/page_navigation_spec.js | 36 ---- .../01 Request_access_spec.js | 71 -------- .../10 Organization/organization_spec.js | 79 --------- .../specs/20 Department/department_spec.js | 156 ------------------ tests/e2e/specs/30 Product/01 product_spec.js | 51 ------ .../specs/30 Product/02 objectives.spec.js | 118 ------------- tests/e2e/specs/30 Product/03 keyres.spec.js | 22 --- .../40 Whitelist user/01 whitelist.spec.js | 39 ----- .../02 addUserToProduct.spec.js | 39 ----- .../03 updateDataAsTestUser.spec.js | 148 ----------------- .../99 Delete test data/delete_test_data.js | 30 ---- tests/e2e/support/createKeyres.js | 30 ---- tests/e2e/support/createObjective.js | 20 --- tests/e2e/support/createOrg.js | 21 --- tests/e2e/support/createPeriod.js | 12 -- tests/e2e/support/createProduct.js | 21 --- tests/e2e/support/createTestDepartment.js | 21 --- tests/e2e/support/deleteProduct.js | 29 ---- tests/e2e/support/deleteTestDepartment.js | 15 -- tests/e2e/support/index.js | 11 -- tests/e2e/support/signInAdminUser.js | 8 - tests/e2e/support/signOut.js | 4 - tests/e2e/support/signedInAsAdminUser.js | 5 - 35 files changed, 1 insertion(+), 1221 deletions(-) delete mode 100644 cypress.json delete mode 100644 tests/README.md delete mode 100644 tests/e2e/.eslintrc.js delete mode 100644 tests/e2e/config.js delete mode 100644 tests/e2e/plugins/index.js delete mode 100644 tests/e2e/specs/00 Environment/environment_variables.js delete mode 100644 tests/e2e/specs/01 Login/01 login_error_spec.js delete mode 100644 tests/e2e/specs/01 Login/02 login_admin_user_spec.js delete mode 100644 tests/e2e/specs/02 Navigation/page_navigation_spec.js delete mode 100644 tests/e2e/specs/03 Request access/01 Request_access_spec.js delete mode 100644 tests/e2e/specs/10 Organization/organization_spec.js delete mode 100644 tests/e2e/specs/20 Department/department_spec.js delete mode 100644 tests/e2e/specs/30 Product/01 product_spec.js delete mode 100644 tests/e2e/specs/30 Product/02 objectives.spec.js delete mode 100644 tests/e2e/specs/30 Product/03 keyres.spec.js delete mode 100644 tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js delete mode 100644 tests/e2e/specs/40 Whitelist user/02 addUserToProduct.spec.js delete mode 100644 tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js delete mode 100644 tests/e2e/specs/99 Delete test data/delete_test_data.js delete mode 100644 tests/e2e/support/createKeyres.js delete mode 100644 tests/e2e/support/createObjective.js delete mode 100644 tests/e2e/support/createOrg.js delete mode 100644 tests/e2e/support/createPeriod.js delete mode 100644 tests/e2e/support/createProduct.js delete mode 100644 tests/e2e/support/createTestDepartment.js delete mode 100644 tests/e2e/support/deleteProduct.js delete mode 100644 tests/e2e/support/deleteTestDepartment.js delete mode 100644 tests/e2e/support/index.js delete mode 100644 tests/e2e/support/signInAdminUser.js delete mode 100644 tests/e2e/support/signOut.js delete mode 100644 tests/e2e/support/signedInAsAdminUser.js diff --git a/.gitignore b/.gitignore index 14c7107c4..bc495c7a6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,9 @@ node_modules dist/ docs/ -tests/e2e/videos/* -tests/e2e/screenshots/* # local env files .env.* -cypress.env.json # Log files *.log diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 2bc94b64b..000000000 --- a/cypress.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pluginsFile": "tests/e2e/plugins/index.js", - "baseUrl": "http://localhost:8080" -} diff --git a/package-lock.json b/package-lock.json index 02d4e2d36..7eaf2e8a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,6 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-alias": "^1.1.2", - "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^9.7.0", @@ -6725,18 +6724,6 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-plugin-cypress": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz", - "integrity": "sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==", - "dev": true, - "dependencies": { - "globals": "^11.12.0" - }, - "peerDependencies": { - "eslint": ">= 3.2.1" - } - }, "node_modules/eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -23960,15 +23947,6 @@ } } }, - "eslint-plugin-cypress": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz", - "integrity": "sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==", - "dev": true, - "requires": { - "globals": "^11.12.0" - } - }, "eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", diff --git a/package.json b/package.json index 0548acdab..0fa11de88 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,6 @@ "dev:test": "firebase emulators:start --import=./tests & vite", "build": "vite build --mode production", "build:test": "vite build --mode staging", - "test:e2e": "firebase emulators:start --import=./tests & vite & env-cmd -f ./.env.local cypress open", - "test:e2e:headless": "firebase emulators:exec --project origo-okr-tracker --import=./tests & vite & (sleep 10 && env-cmd -f ./.env.local cypress run --headless)", "deploy": ". ./.env.production && sed -i -e \"s||$VITE_API_GATEWAY_URL|g\" public/openapi.yaml && npm run build && sed -i -e \"s|$VITE_API_GATEWAY_URL||g\" public/openapi.yaml && firebase deploy --project=production", "deploy:test": "npm run build:test && firebase deploy --project=development", "deploy:feature_branch": "npm run build && firebase hosting:channel:deploy --project=production $npm_config_name", @@ -76,7 +74,6 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-alias": "^1.1.2", - "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^9.7.0", diff --git a/src/config/firebaseConfig.js b/src/config/firebaseConfig.js index 6812e9b73..b5f1115e6 100644 --- a/src/config/firebaseConfig.js +++ b/src/config/firebaseConfig.js @@ -41,7 +41,7 @@ const auth = firebase.auth(); const functions = firebase.app().functions(import.meta.env.VITE_REGION); const { serverTimestamp, arrayRemove, arrayUnion } = firebase.firestore.FieldValue; -if (import.meta.env.MODE === 'development' || window.Cypress) { +if (import.meta.env.MODE === 'development') { db.settings(firestoreEmulator); functions.useEmulator('localhost', emulators.functions.port); auth.useEmulator(`http://localhost:${emulators.auth.port}`); diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 9b97a0b5e..000000000 --- a/tests/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Getting started - -The e2e tests use [Cypress](https://www.cypress.io/) in headless mode. - -## Update environment variables - -In the .env.local file add the following lines - -``` -VITE_TESTADMIN_USER= -VITE_TESTADMIN_PASSWORD= -VITE_TESTUSER_USER= -VITE_TESTUSER_PASSWORD= -``` - -## Run tests - -To run Cypress tests, make sure that your development server and Firebase emulators are running: - -``` -§ npm run test:e2e -``` - -To run the end-to-end tests in headless mode your local development server and Firebase emulator must be shut down. - -``` -§ npm run test:e2e:headless -``` diff --git a/tests/e2e/.eslintrc.js b/tests/e2e/.eslintrc.js deleted file mode 100644 index a3af0de0c..000000000 --- a/tests/e2e/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - plugins: ['cypress'], - env: { - mocha: true, - 'cypress/globals': true, - }, -}; diff --git a/tests/e2e/config.js b/tests/e2e/config.js deleted file mode 100644 index a0387f9d1..000000000 --- a/tests/e2e/config.js +++ /dev/null @@ -1,50 +0,0 @@ -export const testOrganization = { - name: 'Test Org', - mission_statement: 'This is my mission statement for the test Org.', - slug: 'test-org', -}; - -export const testDepartment = { - name: 'Test Department', - mission_statement: 'This is my mission statement for the test department.', - slug: 'test-department', - parentOrg: 'Test Org', -}; - -export const testProducts = [ - { - name: 'Test Product One', - mission_statement: 'This is my mission statement for the test product one.', - edited_mission_statement: 'Edited mission statement', - slug: 'test-product-one', - }, - { - name: 'Test Product Two', - mission_statement: 'This is my mission statement for the test product two.', - slug: 'test-product-two', - }, - { - name: 'Test Product Three', - mission_statement: 'This is my mission statement for the test product three.', - slug: 'test-product-three', - }, -]; - -export const testPeriod = { - name: 'Q1 TEST', - date: '2021-01-01 til 2021-06-31', -}; - -export const testObjective = { - name: 'Test Objective', - description: 'This is the description for the test objective.', -}; - -export const testKeyResult = { - name: 'Test Key Result', - longDescription: 'This is a long description for the test key result', - startValue: 10, - targetValue: 50, - progressValue: 30, - unit: 'TestUnit', -}; diff --git a/tests/e2e/plugins/index.js b/tests/e2e/plugins/index.js deleted file mode 100644 index c50e07b45..000000000 --- a/tests/e2e/plugins/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-disable arrow-body-style */ -// https://docs.cypress.io/guides/guides/plugins-guide.html - -// if you need a custom webpack configuration you can uncomment the following import -// and then use the `file:preprocessor` event -// as explained in the cypress docs -// https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples - -// /* eslint-disable import/no-extraneous-dependencies, global-require */ -// const webpack = require('@cypress/webpack-preprocessor') - -// Which environment variables should be copied to cypress -const variables = [ - 'VITE_DASHBOARD_USER', - 'VITE_TESTADMIN_USER', - 'VITE_TESTADMIN_PASSWORD', - 'VITE_TESTUSER_USER', - 'VITE_TESTUSER_PASSWORD', - 'VITE_I18N_LOCALE', - 'VITE_I18N_FALLBACK_LOCALE', - 'NODE_ENV', -]; - -module.exports = (on, config) => { - // on('file:preprocessor', webpack({ - // webpackOptions: require('@vue/cli-service/webpack.config'), - // watchOptions: {} - // })) - - // Copy environment variables - config.env = config.env || {}; - variables.forEach((variable) => { - config.env[variable] = import.meta.env[variable]; - }); - - return { - ...config, - fixturesFolder: 'tests/e2e/fixtures', - integrationFolder: 'tests/e2e/specs', - screenshotsFolder: 'tests/e2e/screenshots', - videosFolder: 'tests/e2e/videos', - supportFile: 'tests/e2e/support/index.js', - }; -}; diff --git a/tests/e2e/specs/00 Environment/environment_variables.js b/tests/e2e/specs/00 Environment/environment_variables.js deleted file mode 100644 index b9d887e36..000000000 --- a/tests/e2e/specs/00 Environment/environment_variables.js +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable */ -describe('Environment checks', () => { - it('Runs in development environment', () => { - expect(Cypress.env('NODE_ENV')).to.equal('development'); - }); - - it('Has required environment variables', () => { - expect(Cypress.env('VITE_TESTADMIN_USER')).to.exist; - expect(Cypress.env('VITE_TESTADMIN_PASSWORD')).to.exist; - expect(Cypress.env('VITE_TESTUSER_USER')).to.exist; - expect(Cypress.env('VITE_TESTUSER_PASSWORD')).to.exist; - expect(Cypress.env('VITE_I18N_LOCALE')).to.exist; - expect(Cypress.env('VITE_I18N_FALLBACK_LOCALE')).to.exist; - }); -}); diff --git a/tests/e2e/specs/01 Login/01 login_error_spec.js b/tests/e2e/specs/01 Login/01 login_error_spec.js deleted file mode 100644 index de23a2f96..000000000 --- a/tests/e2e/specs/01 Login/01 login_error_spec.js +++ /dev/null @@ -1,36 +0,0 @@ -import i18n from '../../../../src/locale/i18n'; - -describe('Login error', () => { - beforeEach(() => { - cy.visit('/').wait(500); - - cy.get('body').then(($body) => { - if ( - $body.text().includes('Test Admin') || - $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) - ) { - cy.signOut(); - } - }); - }); - - it('Visits the app root url', () => { - cy.url().should('include', '/login'); - }); - - it('Try to login with a wrong username - get an userNotFound error', () => { - cy.get('[data-cy="login-username"]').click(); - cy.get('[data-cy="login-username-input"]').type('wrong-mail@internet.com'); - cy.get('input[type="password"]').type('wrongpassword'); - cy.get('form').submit(); - cy.get('.error').contains(i18n.t('login.error.userNotFound')); - }); - - it('Try to login with a correct username but wrong pass - get an wrongPass error', () => { - cy.get('[data-cy="login-username"]').click(); - cy.get('[data-cy="login-username-input"]').type(Cypress.env('VITE_TESTADMIN_USER')); - cy.get('input[type="password"]').type('wrongpassword'); - cy.get('form').submit(); - cy.get('.error').contains(i18n.t('login.error.wrongPassword')); - }); -}); diff --git a/tests/e2e/specs/01 Login/02 login_admin_user_spec.js b/tests/e2e/specs/01 Login/02 login_admin_user_spec.js deleted file mode 100644 index 022191d4b..000000000 --- a/tests/e2e/specs/01 Login/02 login_admin_user_spec.js +++ /dev/null @@ -1,22 +0,0 @@ -describe('Test Admin Login', () => { - before(() => { - cy.visit('/').wait(2000); - - cy.get('body').then(($body) => { - if ( - $body.text().includes('Test Admin') || - $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) - ) { - cy.signOut(); - } - }); - }); - - it('Visits the app root url', () => { - cy.url().should('include', '/login'); - }); - - it('Logs in as test admin', () => { - cy.signInAdminUser(); - }); -}); diff --git a/tests/e2e/specs/02 Navigation/page_navigation_spec.js b/tests/e2e/specs/02 Navigation/page_navigation_spec.js deleted file mode 100644 index ea9c9f038..000000000 --- a/tests/e2e/specs/02 Navigation/page_navigation_spec.js +++ /dev/null @@ -1,36 +0,0 @@ -/* eslint-disable */ -describe('Page navigation', () => { - before(() => { - cy.visit('/'); - - }) - - it('Navigates to help page', () => { - cy.get('.fa-question-circle').click(); - cy.url().should('include', '/help'); - cy.get('.md').contains('Rettigheter til å endre'); - }); - - it('Navigates home via bread crumb', () => { - cy.get('a') - .contains('Hjem') - .click(); - cy.url().should('eq', Cypress.config().baseUrl); - }); - - it('Navigates to admin page', () => { - cy.get('[data-cy="usermenu"').click(); - cy.get('[data-cy="site-header-admin"]').click(); - cy.url().should('include', '/admin'); - cy.contains('Admin'); - cy.contains('Organisasjoner'); - cy.contains('Brukere'); - }); - - it('Navigates to edit profile', () => { - cy.visit('/user'); - cy.get('.title-1').contains('Test Admin'); - cy.contains('Har administratortilgang'); - cy.contains('Lagre'); - }); -}); diff --git a/tests/e2e/specs/03 Request access/01 Request_access_spec.js b/tests/e2e/specs/03 Request access/01 Request_access_spec.js deleted file mode 100644 index c729d4acf..000000000 --- a/tests/e2e/specs/03 Request access/01 Request_access_spec.js +++ /dev/null @@ -1,71 +0,0 @@ -import i18n from '../../../../src/locale/i18n'; - -describe('Request access', () => { - before(() => { - cy.visit('/').wait(2000); - - cy.get('body').then(($body) => { - if ( - $body.text().includes('Test Admin') || - $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) - ) { - cy.signOut(); - } - }); - }); - - it('Visits the app root url', () => { - cy.url().should('include', '/login'); - }); - - it('Request access for two users', () => { - cy.get('[data-cy="login-request"]').click(); - cy.get('[data-cy="request-input"]').type('rejectme@internet.com'); - cy.get('[data-cy="request-btn"]').click(); - cy.get('.toasted').should('contain', i18n.t('toaster.request.requested')); - - cy.url().should('include', '/login'); - - cy.get('[data-cy="login-request"]').click(); - cy.get('[data-cy="request-input"]').type('acceptme@internet.com'); - cy.get('[data-cy="request-btn"]').click(); - cy.get('.toasted').should('contain', i18n.t('toaster.request.requested')); - cy.url().should('include', '/login'); - }); - - it('login as admin and accept one user and reject the other', () => { - cy.signInAdminUser(); - - cy.url().should('include', '/'); - - cy.wait(200); - - cy.get('[data-cy="usermenu"]').click(); - cy.get('[data-cy="site-header-admin"]').click(); - - cy.url().should('include', '/admin'); - cy.get('.access-requests__item') - .eq(0) - .within(() => { - cy.get('.access-requests__email').should('contain', 'acceptme@internet.com'); - cy.get('[data-cy="request-accept"]').click(); - }); - - cy.get('.toasted').should( - 'contain', - i18n.t('toaster.request.accepted', { user: 'acceptme@internet.com' }) - ); - - cy.get('.access-requests__item') - .eq(0) - .within(() => { - cy.get('.access-requests__email').should('contain', 'rejectme@internet.com'); - cy.get('[data-cy="request-reject"]').click(); - }); - - cy.get('.toasted').should( - 'contain', - i18n.t('toaster.request.rejected', { user: 'rejectme@internet.com' }) - ); - }); -}); diff --git a/tests/e2e/specs/10 Organization/organization_spec.js b/tests/e2e/specs/10 Organization/organization_spec.js deleted file mode 100644 index ed8d18913..000000000 --- a/tests/e2e/specs/10 Organization/organization_spec.js +++ /dev/null @@ -1,79 +0,0 @@ -import { testOrganization, testPeriod, testObjective, testKeyResult } from '../../config'; - -describe('Create department', () => { - before(() => { - cy.visit('/').wait(200); - }); - - it('Creates a new organization', () => { - cy.createTestOrg(); - }); - - it('Validates the newly created org', () => { - cy.visit(`/${testOrganization.slug}`); - - cy.get('.sub-nav').should('be.empty'); - - cy.get('.title-1').should('contain', testOrganization.name); - cy.get('.team__list').should('be.empty'); - cy.get('[data-cy="mission_statement"]').should( - 'contain', - testOrganization.mission_statement - ); - cy.get('[data-cy="objectives_list"] .title').should('contain', '(0)'); - }); -}); - -describe('Create data for organization', () => { - it('Navigates to edit page', () => { - cy.get('[data-cy="edit_object_link"]').click(); - - cy.get('[data-cy="org-name"]').should('have.value', testOrganization.name); - - cy.get('[data-cy="admin-okr"]').click(); - }); - - it('Creates a new period with mock data', () => { - cy.get('[data-cy="okr-create-period"]').click(); - - cy.get('[data-cy="period_name"]').clear().type(testPeriod.name); - - cy.get('[input="hidden"]').type(testPeriod.date); - - cy.get('[data-cy="save_period"]').click(); - }); - - it('Creates an objective for the period', () => { - cy.get('[data-cy="okr-create-objective"]').click(); - - cy.get('[data-cy="objective_name_field"]').clear().type(testObjective.name); - - cy.get('[data-cy="objective_description_field"]') - .clear() - .type(testObjective.description); - - cy.get('[data-cy="save_objective_button"]').click(); - }); - - it('Creates a key result for the objective', () => { - cy.get('[data-cy="okr-create-keyResult"]').click().wait(750); - - cy.get('[data-cy="keyResult_name_field"]').clear().type(testKeyResult.name); - - cy.get('[data-cy="keyResult_longdescription_field"]') - .clear() - .type(testKeyResult.longDescription); - - cy.get('[data-cy="keyResult_startvalue_field"]') - .clear() - .type(testKeyResult.startValue); - - cy.get('[data-cy="keyResult_targetvalue_field"]') - .clear() - .type(testKeyResult.targetValue); - - cy.get('[data-cy="keyResult_unit_field"]').clear().type(testKeyResult.unit); - - cy.get('[data-cy="save_keyResult_button"]').click(); - }); -}); diff --git a/tests/e2e/specs/20 Department/department_spec.js b/tests/e2e/specs/20 Department/department_spec.js deleted file mode 100644 index 7366539fc..000000000 --- a/tests/e2e/specs/20 Department/department_spec.js +++ /dev/null @@ -1,156 +0,0 @@ -import { testDepartment, testPeriod, testObjective, testKeyResult } from '../../config'; - -describe('Create department', () => { - before(() => { - cy.visit('/').wait(200); - }); - - it('Creates a new department', () => { - cy.createTestDepartment(); - }); - - it('Validates the newly created department', () => { - cy.visit(`/department/${testDepartment.slug}`).wait(1000); - - cy.get('.sub-nav').should('be.empty'); - - cy.get('.title-1').should('contain', testDepartment.name); - cy.get('.team__list').should('be.empty'); - cy.get('[data-cy="mission_statement"]').should( - 'contain', - testDepartment.mission_statement - ); - cy.get('[data-cy="objectives_list"] .title').should('contain', '(0)'); - }); -}); - -describe('Create data for department', () => { - it('Navigates to edit page', () => { - cy.get('[data-cy="edit_object_link"]').click().wait(750); - - cy.get('[data-cy="dep-name"]').should('have.value', testDepartment.name); - - cy.get('[data-cy="objectives_key_results_tab"]').click().wait(750); - }); - - it('Creates a new period with mock data', () => { - cy.get('[data-cy="add_period_button"]').click().wait(750); - - cy.get('[data-cy="period_name"]').clear().type(testPeriod.name); - - cy.get('[data-cy="save_period"]').click(); - }); - - it('Creates an objective for the period', () => { - cy.get('[data-cy="add_objective_button"]').click().wait(750); - - cy.get('[data-cy="objective_name_field"]').clear().type(testObjective.name); - - cy.get('[data-cy="objective_description_field"]') - .clear() - .type(testObjective.description); - - cy.get('[data-cy="save_objective_button"]').click(); - }); - - it('Creates a key result for the objective', () => { - cy.get('[data-cy="add_keyResult_button"]').click().wait(750); - - cy.get('[data-cy="keyResult_name_field"]').clear().type(testKeyResult.name); - - cy.get('[data-cy="keyResult_longdescription_field"]') - .clear() - .type(testKeyResult.longDescription); - - cy.get('[data-cy="keyResult_startvalue_field"]') - .clear() - .type(testKeyResult.startValue); - - cy.get('[data-cy="keyResult_targetvalue_field"]') - .clear() - .type(testKeyResult.targetValue); - - cy.get('[data-cy="keyResult_unit_field"]').clear().type(testKeyResult.unit); - - cy.get('[data-cy="save_keyResult_button"]').click(); - }); - - it('Validates department data', () => { - cy.visit(`/department/${testDepartment.slug}`).wait(1000); - - cy.get('.title-1').should('contain', testDepartment.name); - cy.get('.team__list').should('be.empty'); - cy.get('.sub-nav .router-link-active').should('contain', testPeriod.name); - - cy.get('[data-cy="objectives_list"] .title').should('contain', '(1)'); - - cy.get('.keyResult').should('contain', testKeyResult.name); - cy.get('.progress__startValue').should('contain', testKeyResult.startValue); - cy.get('.progress__targetValue').should('contain', testKeyResult.targetValue); - cy.get('.progress__unit').should('contain', testKeyResult.unit); - - cy.get('.progress__bar').should('have.css', 'width', '2px'); - }); -}); - -describe('Create progress for key result', () => { - it('Navigates to and validates key result page', () => { - cy.get('.keyResult__name').should('contain', testKeyResult.name).click().wait(1000); - - cy.url().should('include', testDepartment.slug); - - cy.get('.breadcrumb') - .should('contain', testDepartment.name) - .should('contain', testObjective.name) - .should('contain', testKeyResult.name); - - cy.get('.content--main h1.title-1').should('contain', testKeyResult.name); - cy.get('.longDescription').should('contain', testKeyResult.longDescription); - - cy.get('.table tbody').should('be.empty'); - }); - - it('Adds progression to key result', () => { - cy.get('[data-cy="progress_value_field"]').clear().type(testKeyResult.progressValue); - - cy.get('[data-cy="today_button"]').contains('I dag').click(); - - cy.get('[data-cy="add_progress_button"]').click().wait(750); - - cy.get('svg path').should('exist'); - - cy.get('.table tbody') - .should('not.be.empty') - .should('contain', testKeyResult.progressValue) - .should('contain', Cypress.env('VITE_TESTADMIN_USER')); - }); - - it('Verifies the progress on department page', () => { - cy.get('.breadcrumb__item').contains(testDepartment.name).click().wait(400); - - cy.get('svg text.percent').should('contain', '50%'); - - cy.get('[data-cy="objectives_list"]') - .should('contain', '(50%)') - .should('contain', testObjective.description); - - cy.get('.progress__current-value').should('contain', testKeyResult.progressValue); - }); - - it('Updates progress from product page (inline)', () => { - cy.get('button.keyResult__toggle').click(); - - cy.get('.keyResult__edit input') - .clear() - .type(`${testKeyResult.targetValue} {enter}`) - .wait(2500); - - cy.get('svg text.percent').should('contain', '100%'); - - cy.get('[data-cy="objectives_list"]') - .should('contain', '(100%)') - .should('contain', testObjective.description); - - cy.get('.progress__bar').should('have.class', 'completed'); - }); -}); diff --git a/tests/e2e/specs/30 Product/01 product_spec.js b/tests/e2e/specs/30 Product/01 product_spec.js deleted file mode 100644 index f83d0f681..000000000 --- a/tests/e2e/specs/30 Product/01 product_spec.js +++ /dev/null @@ -1,51 +0,0 @@ -import { testDepartment, testProducts } from '../../config'; - -describe('Create products for test department', () => { - before(() => { - cy.visit('/').wait(3000); - - // Log in as admin if not already logged in - cy.get('body').then(($body) => { - if (!$body.text().includes('Hjem')) { - cy.log('Signing in as admin user'); - cy.signInAdminUser(); - } else { - cy.log('Already logged in'); - } - }); - - // Delete the test department if it already exists - cy.get('.productList').then(($el) => { - if ($el.text().includes(testDepartment.name)) { - cy.log('Test department exists'); - - testProducts.forEach((prod, index) => { - if ($el.text().includes(testProducts[index].name)) { - cy.log('Test product already exists'); - cy.log('Deleting test product'); - cy.deleteProduct(index); - } else { - cy.log('Test product does not exists'); - } - }); - } else { - cy.log('Test department does not exists'); - cy.createTestDepartment(); - cy.log('Completed test department creation'); - } - }); - }); - - it('Creates new products', () => { - cy.createProduct(0); - cy.createProduct(1); - }); - - it('Creates periods for products', () => { - cy.visit(`/product/${testProducts[0].slug}/edit/objectives-key-results`).wait(2000); - cy.createPeriod(); - - cy.visit(`/product/${testProducts[1].slug}/edit/objectives-key-results`).wait(2000); - cy.createPeriod(); - }); -}); diff --git a/tests/e2e/specs/30 Product/02 objectives.spec.js b/tests/e2e/specs/30 Product/02 objectives.spec.js deleted file mode 100644 index c706921c0..000000000 --- a/tests/e2e/specs/30 Product/02 objectives.spec.js +++ /dev/null @@ -1,118 +0,0 @@ -import { testProducts, testPeriod, testObjective } from '../../config'; - -describe('Create objectives', () => { - before(() => { - cy.visit('/').wait(3000); - - // Log in as admin if not already logged in - cy.get('body').then(($body) => { - if (!$body.text().includes('Hjem')) { - cy.log('Signing in as admin user'); - cy.signInAdminUser(); - } else { - cy.log('Already logged in'); - } - }); - - // Check if products exist - cy.get('.productList').then(($el) => { - if ($el.text().includes(testProducts[0].name)) { - cy.log('Test product one exists'); - } else { - cy.createProduct(0); - } - - if ($el.text().includes(testProducts[1].name)) { - cy.log('Test product two exists'); - } else { - cy.createProduct(1); - } - }); - - // check if periods exist - cy.visit(`/product/${testProducts[0].slug}`) - .get('.sub-nav') - .then(($body) => { - if (!$body.text().includes(testPeriod.name)) { - cy.log('Period exists'); - } else { - cy.visit(`/product/${testProducts[0].slug}/edit/objectives-key-results`).wait( - 1000 - ); - cy.createPeriod(); - } - }); - - // check if periods exist - cy.visit(`/product/${testProducts[1].slug}`) - .get('.sub-nav') - .then(($body) => { - if (!$body.text().includes(testPeriod.name)) { - cy.log('Period exists'); - } else { - cy.visit(`/product/${testProducts[1].slug}/edit/objectives-key-results`).wait( - 1000 - ); - cy.createPeriod(); - } - }); - - cy.visit(`/product/${testProducts[0].slug}`) - .wait(3000) - .get('[data-cy="objectives_list"]') - .then(($body) => { - if ($body.text().includes(testObjective.name)) { - cy.get('[data-cy="edit_object_link"]') - .click() - .wait(500) - .get('[data-cy="objectives_and_key_results_tab"]') - .click() - .wait(500) - .get('.miller__col__item') - .contains(testPeriod.name) - .click() - .wait(500) - .get('.miller__col__item') - .contains(testObjective.name) - .click() - .wait(500) - .get('[data-cy="delete_objective_button"]') - .click() - .wait(1000); - } - }); - - cy.visit(`/product/${testProducts[1].slug}`) - .wait(3000) - .get('[data-cy="objectives_list"]') - .then(($body) => { - if ($body.text().includes(testObjective.name)) { - cy.get('[data-cy="edit_object_link"]') - .click() - .wait(500) - .get('[data-cy="objectives_and_key_results_tab"]') - .click() - .wait(500) - .get('.miller__col__item') - .contains(testPeriod.name) - .click() - .wait(500) - .get('.miller__col__item') - .contains(testObjective.name) - .click() - .wait(500) - .get('[data-cy="delete_objective_button"]') - .click() - .wait(1000); - } - }); - }); - - it('Creates objective for test product one', () => { - cy.visit(`/product/${testProducts[0].slug}`).wait(1000).createObjective(); - }); - - it('Creates objective for test product two', () => { - cy.visit(`/product/${testProducts[1].slug}`).wait(1000).createObjective(); - }); -}); diff --git a/tests/e2e/specs/30 Product/03 keyres.spec.js b/tests/e2e/specs/30 Product/03 keyres.spec.js deleted file mode 100644 index b3f87250e..000000000 --- a/tests/e2e/specs/30 Product/03 keyres.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -describe('Create key results', () => { - before(() => { - cy.visit('/').wait(3000); - - // Log in as admin if not already logged in - cy.get('body').then(($body) => { - if (!$body.text().includes('Hjem')) { - cy.log('Signing in as admin user'); - cy.signInAdminUser(); - } else { - cy.log('Already logged in'); - } - }); - }); - - it('Creates key result for test product one', () => { - cy.createKeyres(0); - }); - it('Creates key result for test product two', () => { - cy.createKeyres(1); - }); -}); diff --git a/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js b/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js deleted file mode 100644 index d2a883e40..000000000 --- a/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -describe('Whitelist user', () => { - before(() => { - cy.visit('/').wait(3000); - - // Log in as admin if not already logged in - cy.get('body').then(($body) => { - if (!$body.text().includes('Hjem')) { - cy.log('Signing in as admin user'); - cy.signInAdminUser(); - } else { - cy.log('Already logged in'); - } - }); - }); - - it('Creates a new whitelisted user', () => { - cy.visit('/admin').wait(2000); - - cy.get('.whitelist__body').should('not.contain', Cypress.env('VITE_TESTUSER_USER')); - - cy.get('[data-cy="email_list"]') - .clear() - .type(Cypress.env('VITE_TESTUSER_USER')) - .get('[data-cy="add_users_button"]') - .click() - .wait(100); - - cy.get('.whitelist__body').should('contain', Cypress.env('VITE_TESTUSER_USER')); - }); - - it('Finds the test user with search', () => { - cy.get('[data-cy="user_search_field"]') - .clear() - .type(Cypress.env('VITE_TESTUSER_USER')) - .wait(100); - - cy.get('.whitelist__body').should('contain', Cypress.env('VITE_TESTUSER_USER')); - }); -}); diff --git a/tests/e2e/specs/40 Whitelist user/02 addUserToProduct.spec.js b/tests/e2e/specs/40 Whitelist user/02 addUserToProduct.spec.js deleted file mode 100644 index b7d0d5c34..000000000 --- a/tests/e2e/specs/40 Whitelist user/02 addUserToProduct.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import { testProducts } from '../../config'; - -describe('Add user to product', () => { - before(() => { - cy.visit('/') - .wait(1000) - .get('.usernav__name') - .then(($el) => { - if (!$el.text().includes(Cypress.env('Test Admin'))) { - cy.signOut(); - cy.signInAdminUser(); - } - }); - }); - - it('Navigates to edit page for product one', () => { - cy.visit(`/product/${testProducts[0].slug}/edit`).wait(2000); - - cy.get('[data-cy="product_name_field"]').should('have.value', testProducts[0].name); - }); - - it('Adds test user to product one', () => { - cy.get('[data-cy="team_field"]') - .click() - .type(Cypress.env('VITE_TESTUSER_USER')) - .get('.vs__dropdown-menu > li') - .click(); - }); - - it('Saves the product', () => { - cy.get('[data-cy="save_product_button"]').should('not.be.disabled').click(); - - cy.get('.toasted').should('contain', 'Lagret'); - }); - - it('Logs out from test admin', () => { - cy.signOut(); - }); -}); diff --git a/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js b/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js deleted file mode 100644 index ad07801d9..000000000 --- a/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js +++ /dev/null @@ -1,148 +0,0 @@ -import { - testProducts, - testDepartment, - testObjective, - testKeyResult, - testPeriod, -} from '../../config'; - -describe('Verifies restrictions for test user', () => { - before(() => { - cy.visit('/').wait(1000); - }); - - it('Logs in as test user', () => { - cy.get('input[type="password"]').type(Cypress.env('VITE_TESTUSER_PASSWORD')); - cy.get('form').submit(); - cy.wait(1000); - - cy.visit('/me') - .wait(1000) - .get('.page-header__name') - .should('contain', Cypress.env('VITE_TESTUSER_USER')); - }); - - it('Verifies team membership (Product one)', () => { - cy.get('.product') - .should('contain', testDepartment.name) - .should('contain', testProducts[0].name) - .click() - .wait(1000); - }); - - it('Verifies contents on product page (Product One)', () => { - cy.get('.sidebar-nav') - .should('contain', 'Endre produkt') - .should('contain', 'Legg til mål') - .should('contain', 'Nytt nøkkelresultat') - .should('contain', 'Oppdater data'); - - cy.get('[data-cy="mission_statement"]').should( - 'contain', - testProducts[0].mission_statement - ); - - cy.get('.sub-nav').should('contain', testPeriod.name); - - cy.get('.team__list').should('contain', Cypress.env('VITE_TESTUSER_USER')); - - cy.get('.list') - .should('contain', testObjective.name) - .should('contain', testObjective.description) - .should('contain', testKeyResult.name) - .should('contain', testKeyResult.startValue) - .should('contain', testKeyResult.targetValue) - .should('contain', testKeyResult.unit); - }); - - it('Allows test user to edit Product One', () => { - cy.get('[data-cy="edit_object_link"]').click().wait(500); - - cy.get('[data-cy="product_name_field"]').should('have.value', testProducts[0].name); - - cy.get('[data-cy="product_mission_statement_field"]') - .clear() - .type(testProducts[0].edited_mission_statement); - - cy.get('[data-cy="save_product_button"]').should('not.be.disabled').click(); - - cy.get('.toasted').should('contain', 'Lagret'); - }); - - it('Verifies the changed Product', () => { - cy.visit(`/product/${testProducts[0].slug}`).wait(1000); - - cy.get('[data-cy="mission_statement"]').should( - 'contain', - testProducts[0].edited_mission_statement - ); - }); - - it('Allows updating progress for Product one (using modal)', () => { - cy.get('[data-cy="update_data"]').click().wait(4500); - - cy.get('.modal') - .should('contain', testKeyResult.name) - .should('contain', testKeyResult.startValue) - .should('contain', testKeyResult.targetValue) - .should('contain', testKeyResult.unit); - - cy.get('[data-cy="value_field"]').clear().type(testKeyResult.targetValue); - - cy.get('[data-cy="save_button"]').click(); - - cy.get('.toasted').should('contain', 'Lagt til ny verdi'); - }); - - it('Cannot edit Product two', () => { - cy.visit(`/product/${testProducts[1].slug}`).wait(1000); - - cy.get('[data-cy="mission_statement"]').should( - 'contain', - testProducts[1].mission_statement - ); - - cy.get('.list') - .should('contain', testObjective.name) - .should('contain', testObjective.description) - .should('contain', testKeyResult.name) - .should('contain', testKeyResult.startValue) - .should('contain', testKeyResult.targetValue) - .should('contain', testKeyResult.unit); - - cy.get('.sidebar-nav') - .should('not.contain', 'Endre produkt') - .should('not.contain', 'Legg til mål') - .should('not.contain', 'Nytt nøkkelresultat') - .should('not.contain', 'Oppdater data'); - - cy.visit(`/product/${testProducts[1].slug}/edit`) - .wait(2000) - .url() - .should('not.include', testProducts[1].slug); - }); - - it('Cannot access admin page', () => { - cy.visit(`/admin`).wait(1000).url().should('not.include', 'admin'); - }); - - it('Cannot edit department', () => { - cy.visit(`/`) - .wait(1000) - .get('.department > a') - .contains(testDepartment.name) - .click() - .wait(1000); - - cy.get('.sidebar-nav') - .should('not.contain', 'Endre produkt') - .should('not.contain', 'Legg til mål') - .should('not.contain', 'Nytt nøkkelresultat') - .should('not.contain', 'Oppdater data') - .should('contain', 'Vis medlemmer'); - }); - - it('Logs out as test user', () => { - cy.signOut(); - }); -}); diff --git a/tests/e2e/specs/99 Delete test data/delete_test_data.js b/tests/e2e/specs/99 Delete test data/delete_test_data.js deleted file mode 100644 index 24149664b..000000000 --- a/tests/e2e/specs/99 Delete test data/delete_test_data.js +++ /dev/null @@ -1,30 +0,0 @@ -describe('Delete department', () => { - before(() => { - cy.visit('/'); - cy.signInAdminUser(); - }); - - it('Deletes test products', () => { - cy.deleteProduct(0); - cy.deleteProduct(1); - }); - - it('Deletes test department', () => { - cy.deleteTestDepartment(); - }); - - it('Removes test user', () => { - cy.visit('/admin').wait(3000); - - cy.get('.whitelist__body') - .find('.whitelist__row') - .filter(`:contains(${Cypress.env('VITE_TESTUSER_USER')})`) - .find('.btn--borderless') - .click() - .wait(1000); - }); - - it('Logs out', () => { - cy.signOut(); - }); -}); diff --git a/tests/e2e/support/createKeyres.js b/tests/e2e/support/createKeyres.js deleted file mode 100644 index cdaf8c749..000000000 --- a/tests/e2e/support/createKeyres.js +++ /dev/null @@ -1,30 +0,0 @@ -import { testObjective, testProducts, testKeyResult } from '../config'; - -Cypress.Commands.add('createKeyres', (index) => { - cy.visit(`/product/${testProducts[index].slug}`) - .wait(1500) - .get('[data-cy="add_keyResult"]') - .click() - .wait(100) - .get('.popout [data-cy="objective_selector"] .vs__dropdown-toggle') - .click() - .type(testObjective.name) - .type('{enter}') - .get('[data-cy="keyResult_name_field"]') - .clear() - .type(testKeyResult.name) - .get('[data-cy="keyResult_description_field"]') - .clear() - .type(testKeyResult.longDescription) - .get('[data-cy="keyResult_startvalue_field"]') - .clear() - .type(testKeyResult.startValue) - .get('[data-cy="keyResult_targetvalue_field"]') - .clear() - .type(testKeyResult.targetValue) - .get('[data-cy="keyResult_unit_field"]') - .clear() - .type(testKeyResult.unit); - - cy.get('[data-cy="save_keyResult_button"]').click().wait(1200); -}); diff --git a/tests/e2e/support/createObjective.js b/tests/e2e/support/createObjective.js deleted file mode 100644 index d89ffcee4..000000000 --- a/tests/e2e/support/createObjective.js +++ /dev/null @@ -1,20 +0,0 @@ -import { testObjective, testPeriod } from '../config'; - -/** - * Assumes the current view is at objectives and key results tab on 'edit product' page - */ -Cypress.Commands.add('createObjective', () => { - cy.get('[data-cy="add_objective"]').click().wait(500); - - cy.get('[data-cy="period_selector"]') - .click() - .type(testPeriod.name) - .get('.vs__dropdown-menu > li') - .click(); - - cy.get('[data-cy="objective_title_field"]').clear().type(testObjective.name); - - cy.get('[data-cy="objective_body_field"]').clear().type(testObjective.description); - - cy.get('[data-cy="save_objective"]').click().wait(2000); -}); diff --git a/tests/e2e/support/createOrg.js b/tests/e2e/support/createOrg.js deleted file mode 100644 index aed4b2474..000000000 --- a/tests/e2e/support/createOrg.js +++ /dev/null @@ -1,21 +0,0 @@ -import { testOrganization } from '../config'; - -Cypress.Commands.add('createTestOrg', () => { - cy.visit('/admin'); - - cy.get('[data-cy="create-organization"]').click(); - - cy.url().should('include', '/admin/create-organization'); - - cy.get('[data-cy="org-name"]').clear().type(testOrganization.name); - - cy.get('[data-cy="org-missionStatement"]') - .clear() - .type(testOrganization.mission_statement); - - cy.get('[data-cy="btn-createOrg"]').click(); - - cy.wait(5000); - - cy.url().should('include', '/test-org'); -}); diff --git a/tests/e2e/support/createPeriod.js b/tests/e2e/support/createPeriod.js deleted file mode 100644 index 79a861219..000000000 --- a/tests/e2e/support/createPeriod.js +++ /dev/null @@ -1,12 +0,0 @@ -import { testPeriod } from '../config'; - -/** - * Assumes the current view is at objectives and key results tab on 'edit product' page - */ -Cypress.Commands.add('createPeriod', () => { - cy.get('[data-cy="add_period_button"]').click().wait(2000); - - cy.get('[data-cy="period_name"]').clear().type(testPeriod.name); - - cy.get('[data-cy="save_period"]').click().wait(500); -}); diff --git a/tests/e2e/support/createProduct.js b/tests/e2e/support/createProduct.js deleted file mode 100644 index 77688e973..000000000 --- a/tests/e2e/support/createProduct.js +++ /dev/null @@ -1,21 +0,0 @@ -import { testDepartment, testProducts } from '../config'; - -Cypress.Commands.add('createProduct', (productIndex) => { - cy.visit('/admin').wait(2000); - - cy.get('[data-cy="admin-depsAndProds"]').click().wait(1000); - - cy.url().should('include', '/admin/data'); - - cy.get('.miller__col__item').contains(testDepartment.name).click().wait(500); - - cy.get('[data-cy="admin-addProduct"]').click().wait(1000); - - cy.get('[data-cy="product_name_field"]').clear().type(testProducts[productIndex].name); - - cy.get('[data-cy="product_mission_statement_field"]') - .clear() - .type(testProducts[productIndex].mission_statement); - - cy.get('[data-cy="save_product_button"]').click(); -}); diff --git a/tests/e2e/support/createTestDepartment.js b/tests/e2e/support/createTestDepartment.js deleted file mode 100644 index ec85a20a0..000000000 --- a/tests/e2e/support/createTestDepartment.js +++ /dev/null @@ -1,21 +0,0 @@ -import { testDepartment } from '../config'; - -Cypress.Commands.add('createTestDepartment', () => { - cy.visit('/admin'); - - cy.get('[data-cy="create-department"]').click(); - - cy.url().should('include', '/admin/create-department'); - - cy.get('[data-cy="dep-name"]').clear().type(testDepartment.name); - - cy.get('[data-cy="dep-missionStatement"]') - .clear() - .type(testDepartment.mission_statement); - - cy.get('[data-cy="dep-parentOrg"]') - .select(testDepartment.parentOrg) - .should('have.value', testDepartment.parentOrg); - - cy.get('[data-cy="btn-createDep"]').click(); -}); diff --git a/tests/e2e/support/deleteProduct.js b/tests/e2e/support/deleteProduct.js deleted file mode 100644 index c652635df..000000000 --- a/tests/e2e/support/deleteProduct.js +++ /dev/null @@ -1,29 +0,0 @@ -import { testDepartment, testProducts } from '../config'; - -Cypress.Commands.add('deleteProduct', (productIndex) => { - cy.visit('/admin').wait(2000); - - cy.get('[data-cy="admin-depsAndProds"]').click().wait(1000); - - cy.url().should('include', '/admin/data'); - - cy.get('.miller__col__item').contains(testDepartment.name).click().wait(500); - - cy.get('.miller__col__item') - .contains(testProducts[productIndex].name) - .click() - .wait(500); - - cy.get('[data-cy="delete_product_button"]').click().wait(100); - - cy.get('.toggle').click().wait(500); - - cy.get('.miller__col__item').contains(testDepartment.name).click().wait(750); - - cy.get('.miller__col__item') - .contains(testProducts[productIndex].name) - .click() - .wait(750); - - cy.get('[data-cy="permanently-delete-object"]').click(); -}); diff --git a/tests/e2e/support/deleteTestDepartment.js b/tests/e2e/support/deleteTestDepartment.js deleted file mode 100644 index c157a39ca..000000000 --- a/tests/e2e/support/deleteTestDepartment.js +++ /dev/null @@ -1,15 +0,0 @@ -import { testDepartment } from '../config'; - -Cypress.Commands.add('deleteTestDepartment', () => { - cy.visit('/admin/data').wait(2000); - - cy.get('.miller__col__item').contains(testDepartment.name).click().wait(600); - - cy.get('[data-cy="btn-deleteDep"]').click().wait(600); - - cy.get('.toggle').click().wait(1000); - - cy.get('.miller__col__item').contains(testDepartment.name).click().wait(1000); - - cy.get('[data-cy="permanently-delete-object"]').click().wait(1000); -}); diff --git a/tests/e2e/support/index.js b/tests/e2e/support/index.js deleted file mode 100644 index 8383385fc..000000000 --- a/tests/e2e/support/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import './signOut'; -import './signInAdminUser'; -import './signedInAsAdminUser'; -import './deleteTestDepartment'; -import './createTestDepartment'; -import './createProduct'; -import './deleteProduct'; -import './createPeriod'; -import './createObjective'; -import './createKeyres'; -import './createOrg'; diff --git a/tests/e2e/support/signInAdminUser.js b/tests/e2e/support/signInAdminUser.js deleted file mode 100644 index 4f615ff1c..000000000 --- a/tests/e2e/support/signInAdminUser.js +++ /dev/null @@ -1,8 +0,0 @@ -Cypress.Commands.add('signInAdminUser', () => { - cy.get('[data-cy="login-username"]').click(); - cy.get('[data-cy="login-username-input"]').type(Cypress.env('VITE_TESTADMIN_USER')); - cy.get('input[type="password"]').type(Cypress.env('VITE_TESTADMIN_PASSWORD')); - cy.get('form').submit(); - cy.wait(2000); - cy.get('.user__name').contains('Test Admin'); -}); diff --git a/tests/e2e/support/signOut.js b/tests/e2e/support/signOut.js deleted file mode 100644 index 32fec93a2..000000000 --- a/tests/e2e/support/signOut.js +++ /dev/null @@ -1,4 +0,0 @@ -Cypress.Commands.add('signOut', () => { - cy.get('[data-cy="usermenu"]').click(); - cy.get('[data-cy="site-header-signout"]').click(); -}); diff --git a/tests/e2e/support/signedInAsAdminUser.js b/tests/e2e/support/signedInAsAdminUser.js deleted file mode 100644 index 6e0d0a2ea..000000000 --- a/tests/e2e/support/signedInAsAdminUser.js +++ /dev/null @@ -1,5 +0,0 @@ -Cypress.Commands.add('signedInAdminUser', () => { - cy.visit('/'); - cy.wait(500); - cy.get('.usernav__display-name').contains('Test Admin'); -});