Skip to content

Commit

Permalink
avoid unnamed snapshots in same test
Browse files Browse the repository at this point in the history
  • Loading branch information
marktnoonan committed Feb 1, 2022
1 parent 9a5d20f commit 4135fe1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/app/src/components/FileMatch.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ describe('<FileMatch />', { viewportWidth: 600, viewportHeight: 300 }, () => {
describe('expanding/collapsing', () => {
it('can be expanded and collapsed by the extension button', () => {
cy.get(extensionInputSelector).should('not.exist')
cy.percySnapshot()
cy.percySnapshot('before expand')
cy.get(fileMatchButtonSelector).click()
.get(extensionInputSelector).should('be.visible')

cy.percySnapshot()
cy.percySnapshot('after expand')
cy.get(fileMatchButtonSelector).click()
.get(extensionInputSelector).should('not.exist')
})
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/runner/SnapshotToggle.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ describe('<SnapshotToggle/>', () => {

cy.mount(() => (<SnapshotToggle class="m-20" messages={messages} />))

cy.percySnapshot()
cy.percySnapshot('before')
.get('body')
.findByText('2')
.click()
.parent()
.findByText('1')
.click()
.percySnapshot()
.percySnapshot('after')
})

it('renders longer text', () => {
const messages = [{ text: 'Request', id: '1' }, { text: 'Response', id: '2' }]

cy.mount(() => (<SnapshotToggle class="m-20" messages={messages} />))

cy.percySnapshot()
cy.percySnapshot('before')
.get('body')
.findByText('Request')
.click()
.parent()
.findByText('Response')
.click()
.percySnapshot()
.percySnapshot('after')
})

it('emits a select event with the active message', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/settings/SettingsCard.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('<SettingsCard />', () => {
cy.get(contentSelector).should('not.exist')
cy.findByText(title).click()
cy.get(contentSelector).should('be.visible')
cy.percySnapshot()
cy.percySnapshot('expanded state')
cy.findByText(title).click()
.get(contentSelector).should('not.exist')

cy.percySnapshot()
cy.percySnapshot('collapsed state')

// expected aria and keyboard behavior with space and enter keys:
cy.get(collapsibleSelector).should('be.focused')
Expand Down
4 changes: 1 addition & 3 deletions packages/app/src/specs/SpecsList.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ describe('<SpecsList />', { keystrokeDelay: 0 }, () => {

cy.mountFragment(Specs_SpecsListFragmentDoc, {
onResult: (ctx) => {
if (!specs.length) {
specs = ctx.currentProject?.specs || []
}
specs = ctx.currentProject?.specs || []

return ctx
},
Expand Down

0 comments on commit 4135fe1

Please sign in to comment.