Skip to content

Commit f4db5ad

Browse files
committed
Add test files
1 parent b01015e commit f4db5ad

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

tests/e2e/fixtures/demo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

tests/e2e/integration/home-test.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import Vue from 'vue'
2+
import VueAxe from '../../../vue-axe'
3+
4+
const config = {
5+
rules: [
6+
{ id: 'heading-order', enabled: true },
7+
{ id: 'label-title-only', enabled: true },
8+
{ id: 'link-in-text-block', enabled: true },
9+
{ id: 'region', enabled: true },
10+
{ id: 'skip-link', enabled: true },
11+
{ id: 'help-same-as-label', enabled: true }
12+
]
13+
}
14+
15+
describe('Home-VueAxe', () => {
16+
beforeEach(() => {
17+
cy.visit('/')
18+
})
19+
20+
it('Should display the main headline', () => {
21+
cy.get('[data-va="main header"]').should('be.visible')
22+
})
23+
24+
it('should assert that page content is correct', () => {
25+
cy.get('[data-va="main header"]').should('contain', 'Welcome')
26+
})
27+
28+
it('should run axe in the context of the document', () => {
29+
cy.visit('/')
30+
.then(win => {
31+
console.log(win.console)
32+
cy.spy(win.console, 'group')
33+
cy.spy(win.console, 'groupCollapsed')
34+
cy.spy(win.console, 'groupEnd')
35+
36+
VueAxe(Vue, config)
37+
.then(() => {
38+
expect(win.console.group).to.be.calledWith('%cNew aXe issues', 'padding:6px;font-size:20px;background-color:#8ba6c5;color:#fff;font-weight:bold;')
39+
expect(win.console.groupCollapsed).to.be.calledWith('%c%s: %c%s %s')
40+
expect(win.console.groupEnd).to.be.called
41+
})
42+
})
43+
})
44+
})

0 commit comments

Comments
 (0)