-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EYQB-650: New smoke tests and github workflow changes (#369)
* EYQB-650: New smoke tests and github workflow changes * Updated action name
- Loading branch information
Showing
8 changed files
with
2,131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run smoke tests | ||
description: Run smoke tests using Cypress | ||
|
||
inputs: | ||
webapp_name: | ||
required: true | ||
type: string | ||
slot_name: | ||
required: true | ||
type: string | ||
auth_secret: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Run Smoke Tests | ||
uses: cypress-io/github-action@v6 | ||
if: success() || failure() | ||
with: | ||
env: auth_secret="${{ inputs.auth_secret }}" | ||
working-directory: ./tests/Dfe.EarlyYearsQualification.SmokeTests/ | ||
browser: chrome | ||
config: baseUrl="https://${{ inputs.webapp_name }}-${{ inputs.slot_name }}.azurewebsites.net" | ||
|
||
- name: Store screenshots on test failure | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: ./tests/Dfe.EarlyYearsQualification.SmokeTests/cypress/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/Dfe.EarlyYearsQualification.SmokeTests/cypress.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
env: { | ||
auth_secret: 'CX' // dummy value: pass in using Cypress command line --env auth_secret=an-acceptable-secret-value | ||
}, | ||
e2e: { | ||
baseUrl: "http://127.0.0.1:5025/", | ||
setupNodeEvents(on, config) { | ||
on('task', { | ||
log(message) { | ||
console.log(message) | ||
return null | ||
} | ||
}) | ||
// implement node event listeners here | ||
} | ||
}, | ||
}); |
52 changes: 52 additions & 0 deletions
52
tests/Dfe.EarlyYearsQualification.SmokeTests/cypress/e2e/smoke-test-spec.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
describe('A spec used to smoke test the environment once a deployment has happened', () => { | ||
beforeEach(() => { | ||
cy.setCookie('auth-secret', Cypress.env('auth_secret')); | ||
cy.visit("/"); | ||
cy.get('.govuk-button--start').should('exist'); | ||
}) | ||
|
||
it("should return search results", () => { | ||
// home page | ||
cy.get('.govuk-button--start').click(); | ||
|
||
// where-was-the-qualification-awarded page | ||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded'); | ||
}) | ||
|
||
cy.get('#england').click(); | ||
cy.get('button[id="question-submit"]').click(); | ||
|
||
// when-was-the-qualification-started page | ||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started'); | ||
}) | ||
|
||
cy.get('#date-started-month').type("7"); | ||
cy.get('#date-started-year').type("2015"); | ||
cy.get('button[id="question-submit"]').click(); | ||
|
||
// what-level-is-the-qualification page | ||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification'); | ||
}) | ||
cy.get('#0').click(); // Select not sure | ||
cy.get('button[id="question-submit"]').click(); | ||
|
||
// what-is-the-awarding-organisation page | ||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/questions/what-is-the-awarding-organisation'); | ||
}) | ||
|
||
cy.get('#awarding-organisation-not-in-list').click(); // Tick the not on the list | ||
cy.get('button[id="question-submit"]').click(); | ||
|
||
// qualifications page | ||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/qualifications'); | ||
}) | ||
|
||
// If this shows then no qualifications are getting returned indicating possible issue | ||
cy.get('#no-result-content').should('not.exist'); | ||
}) | ||
}) |
25 changes: 25 additions & 0 deletions
25
tests/Dfe.EarlyYearsQualification.SmokeTests/cypress/support/commands.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
20 changes: 20 additions & 0 deletions
20
tests/Dfe.EarlyYearsQualification.SmokeTests/cypress/support/e2e.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.