Skip to content

Commit

Permalink
Moved the Cypress folder into the same directory as other tests (test…
Browse files Browse the repository at this point in the history
…s). All template tests were moved under a new directory called template-tests, while the e2e directory was left for e2e tests. Additionally, accessibility tests now have their own directory at the same level as other test directories. Configuration changes were made because changing the directory structure affected the functionality of Cypress Axe
  • Loading branch information
miguelvaara committed Aug 30, 2023
1 parent c444458 commit f5827ad
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 19 deletions.
11 changes: 9 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { defineConfig } = require("cypress")

module.exports = defineConfig({
projectRoot: "tests",
e2e: {
// You also can run like this: npx cypress run --config "baseUrl=http://localhost/skosmos"
// You also can run like this: npx cypress run --config "baseUrl=http://localhost/Skosmos"
baseUrl: 'http://localhost/Skosmos',
setupNodeEvents(on, config) {
on('task', {
Expand All @@ -16,5 +17,11 @@ module.exports = defineConfig({
}
})
},
},
supportFile: false,
specPattern: [
'tests/cypress/accessibility-tests/**/*.cy.js',
'tests/cypress/template-tests/**/*.cy.js',
'tests/cypress/e2e/**/*.cy.js'
]
}
})
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"scripts": {
"test-accessibility-gui-all": "npx cypress open",
"test-accessibility-cli-all": "npx cypress run --env cli=true --spec 'cypress/e2e/accessibility-tests/*'",
"test-accessibility-cli-about": "npx cypress run --env cli=true --spec 'cypress/e2e/accessibility-tests/axe-about.cy.js'",
"test-accessibility-cli-vocab": "npx cypress run --env cli=true --spec 'cypress/e2e/accessibility-tests/axe-vocab.cy.js'",
"test-accessibility-cli-feedback": "npx cypress run --env cli=true --spec 'cypress/e2e/accessibility-tests/axe-feedback.cy.js'",
"test-accessibility-cli-landing": "npx cypress run --env cli=true --spec 'cypress/e2e/accessibility-tests/axe-landing.cy.js'"
"test-accessibility-cli-all": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/*'",
"test-accessibility-cli-about": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-about.cy.js'",
"test-accessibility-cli-concept": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-concept.cy.js'",
"test-accessibility-cli-feedback": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-feedback.cy.js'",
"test-accessibility-cli-global-search": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-global-search.cy.js'",
"test-accessibility-cli-landing": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-landing.cy.js'",
"test-accessibility-cli-vocab": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-vocab.cy.js'",
"test-accessibility-cli-vocab-home": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-vocab-home.cy.js'",
"test-accessibility-cli-vocab-search": "npx cypress run --env cli=true --spec 'tests/cypress/accessibility-tests/axe-vocab-search.cy.js'"
},
"dependencies": {
"bootstrap": "^5.2.3",
"vue": "^3.2.47"
},
"devDependencies": {
"axe-core": "^4.7.1",
"cypress": "^12.10.0",
"cypress": "^12.17.4",
"cypress-axe": "^1.4.0",
"standard": "^17.0.0"
}
Expand Down
9 changes: 9 additions & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { accessibilityTestRunner } from '../../support/accessibility.js'
import { accessibilityTestRunner } from '../support/accessibility.js'
import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the about page', () => {
describe('Check accessibility of the about page', () => {
before(() => {
cy.visit('/fi/about')
cy.injectAxe()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// When you start creating tests, remove the following comment(s).
// import { accessibilityTestRunner } from '../support/accessibility.js'
// import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the concept page', () => {
it('no-op test', () => {})

// When you start creating tests, remove the following comment(s).
// accessibilityTestRunner()
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { accessibilityTestRunner } from '../../support/accessibility.js'
import { accessibilityTestRunner } from '../support/accessibility.js'
import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the feedback page', () => {
describe('Check accessibility of the feedback page', () => {
before(() => {
cy.visit('/fi/feedback')
cy.injectAxe()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// import { accessibilityTestRunner } from '../support/accessibility.js'
// import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the global search page', () => {
it('no-op test', () => {})

// When you start creating tests, remove the following comment(s).
// accessibilityTestRunner()
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { accessibilityTestRunner } from '../../support/accessibility.js'

import { accessibilityTestRunner } from '../support/accessibility.js'
import 'cypress-axe';
/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the landing page', () => {
describe('Check accessibility of the landing page', () => {
before(() => {
cy.visit('/')
cy.injectAxe()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { accessibilityTestRunner } from '../../support/accessibility.js'
import { accessibilityTestRunner } from '../support/accessibility.js'
import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the vocab-home page', () => {
describe('Check accessibility of the vocab-home page', () => {
before(() => {
cy.visit('/agrovoc/fi/')
cy.injectAxe()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// When you start creating tests, remove the following comment(s).
// import { accessibilityTestRunner } from '../support/accessibility.js'
// import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the vocabulary search page', () => {
it('no-op test', () => {})

// When you start creating tests, remove the following comment(s).
// accessibilityTestRunner()
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { accessibilityTestRunner } from '../../support/accessibility.js'
import { accessibilityTestRunner } from '../support/accessibility.js'
import 'cypress-axe';

/* If you want the test to be skipped, add a skip command after the describe part:
- test enabled: describe('Check accessibility of ...
- test to be skipped: describe.skip('Check accessibility of ... */
describe.skip('Check accessibility of the vocab page', () => {
describe('Check accessibility of the vocab page', () => {
before(() => {
cy.visit('/juho/fi')
cy.injectAxe()
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f5827ad

Please sign in to comment.