Skip to content

Commit 0ddb797

Browse files
committed
[FIX] - all specs passing.
1 parent c3e3212 commit 0ddb797

38 files changed

Lines changed: 120 additions & 783 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ _This project uses npm ≥ 8 and Node ≥ 18 - however any project using this pa
195195
6. To add error/warning styles and messages to your features, `@extend` one of the placeholders and `@include contentMessage()` from `src/_base.scss`.
196196
7. Add tests to your features in cypress folder (edit the element file or create a new one if needed)
197197
8. Run tests: `npm run test:ui` or `npm run test` (headless)
198-
- You can also run tests for a specific tag/attribute by doing `npm run test -- --spec cypress/integration/{file-to-test}`
198+
- You can also run tests for a specific tag/attribute by doing `npm run test -- --spec cypress/e2e/{file-to-test}`
199199
9. Add the feature to the [features.md](./features.md) & [codes.md](./codes.md) with a new error or warning code
200200

201201
---

cypress.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const { defineConfig } = require('cypress')
22

33
module.exports = defineConfig({
4+
projectId: '8purx7',
5+
// defaultCommandTimeout: 4000,
6+
retries: { openMode: 2, runMode: 1 },
47
e2e: {
58
setupNodeEvents(on, config) {
69
// implement node event listeners here

cypress/e2e/accesskey_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("[accesskey]", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should show warning on elements with accesskey', () => {
77
cy.get("[accesskey]")

cypress/e2e/autoplay_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {
33
} from "../support/constants";
44

55
describe("[autoplay]", () => {
6-
before(() => {
7-
cy.visit("/test/index.html");
8-
});
6+
beforeEach(() => {
7+
cy.visit('/test/index.html')
8+
})
99

1010
it('should show warning outline on elements with autoplay', () => {
1111
cy.get("[autoplay]")

cypress/e2e/buttons_spec.cy.js

Lines changed: 49 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,49 @@
1-
import {
2-
ERROR_BORDER_COLOR
3-
} from "../support/constants";
4-
5-
describe("<button>", () => {
6-
before(() => {
7-
cy.visit("/test/index.html");
8-
});
9-
10-
it('should not have buttons with interactive content inside', () => {
11-
const noneElements = [
12-
"audio[controls]", "embed", "iframe", "img[usemap]", 'input:not([type="hidden"])',
13-
"object[usemap]", "select", "textarea", "video[controls]"
14-
];
15-
// removed "button" from afterElements because browser was correcting the issue
16-
const afterElements = ["details", "label"];
17-
const beforeElements = [];
18-
19-
noneElements.forEach(el => {
20-
cy.get(`button ${el}`)
21-
.each(element => {
22-
cy.get(element)
23-
.should('have.css', 'border-color', 'rgb(255, 0, 0)')
24-
});
25-
});
26-
27-
afterElements.forEach(el => {
28-
cy.get(`button ${el}`)
29-
.each(element => {
30-
if (element) {
31-
cy.get(element)
32-
.after('content')
33-
.should('eq', `ERROR (E0000): Ensure that <${el}> is not a child of <button>.`);
34-
}
35-
});
36-
});
37-
38-
beforeElements.forEach(el => {
39-
cy.get(`button ${el}`)
40-
.each(element => {
41-
if (element) {
42-
cy.get(element)
43-
.before('content')
44-
.should('eq', `ERROR: Ensure that <${el}> is not a child of <button> as it is an invalid HTML.`);
45-
}
46-
});
47-
})
48-
});
49-
50-
it('should not have empty buttons', () => {
51-
cy.get('button:not( [aria-label] ):not( [aria-labelledby] ):empty')
52-
.each(element => {
53-
cy.get(element)
54-
.after("content")
55-
.should('eq', "ERROR (E0001): Ensure that <button> has meaningful content or is labelled appropriately.")
56-
});
57-
});
58-
});
1+
import { ERROR_BORDER_COLOR } from '../support/constants'
2+
3+
describe('<button>', () => {
4+
before(() => {
5+
cy.visit('/test/index.html')
6+
})
7+
beforeEach(() => {
8+
cy.visit('/test/index.html')
9+
})
10+
11+
it('should not have buttons with interactive content inside', () => {
12+
cy.visit('/test/index.html')
13+
14+
const noneElements = ['audio[controls]', 'embed', 'iframe', 'img[usemap]', 'input:not([type="hidden"])', 'object[usemap]', 'select', 'textarea', 'video[controls]']
15+
// removed "button" from afterElements because browser was correcting the issue
16+
const afterElements = ['details', 'label']
17+
const beforeElements = []
18+
19+
noneElements.forEach((el) => {
20+
cy.get(`button ${el}`).each((element) => {
21+
cy.get(element).should('have.css', 'border-color', 'rgb(255, 0, 0)')
22+
})
23+
})
24+
25+
afterElements.forEach((el) => {
26+
cy.get(`button ${el}`).each((element) => {
27+
if (element) {
28+
cy.get(element).after('content').should('eq', `ERROR (E0000): Ensure that <${el}> is not a child of <button>.`)
29+
}
30+
})
31+
})
32+
33+
beforeElements.forEach((el) => {
34+
cy.get(`button ${el}`).each((element) => {
35+
if (element) {
36+
cy.get(element).before('content').should('eq', `ERROR: Ensure that <${el}> is not a child of <button> as it is an invalid HTML.`)
37+
}
38+
})
39+
})
40+
})
41+
42+
it('should not have empty buttons', () => {
43+
cy.visit('/test/index.html')
44+
45+
cy.get('button:not( [aria-label] ):not( [aria-labelledby] ):empty').each((element) => {
46+
cy.get(element).after('content').should('eq', 'ERROR (E0001): Ensure that <button> has meaningful content or is labelled appropriately.')
47+
})
48+
})
49+
})

cypress/e2e/dir_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("[dir]", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should show error on elements with wrong values for dir attribute', () => {
77
cy.get("[dir]:not([dir='rtl']):not([dir='ltr']):not([dir='auto'])")

cypress/e2e/handlers_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("[handlers]", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should show error if the iframe does not have a title', () => {
77
cy.get(`

cypress/e2e/head_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("<head>", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should not have an empty title', () => {
77
cy.get("head title:empty")

cypress/e2e/headings_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("<headings>", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should not have empty headings', () => {
77
cy.get("h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty")

cypress/e2e/html_spec.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("<html>", () => {
2-
before(() => {
3-
cy.visit("/test/index.html");
4-
});
2+
beforeEach(() => {
3+
cy.visit('/test/index.html')
4+
})
55

66
it('should show error if HTML does not have lang attribute', () => {
77
cy.get("html[lang]")

0 commit comments

Comments
 (0)