Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service name test #1462

Merged
merged 2 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ jobs:
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 40000
CYPRESS_PAGE_LOAD_TIMEOUT: 120000
CYPRESS_RETRIES: 3

- run: npm run test:integration:package
env:
CYPRESS_REQUEST_TIMEOUT: 20000
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 40000
CYPRESS_PAGE_LOAD_TIMEOUT: 120000
CYPRESS_RETRIES: 3
6 changes: 4 additions & 2 deletions cypress/integration/1-watch-files/watch-config.cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const backupAppConfig = path.join(Cypress.env('tempFolder'), 'temp-config.js')
const originalText = 'Service name goes here'
const newText = 'Cypress test'

const serverNameQuery = 'a.govuk-header__link.govuk-header__service-name, a.govuk-header__link--service-name'

describe('watch config file', () => {
describe(`service name in config file ${appConfig} should be changed and restored`, () => {
before(() => {
Expand All @@ -23,10 +25,10 @@ describe('watch config file', () => {
})

it('The service name should change to "cypress test"', () => {
cy.get('a.govuk-header__link--service-name').should('contains.text', originalText)
cy.get(serverNameQuery).should('contains.text', originalText)
cy.task('replaceTextInFile', { filename: appConfig, originalText, newText })
waitForApplication()
cy.get('a.govuk-header__link--service-name').should('contains.text', newText)
cy.get(serverNameQuery).should('contains.text', newText)
})
})
})
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const middleware = [
require('./lib/middleware/authentication/authentication.js')(),
require('./lib/middleware/extensions/extensions.js')
]
const config = require('./app/config.js')
const config = require(`${process.cwd()}/app/config.js`)
const prototypeAdminRoutes = require('./lib/prototype-admin-routes.js')
const packageJson = require('./package.json')
const routes = require(`${process.cwd()}/app/routes.js`)
Expand Down