Skip to content

Commit

Permalink
Added additional e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-c-dfe committed Aug 8, 2024
1 parent 40c0cb7 commit 0de4b47
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@using (Html.BeginForm("Refine", "QualificationDetails", FormMethod.Post))
{
<input class="govuk-input govuk-!-width-three-quarters" id="refineSearch" name="refineSearch" aria-label="refine search box" type="text" value="@Model.SearchCriteria">
<button type="submit" class="govuk-button govuk-button--secondary" data-module="govuk-button">
<button id="refineSearchButton" type="submit" class="govuk-button govuk-button--secondary" data-module="govuk-button">
@Model.SearchButtonText
</button>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,71 @@ describe('A spec used to test the various routes through the journey', () => {
})
})

it("Should remove the search criteria when a user goes to the awarding organisation page and back again", () => {
// 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("6");
cy.get('#date-started-year').type("2022");
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('#3').click();
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-select').select(1); // first no-default item in the list
cy.get('button[id="question-submit"]').click();

// Select a qualification page
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/qualifications');
})

cy.get('#refineSearch').type('test');
cy.get('#refineSearchButton').click();

cy.location().should((loc) => {
expect(loc.pathname).to.eq('/qualifications');
})

cy.get('#back-button').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-select').select(1); // first no-default item in the list
cy.get('button[id="question-submit"]').click();

// Select a qualification page
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/qualifications');
})

cy.get('#refineSearch').should('have.value', '');
})

const testDates = [
['09', '2014'],
['06', '2017'],
Expand Down

0 comments on commit 0de4b47

Please sign in to comment.