Skip to content

Commit

Permalink
test: Add HTML Validation Test.
Browse files Browse the repository at this point in the history
  • Loading branch information
danimalweb committed Jan 4, 2024
1 parent 92b4395 commit 7634bae
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'cypress';
import * as dotenv from 'dotenv';
import setupPlugins from './cypress/plugins/index';
import htmlvalidate from 'cypress-html-validate/plugin';

dotenv.config();

Expand All @@ -12,6 +13,8 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
htmlvalidate.install(on);

setupPlugins(on, config);
},
baseUrl: process.env.VITE_ASSET_URL,
Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/htmlValidate.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('HTML Validation Tests', () => {
it('should be valid', () => {
cy.task('sitemapLocations').then((pages) => {
pages.forEach((page) => {
cy.visit(page);
cy.htmlvalidate({
rules: {
'require-sri': 'off',
'element-permitted-content': 'off',
},
});
});
});
});
});
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import './vue';
import './assertions';
// import './baseUrl';
import './checkElementExists';
import 'cypress-html-validate/commands';
165 changes: 165 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"axe-html-reporter": "^2.2.3",
"cypress": "^13.6.2",
"cypress-axe": "^1.5.0",
"cypress-html-validate": "^6.1.0",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
Expand Down

0 comments on commit 7634bae

Please sign in to comment.