From 68eae3f57fc3e03e9fb22c1ebdc6cc60238a75d6 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Mon, 28 Apr 2025 10:41:34 -0400 Subject: [PATCH] chore: fix selectorplayground ct flaky test --- .../SelectorPlayground.cy.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/app/src/runner/selector-playground/SelectorPlayground.cy.tsx b/packages/app/src/runner/selector-playground/SelectorPlayground.cy.tsx index a4b0a27d6ff1..fe0853fa2db3 100644 --- a/packages/app/src/runner/selector-playground/SelectorPlayground.cy.tsx +++ b/packages/app/src/runner/selector-playground/SelectorPlayground.cy.tsx @@ -85,7 +85,15 @@ describe('SelectorPlayground', () => { cy.get('[data-cy="playground-num-elements"]').contains('Invalid') }) - it('focuses and copies selector text', () => { + it('focuses playground selector', () => { + mountSelectorPlayground() + cy.get('[data-cy="playground-selector"]').as('copy').clear().type('.foo-bar') + + cy.get('@copy').click() + cy.get('@copy').should('be.focused') + }) + + it('copies selector text', () => { const copyStub = cy.stub() cy.stubMutationResolver(Clipboard_CopyToClipboardDocument, (defineResult, { text }) => { @@ -100,18 +108,13 @@ describe('SelectorPlayground', () => { cy.spy(autIframe, 'toggleSelectorHighlight') - cy.get('[data-cy="playground-selector"]').as('copy').clear().type('.foo-bar') - - cy.get('@copy').click() - cy.get('@copy').should('be.focused') - cy.get('[data-cy="playground-copy"]').trigger('mouseenter') cy.get('[data-cy="selector-playground-tooltip"]').should('be.visible').contains('Copy to clipboard') cy.get('[data-cy="playground-copy"]').click() cy.get('[data-cy="selector-playground-tooltip"]').should('be.visible').contains('Copied!') - cy.wrap(copyStub).should('have.been.calledWith', 'cy.get(\'.foo-bar\')') + cy.wrap(copyStub).should('have.been.calledWith', 'cy.get(\'body\')') }) it('prints elements when selected elements found', () => {