Wait...
So I have to test the front end too?
Wait...
So I have to test the front end too?
Wait...
So I have to test the front end too?
What about the front end?
The front end matters too
Linting
Automated checking for programmatic and stylistic errors
npm install eslint
npm install stylelint
Accessibility Testing
Web Content Accessibility Guidelines
WCAG
npm install pa11y
"code": "WCAG2AA.Principle1.Guideline1_1.1_1_1.H37",
"type": "error",
"typeCode": 1,
"message": "Img element missing an alt attribute. Use the alt attribute to specify a short text alternative.",
"context": "",
"selector": "html > body > main > article > article:nth-child(1) > img",
"runner": "htmlcs",
"runnerExtras": {}
"code": "WCAG2AA.Principle1.Guideline1_1.1_1_1.H37",
"message": "Img element missing an alt attribute. Use the alt attribute to specify a short text alternative.",
"context": "",
"selector": "html > body > main > article > article:nth-child(1) > img",
"context": "",
"selector": "html > body > main > article > article:nth-child(1) > img"
"code": "wcag2aa.principle1.guideline1_1.1_1_1.h37",
"message": "img element missing an alt attribute. use the alt attribute to specify a short text alternative.",
1_1.1_1_1.h37
pa11y('http://my-testing-blog.local', {
actions: [
'click element #tab-1',
'wait for element #tab-1-content to be visible',
],
viewport: {
width: 320,
height: 480,
ismobile: true
},
standard: 'wcag2aaa',
headers: {
'content-type': 'application/json'
},
method: 'post',
postdata: '{"foo": "bar", "bar": "baz"}'
});
await Promise.all([
pa11y(`http://my-testing-blog.local`, options),
])
await Promise.all([
pa11y(`http://my-testing-blog.local`, options),
pa11y(`http://my-testing-blog.local/blog-post`, options)
])
Visual Regression Testing
Can yield false results
End to end testing
npm install cypress
cypress open
describe(`Blog Homepage`, () => {
before(() => {
cy.visit(`http://my-testing-blog.local`);
});
it(`Contains "My Testing Blog" in the title`, () => {
cy.title().should(`contain`, `My Testing Blog`);
});
});
// Name of Test
describe('Blog Homepage', () => {
// Runs at the start of this test
before(() => {
// Visit our website in the Cypress browser
cy.visit('http://my-testing-blog.local')
})
// Assertion - title should contain specific text
it('contains "My Testing Blog" in the title', () => {
cy.title().should('contain', 'My Testing Blog')
})
})
expect(name).to.not.equal('Jane')
describe(`Blog Homepage`, () => {
before(() => {
cy.visit(`http://my-testing-blog.local`);
});
it(`Contains "My Testing Blog" in the title`, () => {
cy.title().should(`contain`, `My Testing Blog`);
});
});
🎉
kapers.dev/build-stuff-2020
Thank You 👏