From 68a4016d6b096f1b1e1bd79f038be4be7eeff4c3 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Mon, 21 Dec 2020 21:35:31 +0630 Subject: [PATCH] test: fix percy flake for 'loading tests' display (#14254) Co-authored-by: Chris Breiding --- packages/reporter/cypress/integration/commands_spec.ts | 7 ------- packages/reporter/cypress/integration/runnables_spec.ts | 2 ++ packages/reporter/cypress/support/index.ts | 6 +++++- packages/runner/cypress/integration/retries.ui.spec.js | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/reporter/cypress/integration/commands_spec.ts b/packages/reporter/cypress/integration/commands_spec.ts index 645f7a1943..7347929f3f 100644 --- a/packages/reporter/cypress/integration/commands_spec.ts +++ b/packages/reporter/cypress/integration/commands_spec.ts @@ -48,13 +48,6 @@ describe('commands', () => { it('displays all the commands', () => { cy.get('.command').should('have.length', 9) - // ensure progress bar is no longer visible - // for snapshot - cy.contains('#in-progress') - .closest('.command') - .find('.command-progress span') - .should('not.be.visible') - cy.percySnapshot() }) diff --git a/packages/reporter/cypress/integration/runnables_spec.ts b/packages/reporter/cypress/integration/runnables_spec.ts index 53534ac614..aeab033ff1 100644 --- a/packages/reporter/cypress/integration/runnables_spec.ts +++ b/packages/reporter/cypress/integration/runnables_spec.ts @@ -44,6 +44,8 @@ describe('runnables', () => { it('displays loader when runnables have not yet loaded', () => { render() cy.contains('Your tests are loading...').should('be.visible') + // ensure the page is loaded before taking snapshot + cy.get('.focus-tests-text').should('be.visible') cy.percySnapshot() }) diff --git a/packages/reporter/cypress/support/index.ts b/packages/reporter/cypress/support/index.ts index 2fd04ebdcd..61df20272c 100644 --- a/packages/reporter/cypress/support/index.ts +++ b/packages/reporter/cypress/support/index.ts @@ -1,4 +1,8 @@ // @ts-ignore import installCustomPercyCommand from '@packages/ui-components/cypress/support/customPercyCommand' -installCustomPercyCommand() +installCustomPercyCommand({ + elementOverrides: { + '.command-progress': true, + }, +}) diff --git a/packages/runner/cypress/integration/retries.ui.spec.js b/packages/runner/cypress/integration/retries.ui.spec.js index 001a0c5204..836fd980ac 100644 --- a/packages/runner/cypress/integration/retries.ui.spec.js +++ b/packages/runner/cypress/integration/retries.ui.spec.js @@ -283,8 +283,8 @@ describe('runner/cypress retries.ui.spec', { viewportWidth: 600, viewportHeight: } }, { config: { retries: 1 } }) .then(shouldHaveTestResults(0, 1, 0)) + // ensure the page is loaded before taking snapshot cy.contains('skips this') - cy.percySnapshot() }) })