-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpass-custom.cy.js
37 lines (27 loc) · 1009 Bytes
/
pass-custom.cy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Custom accessibility tests.
*/
const { describe, it, expect, cy } = globalThis;
describe('Pass - Custom', () => {
it('should have decorative images with empty ALT text', () => {
cy.visit('/pass.html');
cy.get('.decorative').should('have.length', 1);
cy.get('.decorative').then(els => [...els].forEach(el => expect(el.alt).to.be.empty));
// cy.task('log', { cyRoot: cy.root().constructor.name });
});
it('should have a page title ending in "ACME Corp"', () => {
cy.visit('/pass.html');
cy.get('head > title').should('include.text', ' | ACME Corp');
cy.get('head > title')
.invoke('text')
.should('match', /[\w ]+ \| ACME Corp$/);
});
/* Fictional "ACME Corp" website is available in English and Simplified Chinese.
*/
it('should have a "lang" attribute matching the specified pattern, (en|zh-Hans)', () => {
cy.visit('/pass.html');
cy.get('html')
.should('have.attr', 'lang')
.and('match', /^(en|zh-Hans)/);
});
});