Skip to content

Commit 4d19570

Browse files
committed
Test - Fix subsequent triggerAppEvent
1 parent 554db51 commit 4d19570

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
run: npx cypress install
2828
- name: Install dependecies
2929
run: pnpm install
30-
- name: Build Package
30+
- name: Build package
3131
run: pnpm build
32-
- name: Install Package
32+
- name: Install package
3333
run: pnpm install
34-
- name: Test with Cypress
34+
- name: Run tests
3535
uses: cypress-io/github-action@v5
3636
timeout-minutes: 5
3737
with:

tests/specs/callbacks.cy.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ describe('Callbacks', () => {
3434
it('onDestroyed callback is called', () => {
3535
cy.mountApp(App)
3636

37-
.get('body')
38-
.triggerAppEvent('display-loader')
39-
.triggerAppEvent('destroy-loader')
37+
cy.triggerAppEvent('display-loader')
4038

41-
cy.get('[data-cy-callback]').should('contain.text', destroyedText)
39+
cy.getRoot()
40+
.should('exist')
41+
.then(() => {
42+
cy.triggerAppEvent('destroy-loader')
43+
cy.get('[data-cy-callback]').should('contain.text', destroyedText)
44+
})
4245
})
4346
})

tests/specs/scoped-options.cy.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,27 @@ describe('Scoped Options', () => {
3939
it('Scoped options are applied to a specific loader and restored on destroy', () => {
4040
cy.mountApp(App)
4141

42-
.get('body')
43-
.triggerAppEvent('display-loader')
42+
cy.triggerAppEvent('display-loader')
4443

4544
cy.getRoot()
4645
.checkCssVars(customConf)
4746
.checkComputedStyles(customConf)
48-
49-
.get('[aria-live]')
50-
.should('contain.text', customConf.screenReaderMessage)
47+
.within(() => {
48+
cy.get('[aria-live]').should('contain.text', customConf.screenReaderMessage)
49+
})
5150

5251
cy.triggerAppEvent('destroy-loader')
5352

54-
cy.triggerAppEvent('display-new-loader')
55-
56-
cy.getRoot()
57-
.checkCssVars(DEF)
58-
.checkComputedStyles(DEF)
59-
60-
.get('[aria-live]')
61-
.should('contain.text', DEF.screenReaderMessage)
53+
cy.get('[data-cy-loader]')
54+
.should('not.exist')
55+
.then(() => {
56+
cy.triggerAppEvent('display-new-loader')
57+
cy.get('[data-cy-loader]')
58+
.checkCssVars(DEF)
59+
.checkComputedStyles(DEF)
60+
.within(() => {
61+
cy.get('[aria-live]').should('contain.text', DEF.screenReaderMessage)
62+
})
63+
})
6264
})
6365
})

0 commit comments

Comments
 (0)