Skip to content

Commit edba8e4

Browse files
chore: fix selectorplayground ct flaky test (#31595)
1 parent 84e1859 commit edba8e4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/app/src/runner/selector-playground/SelectorPlayground.cy.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ describe('SelectorPlayground', () => {
8585
cy.get('[data-cy="playground-num-elements"]').contains('Invalid')
8686
})
8787

88-
it('focuses and copies selector text', () => {
88+
it('focuses playground selector', () => {
89+
mountSelectorPlayground()
90+
cy.get('[data-cy="playground-selector"]').as('copy').clear().type('.foo-bar')
91+
92+
cy.get('@copy').click()
93+
cy.get('@copy').should('be.focused')
94+
})
95+
96+
it('copies selector text', () => {
8997
const copyStub = cy.stub()
9098

9199
cy.stubMutationResolver(Clipboard_CopyToClipboardDocument, (defineResult, { text }) => {
@@ -100,18 +108,13 @@ describe('SelectorPlayground', () => {
100108

101109
cy.spy(autIframe, 'toggleSelectorHighlight')
102110

103-
cy.get('[data-cy="playground-selector"]').as('copy').clear().type('.foo-bar')
104-
105-
cy.get('@copy').click()
106-
cy.get('@copy').should('be.focused')
107-
108111
cy.get('[data-cy="playground-copy"]').trigger('mouseenter')
109112
cy.get('[data-cy="selector-playground-tooltip"]').should('be.visible').contains('Copy to clipboard')
110113

111114
cy.get('[data-cy="playground-copy"]').click()
112115
cy.get('[data-cy="selector-playground-tooltip"]').should('be.visible').contains('Copied!')
113116

114-
cy.wrap(copyStub).should('have.been.calledWith', 'cy.get(\'.foo-bar\')')
117+
cy.wrap(copyStub).should('have.been.calledWith', 'cy.get(\'body\')')
115118
})
116119

117120
it('prints elements when selected elements found', () => {

0 commit comments

Comments
 (0)