From 48a9c243bb68699464f8e520a50356e6d979a061 Mon Sep 17 00:00:00 2001 From: Gavin Reynolds Date: Wed, 6 Dec 2023 10:01:35 +0000 Subject: [PATCH] Set Test Isolation as default Signed-off-by: Gavin Reynolds --- cypress.config.js | 4 +--- cypress/e2e/Incidents/incidents.spec.js | 5 +---- cypress/e2e/Query/query.spec.js | 13 +------------ cypress/e2e/Search/search.spec.js | 2 +- cypress/e2e/Settings/settings.spec.js | 12 ++++++++---- cypress/e2e/app.spec.js | 4 ++-- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index e1e3d7ce..5be05f0c 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -22,8 +22,6 @@ module.exports = defineConfig({ }, baseUrl: 'http://localhost:3000/pd-live-react', specPattern: 'cypress/e2e/**/*.spec.{js,ts,jsx,tsx}', - // Cypress 12 introduces Test Isolation by default which breaks our current tests - // https://docs.cypress.io/guides/references/migration-guide#Test-Isolation - testIsolation: false, + testIsolation: true, }, }); diff --git a/cypress/e2e/Incidents/incidents.spec.js b/cypress/e2e/Incidents/incidents.spec.js index e90e88c7..0348a477 100644 --- a/cypress/e2e/Incidents/incidents.spec.js +++ b/cypress/e2e/Incidents/incidents.spec.js @@ -27,7 +27,7 @@ import { selectAlert, } from '../../support/util/common'; -describe('Manage Open Incidents', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('Manage Open Incidents', { failFast: { enabled: true } }, () => { // We use beforeEach as each test will reload/clear the session beforeEach(() => { acceptDisclaimer(); @@ -316,9 +316,6 @@ describe('Manage Open Incidents', { failFast: { enabled: true }, testIsolation: cy.get('[data-popper-placement="bottom"]').should('contain', 'Created At'); cy.get('[data-popper-placement="bottom"]').should('contain', 'Status'); cy.get('[data-popper-placement="bottom"]').should('contain', 'Summary'); - - // Reset hover state - cy.get('body').realHover({ position: 'topLeft' }); }); it('Split/move alert from one incident to a new incident', () => { diff --git a/cypress/e2e/Query/query.spec.js b/cypress/e2e/Query/query.spec.js index f1579a8b..40da603b 100644 --- a/cypress/e2e/Query/query.spec.js +++ b/cypress/e2e/Query/query.spec.js @@ -19,7 +19,7 @@ import { registerLocale('en-GB', gb); moment.locale('en-GB'); -describe('Query Incidents', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('Query Incidents', { failFast: { enabled: true } }, () => { beforeEach(() => { acceptDisclaimer(); manageIncidentTableColumns('remove', ['latest_note']); @@ -54,9 +54,6 @@ describe('Query Incidents', { failFast: { enabled: true }, testIsolation: true } }); } }); - - // Reset query for next test - both high and low-urgency triggered, ackd and resolved incidents - cy.get('.query-urgency-low-button').check({ force: true }); }); it('Query for triggered incidents only', () => { @@ -86,11 +83,6 @@ describe('Query Incidents', { failFast: { enabled: true }, testIsolation: true } cy.get('.query-status-resolved-button').check({ force: true }); waitForIncidentTable(); checkIncidentCellIconAllRows('Status', 'fa-circle-check'); - - // Reset query for next test - cy.get('.query-status-triggered-button').check({ force: true }); - cy.get('.query-status-acknowledged-button').check({ force: true }); - cy.get('.query-status-resolved-button').uncheck({ force: true }); }); it('Query for high urgency incidents only', () => { @@ -105,9 +97,6 @@ describe('Query Incidents', { failFast: { enabled: true }, testIsolation: true } cy.get('.query-urgency-low-button').check({ force: true }); waitForIncidentTable(); checkIncidentCellContentAllRows('Urgency', ' Low'); - - // Reset query for next test - cy.get('.query-urgency-high-button').check({ force: true }); }); priorityNames.forEach((currentPriority) => { diff --git a/cypress/e2e/Search/search.spec.js b/cypress/e2e/Search/search.spec.js index 17e91bf0..900df9ac 100644 --- a/cypress/e2e/Search/search.spec.js +++ b/cypress/e2e/Search/search.spec.js @@ -11,7 +11,7 @@ import { updateFuzzySearch, } from '../../support/util/common'; -describe('Search Incidents', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('Search Incidents', { failFast: { enabled: true } }, () => { beforeEach(() => { acceptDisclaimer(); waitForIncidentTable(); diff --git a/cypress/e2e/Settings/settings.spec.js b/cypress/e2e/Settings/settings.spec.js index c202cf0b..0512bc36 100644 --- a/cypress/e2e/Settings/settings.spec.js +++ b/cypress/e2e/Settings/settings.spec.js @@ -17,7 +17,7 @@ import { checkActionAlertsModalContent, } from '../../support/util/common'; -describe('Manage Settings', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('Manage Settings', { failFast: { enabled: true } }, () => { const localeCode = 'en-US'; moment.locale(localeCode); @@ -44,10 +44,14 @@ describe('Manage Settings', { failFast: { enabled: true }, testIsolation: true } .should('contain', expectedIncidentDateFormat); }); - // 1 Day is the default, so reset to that after this test - ['3 Days', '1 Week', '2 Weeks', '1 Month', '3 Months', '180 Days', '1 Day'].forEach((tenor) => { + // 1 Day is the default + ['Today', '1 Day', '3 Days', '1 Week', '2 Weeks', '1 Month', '3 Months', '180 Days'].forEach((tenor) => { it(`Update default since date lookback to ${tenor}`, () => { - const [sinceDateNum, sinceDateTenor] = tenor.split(' '); + let [sinceDateNum, sinceDateTenor] = tenor.split(' '); + if (tenor === 'Today') { + sinceDateNum = '0'; + sinceDateTenor = 'Day'; + } const expectedDate = moment().subtract(Number(sinceDateNum), sinceDateTenor).format('L'); updateDefaultSinceDateLookback(tenor); updateUserLocale('English (United States)', 'Settings', 'Updated user profile settings'); diff --git a/cypress/e2e/app.spec.js b/cypress/e2e/app.spec.js index f9155033..6f641310 100644 --- a/cypress/e2e/app.spec.js +++ b/cypress/e2e/app.spec.js @@ -6,7 +6,7 @@ import { import packageConfig from '../../package.json'; -describe('Integration User Token', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('Integration User Token', { failFast: { enabled: true } }, () => { before(() => { expect(Cypress.env('PD_USER_TOKEN')).to.be.a('string'); cy.intercept('GET', 'https://api.pagerduty.com/users/me').as('getCurrentUser'); @@ -28,7 +28,7 @@ describe('Integration User Token', { failFast: { enabled: true }, testIsolation: }); }); -describe('PagerDuty Live', { failFast: { enabled: true }, testIsolation: true }, () => { +describe('PagerDuty Live', { failFast: { enabled: true } }, () => { beforeEach(() => { acceptDisclaimer(); waitForIncidentTable();