Skip to content

Commit

Permalink
Merge c1156a1 into 9b12bf3
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored May 9, 2024
2 parents 9b12bf3 + c1156a1 commit 947624b
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ui_test_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ on:
github_access_token:
description: 'Github Token'
required: true
test_onelogin_basic_auth:
description: 'Test OneLogin basic auth'
required: false
test_onelogin_totp_key:
description: 'Test OneLogin totp key'
required: false
test_onelogin_password:
description: 'Test OneLogin password'
required: false

defaults:
run:
Expand Down Expand Up @@ -120,6 +129,9 @@ jobs:
env:
CYPRESS_baseUrl: ${{ inputs.base_url }}
CYPRESS_RECORD_KEY: ${{ secrets.cypress_record_key }}
CYPRESS_TEST_ONELOGIN_BASIC_AUTH: ${{ secrets.test_onelogin_basic_auth }}
CYPRESS_TEST_ONELOGIN_TOTP_KEY: ${{ secrets.test_onelogin_totp_key }}
CYPRESS_TEST_ONELOGIN_PASSWORD: ${{ secrets.test_onelogin_password }}
GITHUB_TOKEN: ${{ secrets.github_access_token }}
run:
yarn run cypress:parallel-with-specs --spec ${{ inputs.specs }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/workflow_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ jobs:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
cypress_record_key: ${{ secrets.CYPRESS_RECORD_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}
test_onelogin_basic_auth: ${{ secrets.TEST_ONELOGIN_BASIC_AUTH }}
test_onelogin_totp_key: ${{ secrets.TEST_ONELOGIN_TOTP_KEY }}
test_onelogin_password: ${{ secrets.TEST_ONELOGIN_PASSWORD }}

always_remove_ingress:
name: Remove CI ingress from environment
Expand Down
57 changes: 44 additions & 13 deletions cypress/smoke/smoke.cy.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
const { TOTP } = require("totp-generator");

describe('Smoke tests', () => {
describe('external dependencies', () => {
describe('UID service', () => {
it('request signing and base URL are configured correctly', () => {
cy.request('/health-check/dependency').should((response) => {
expect(response.status).not.to.eq(403)
})
})
describe('external dependencies', () => {
describe('UID service', () => {
it('request signing and base URL are configured correctly', () => {
cy.request('/health-check/dependency').should((response) => {
expect(response.status).not.to.eq(403)
})
})
})
})

describe('app', () => {
it('is available', () => {
cy.visit('/')
describe('app', () => {
it('is available', () => {
cy.visit('/')

cy.get('h1').should('contain', 'Make and register a lasting power of attorney (LPA)');
cy.contains('a', 'Start');
})
cy.get('h1').should('contain', 'Make and register a lasting power of attorney (LPA)');

if (Cypress.config().baseUrl.includes('1221mlpab18')) {
cy.intercept('https://signin.integration.account.gov.uk/**', (req) => {
req.headers['Authorization'] = 'Basic ' + btoa(Cypress.env('TEST_ONELOGIN_BASIC_AUTH'));
});

cy.contains('a', 'Start').click({ timeout: 40000 });

const { otp } = TOTP.generate(Cypress.env('TEST_ONELOGIN_TOTP_KEY'));

cy.origin('https://signin.integration.account.gov.uk', { args: { token: otp } }, ({ token }) => {
cy.url().should('contain', '/sign-in-or-create', { timeout: 30000 });

cy.contains('Sign in').click();
cy.get('[type=email]').type('[email protected]');
cy.get('form').submit();
cy.get('[type=password]').type(Cypress.env('TEST_ONELOGIN_PASSWORD'));
cy.get('form').submit();

cy.get('[name=code]').type(token);
cy.contains('button', 'Continue').click();
});

cy.origin('https://preproduction.app.modernising.opg.service.justice.gov.uk', () => {
cy.url().should('contain', '/dashboard');
cy.contains('Manage your LPAs');
});
} else {
cy.contains('a', 'Start');
}
})
})
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"esbuild": "^0.20.0",
"govuk-frontend": "5.3.1",
"jquery": "^3.6.1",
"sass": "^1.56.1"
"sass": "^1.56.1",
"totp-generator": "^1.0.0"
},
"devDependencies": {
"axe-core": "^4.6",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,11 @@ jsprim@^2.0.2:
json-schema "0.4.0"
verror "1.10.0"

jssha@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jssha/-/jssha-3.3.1.tgz#c5b7fc7fb9aa745461923b87df0e247dd59c7ea8"
integrity sha512-VCMZj12FCFMQYcFLPRm/0lOBbLi8uM2BhXPTqw3U4YAfs4AZfiApOoBLoN8cQE60Z50m1MYMTQVCfgF/KaCVhQ==

lazy-ass@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513"
Expand Down Expand Up @@ -2117,6 +2122,13 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

totp-generator@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/totp-generator/-/totp-generator-1.0.0.tgz#00a3532dbece7a08950a6318c1317bff3b609510"
integrity sha512-Iu/1Lk60/MH8FE+5cDWPiGbwKK1hxzSq+KT9oSqhZ1BEczGIKGcN50bP0WMLiIZKRg7t29iWLxw6f81TICQdoA==
dependencies:
jssha "^3.3.1"

tough-cookie@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf"
Expand Down

0 comments on commit 947624b

Please sign in to comment.