From 7e5838a6811273ecfa0fece982264f85c686f9e8 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Thu, 13 Apr 2023 16:04:06 +0300 Subject: [PATCH] fix: remove e2e tests (#3515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After discussions around e2e tests: - Became clear that the intention is to test core functionality only Removing 2 test files: - notifications.spec.ts : because all PRs are run against the same heroku backend - no guarantee that more notifications will not happen as other tests run - so the test is flaky - settings.spec.ts: depends on instance being enterprise and a flag on ## About the changes Closes # ### Important files ## Discussion points Signed-off-by: andreas-unleash --- .github/workflows/e2e.frontend.yaml | 2 - .../projects/notifications.spec.ts | 59 -------------- .../integration/projects/settings.spec.ts | 78 ------------------- 3 files changed, 139 deletions(-) delete mode 100644 frontend/cypress/integration/projects/notifications.spec.ts delete mode 100644 frontend/cypress/integration/projects/settings.spec.ts diff --git a/.github/workflows/e2e.frontend.yaml b/.github/workflows/e2e.frontend.yaml index 2b3917ced6..3bbd1835de 100644 --- a/.github/workflows/e2e.frontend.yaml +++ b/.github/workflows/e2e.frontend.yaml @@ -11,8 +11,6 @@ jobs: - groups/groups.spec.ts - projects/access.spec.ts - projects/overview.spec.ts - - projects/settings.spec.ts - - projects/notifications.spec.ts - segments/segments.spec.ts - import/import.spec.ts steps: diff --git a/frontend/cypress/integration/projects/notifications.spec.ts b/frontend/cypress/integration/projects/notifications.spec.ts deleted file mode 100644 index 8cd2bef1e3..0000000000 --- a/frontend/cypress/integration/projects/notifications.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -/// - -const EDITOR = 2; - -describe('notifications', () => { - const randomId = String(Math.random()).split('.')[1]; - const featureToggleName = `notifications_test-${randomId}`; - const baseUrl = Cypress.config().baseUrl; - let userIds: number[] = []; - let userCredentials: Cypress.UserCredentials[] = []; - const userName = `notifications_user-${randomId}`; - const projectName = `default`; - - before(() => { - cy.runBefore(); - }); - - it.skip('should create a notification when a feature is created in a project', () => { - cy.login_UI(); - cy.createUser_API(userName, EDITOR).then(value => { - userIds = value.userIds; - userCredentials = value.userCredentials; - - cy.login_UI(); - cy.visit(`/projects/${projectName}`); - - cy.createFeature_UI(featureToggleName); - - //Should not show own notifications - cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click(); - - //then - cy.get("[data-testid='NOTIFICATIONS_MODAL']").should('exist'); - - const credentials = userCredentials[0]; - - //Sign in as a different user - cy.login_UI(credentials.email, credentials.password); - cy.visit(`/projects/${projectName}`); - cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click(); - - //then - cy.get("[data-testid='UNREAD_NOTIFICATIONS']").should('exist'); - cy.get("[data-testid='NOTIFICATIONS_LIST']").should( - 'contain.text', - `New feature ${featureToggleName}` - ); - - //clean - // We need to login as admin for cleanup - cy.login_UI(); - userIds.forEach(id => - cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`) - ); - - cy.deleteFeature_API(featureToggleName); - }); - }); -}); diff --git a/frontend/cypress/integration/projects/settings.spec.ts b/frontend/cypress/integration/projects/settings.spec.ts deleted file mode 100644 index bdff8ab941..0000000000 --- a/frontend/cypress/integration/projects/settings.spec.ts +++ /dev/null @@ -1,78 +0,0 @@ -/// - -describe('project settings', () => { - const randomId = String(Math.random()).split('.')[1]; - const baseUrl = Cypress.config().baseUrl; - const projectName = `stickiness-project-${randomId}`; - const TEST_STICKINESS = 'userId'; - const featureToggleName = `settings-${randomId}`; - let cleanFeature = false; - let cleanProject = false; - - before(() => { - cy.runBefore(); - }); - - beforeEach(() => { - cy.login_UI(); - if (cleanFeature) { - cy.deleteFeature_API(featureToggleName); - } - if (cleanProject) { - cy.deleteProject_API(projectName); - } - cy.visit(`/projects`); - cy.wait(300); - }); - - it('should store default project stickiness when creating, retrieve it when editing a project', () => { - //when - cleanProject = true; - cy.createProject_UI(projectName, TEST_STICKINESS); - cy.visit(`/projects/${projectName}`); - cy.get("[data-testid='NAVIGATE_TO_EDIT_PROJECT']").click(); - - //then - cy.get("[id='stickiness-select']") - .first() - .should('have.text', 'userId'); - - //clean - cy.request('DELETE', `${baseUrl}/api/admin/projects/${projectName}`); - }); - - it('should respect the default project stickiness when creating a Gradual Rollout Strategy', () => { - cy.createProject_UI(projectName, TEST_STICKINESS); - cy.createFeature_UI(featureToggleName, true, projectName); - cleanFeature = true; - - //when - then - cy.addFlexibleRolloutStrategyToFeature_UI({ - featureToggleName, - project: projectName, - stickiness: TEST_STICKINESS, - }); - - //clean - }); - - it.skip('should respect the default project stickiness when creating a variant', () => { - cy.createProject_UI(projectName, TEST_STICKINESS); - cy.createFeature_UI(featureToggleName, true, projectName); - - //when - cy.visit( - `/projects/${projectName}/features/${featureToggleName}/variants` - ); - - cy.get("[data-testid='ADD_VARIANT_BUTTON']").first().click(); - //then - cy.get("[id='stickiness-select']") - .first() - .should('have.text', 'userId'); - - //clean - cy.deleteFeature_API(featureToggleName); - cy.deleteProject_API(projectName); - }); -});