From 7926c3975657c2fd18be4ba479d7cc02e9badf4d Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 6 Feb 2024 13:33:54 -0500 Subject: [PATCH] chore: Add check to ensure input has record text before trying to copy to fix flaky test (#28877) * chore: Add check to ensure input has record text before trying to copy the text * Add another assertion for the component copy * revert function change --- packages/app/cypress/e2e/runs.cy.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/app/cypress/e2e/runs.cy.ts b/packages/app/cypress/e2e/runs.cy.ts index 309f12aa83d2..e06ecde05ef7 100644 --- a/packages/app/cypress/e2e/runs.cy.ts +++ b/packages/app/cypress/e2e/runs.cy.ts @@ -644,6 +644,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { o.sinon.stub(ctx.config.electronApi, 'copyTextToClipboard') }) + cy.get('[data-cy="terminal-prompt-input').should('have.value', 'npx cypress run --component --record --key 2aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa') cy.get('[data-cy="copy-button"]').click() cy.contains('Copied!') cy.withRetryableCtx((ctx) => { @@ -653,10 +654,12 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { it('displays a copy button and copies correct command in E2E', () => { scaffoldTestingTypeAndVisitRunsPage('e2e') + cy.withCtx(async (ctx, o) => { o.sinon.stub(ctx.config.electronApi, 'copyTextToClipboard') }) + cy.get('[data-cy="terminal-prompt-input').should('have.value', 'npx cypress run --record --key 2aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa') cy.get('[data-cy="copy-button"]').click() cy.contains('Copied!') cy.withRetryableCtx((ctx) => {