diff --git a/cypress/e2e/app.spec.js b/cypress/e2e/app.spec.js index b2903886..5767cf3d 100644 --- a/cypress/e2e/app.spec.js +++ b/cypress/e2e/app.spec.js @@ -1,7 +1,7 @@ import moment from 'moment/min/moment-with-locales'; import { - acceptDisclaimer, waitForIncidentTable, pd, + acceptDisclaimer, waitForIncidentTable, clearLocalCache, pd, } from '../support/util/common'; import packageConfig from '../../package.json'; @@ -41,6 +41,11 @@ describe('PagerDuty Live', { failFast: { enabled: true } }, () => { } }); + afterEach(() => { + // Reset hover state + cy.get('body').realHover({ position: 'topLeft' }).click(); + }); + it('Renders the main application page', () => { cy.get('#navbar-ctr').contains('Live Incidents Console'); }); @@ -62,7 +67,7 @@ describe('PagerDuty Live', { failFast: { enabled: true } }, () => { cy.intercept('https://api.pagerduty.com/abilities*', { abilities: ['teams', 'read_only_users', 'service_support_hours', 'urgencies'], }).as('getAbilities'); - cy.visit('/'); + clearLocalCache(); acceptDisclaimer(); cy.wait('@getAbilities', { timeout: 30000 }); diff --git a/cypress/support/util/common.js b/cypress/support/util/common.js index addcb763..2d259c38 100644 --- a/cypress/support/util/common.js +++ b/cypress/support/util/common.js @@ -10,9 +10,6 @@ export const pd = api({ token: Cypress.env('PD_USER_TOKEN') }); Cypress Helpers */ export const acceptDisclaimer = () => { - cy.clearLocalStorage(); - cy.clearAllSessionStorage(); - cy.clearCookies(); cy.visit('/'); cy.get('.modal-title', { timeout: 30000 }).contains('Disclaimer & License'); cy.get('#disclaimer-agree-checkbox').click({ force: true }); @@ -282,8 +279,7 @@ export const updateDefaultSinceDateLookback = (tenor = '1 Day') => { cy.get('#save-settings-button').click(); checkActionAlertsModalContent('Updated user profile settings'); - cy.reload(); - acceptDisclaimer(); + cy.visit('/'); }; export const updateAutoRefreshInterval = (autoRefreshInterval = 5) => { @@ -342,6 +338,11 @@ export const updateDarkMode = () => { cy.get('[aria-label="Toggle Dark Mode"]').click(); }; +export const clearLocalCache = () => { + cy.get('.settings-panel-dropdown').click(); + cy.get('.dropdown-item').contains('Clear Local Cache').click(); +}; + export const priorityNames = ['--', 'P5', 'P4', 'P3', 'P2', 'P1']; /*