-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1988 from alphagov/auto-restart-when-settings-cre…
…ated-and-removed Auto restart when settings created and removed
- Loading branch information
Showing
3 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
cypress/e2e/dev/1-watch-files/watch-settings-styles.cypress.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,50 @@ | ||
// core dependencies | ||
const path = require('path') | ||
|
||
// local dependencies | ||
const { waitForApplication, createFile, deleteFile, replaceInFile } = require('../../utils') | ||
|
||
const appStylesPath = path.join('app', 'assets', 'sass') | ||
const appStylesFolder = path.join(Cypress.env('projectFolder'), appStylesPath) | ||
|
||
const settingsStyle = path.join(appStylesFolder, 'settings.scss') | ||
|
||
const RED = 'rgb(255, 0, 0)' | ||
const GREEN = 'rgb(0, 255, 0)' | ||
|
||
const settingsContent = `$govuk-brand-colour: ${RED}` | ||
const changedSettingsContent = `$govuk-brand-colour: ${GREEN}` | ||
|
||
describe('watching settings.scss', () => { | ||
before(() => { | ||
cy.task('deleteFile', { filename: settingsStyle }) | ||
}) | ||
|
||
it('Successfully reload settings changes', () => { | ||
waitForApplication() | ||
|
||
cy.task('log', 'The colour of the header bottom border should be as designed') | ||
cy.get('.govuk-header__container').should('not.have.css', 'border-bottom-color', RED) | ||
|
||
createFile(settingsStyle, { data: settingsContent }) | ||
|
||
waitForApplication() | ||
|
||
cy.task('log', 'The colour of the header bottom border should be changed to red') | ||
cy.get('.govuk-header__container').should('have.css', 'border-bottom-color', RED) | ||
|
||
replaceInFile(settingsStyle, settingsContent, '', changedSettingsContent) | ||
|
||
waitForApplication() | ||
|
||
cy.task('log', 'The colour of the header bottom border should be changed to green') | ||
cy.get('.govuk-header__container').should('have.css', 'border-bottom-color', GREEN) | ||
|
||
deleteFile(settingsStyle) | ||
|
||
waitForApplication() | ||
|
||
cy.task('log', 'The colour of the header bottom border should be as designed') | ||
cy.get('.govuk-header__container').should('not.have.css', 'border-bottom-color', GREEN) | ||
}) | ||
}) |
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
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