Skip to content

Commit 96a3d72

Browse files
committed
Fix e2e tests
1 parent 86f6aec commit 96a3d72

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

cypress.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
"integrationFolder": "tests/e2e/integration",
66
"fileServerFolder": "demo",
77
"pluginsFile": false,
8-
"supportFile": false,
9-
"videoRecording": false
8+
"supportFile": false
109
}

example/src/pages/About.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
<!-- data-va is used for internal testing, it is not required -->
55
<button
66
type="button"
7-
data-va="toasted"
7+
data-va="handler-error-button"
88
@click="notify"
99
>
1010
show error
1111
</button>
12-
<div class="msg-error">
12+
<div
13+
class="msg-error"
14+
data-va="msg-error"
15+
>
1316
{{ errorMessage }}
1417
</div>
1518
</div>

tests/e2e/integration/vue-announcer.test.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe('Announcer test', () => {
2-
beforeEach(() => {
2+
before(() => {
33
cy.visit('/')
44
})
55

@@ -25,18 +25,15 @@ describe('Announcer test', () => {
2525
cy.get('[data-va="announcer"]').should('contain', 'has loaded')
2626
})
2727

28-
it('Should be equal toasted message with the announced', () => {
28+
it('Should be equal error message with the announced', () => {
2929
cy.get('a[href="/about"]').click()
30-
cy.get('[data-va="toasted"]').click()
30+
cy.get('[data-va="handler-error-button"]').click()
31+
cy.get('[data-va="msg-error"]').should('not.be.empty')
3132

32-
cy.get('.toasted-container')
33-
.find('.toasted')
34-
.invoke('text')
35-
.then(text1 => {
36-
cy.get('[data-va="announcer"]').invoke('text').should(text2 => {
37-
console.log(text1, text2)
38-
expect(text1).to.eq(text2)
39-
})
33+
cy.get('[data-va="msg-error"]')
34+
.then(el => {
35+
cy.get('[data-va="announcer"]').should('contain', el.text().trim())
36+
cy.get('[data-va="announcer"]').should('have.attr', 'aria-live', 'assertive')
4037
})
4138
})
4239
})

0 commit comments

Comments
 (0)