diff --git a/cypress/e2e/dev/5-management-tests/change-service-name.cypress.js b/cypress/e2e/dev/5-management-tests/change-service-name.cypress.js index 12b2f2cdbd..22d54e9d1c 100644 --- a/cypress/e2e/dev/5-management-tests/change-service-name.cypress.js +++ b/cypress/e2e/dev/5-management-tests/change-service-name.cypress.js @@ -16,18 +16,19 @@ const serverNameQuery = 'a.govuk-header__link.govuk-header__service-name, a.govu const managePagePath = '/manage-prototype' +function restore () { + // Restore index.html and config.json from prototype starter + cy.task('copyFromStarterFiles', { filename: appConfigPath }) + cy.task('copyFromStarterFiles', { filename: appIndexPath }) +} + describe('change service name', () => { - before(() => { - // Restore index.html and config.json from prototype starter - cy.task('copyFromStarterFiles', { filename: appConfigPath }) - cy.task('copyFromStarterFiles', { filename: appIndexPath }) - }) + before(restore) + after(restore) it('The service name should change to "cypress test" and the task should be set to "Done"', () => { - waitForApplication() + waitForApplication('/') - cy.task('log', 'Visit the index page and navigate to the manage your prototype page') - cy.visit('/') cy.get('.govuk-heading-xl').contains(originalText) cy.get('p strong').contains(appConfigPath) cy.get(`main a[href="${managePagePath}"]`).contains('Manage your prototype').click()