-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cypress refactor #1058
base: main
Are you sure you want to change the base?
Cypress refactor #1058
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import '../../support/commands'; | ||
import projectTaskList from "../../pages/projectTaskList"; | ||
const applicationFormTaskList = require('../../pages/applicationFormTaskList'); | ||
|
||
describe('Test Application Form for Voluntary and Form a MAT', { tags: ['@dev', '@stage'] }, () => { | ||
|
||
beforeEach(() => { | ||
projectTaskList.getHomePage(); | ||
}); | ||
|
||
it('Should filter and select the project, then verify details of Voluntary', () => { | ||
|
||
// Step 1: Filter search | ||
applicationFormTaskList.filterSearch('Fahads Cypress Trust'); | ||
|
||
// Step 2: Verify the title and route | ||
applicationFormTaskList.checkTitle('Fahads Cypress Trust'); | ||
applicationFormTaskList.checkRoute('Voluntary conversion'); | ||
|
||
// Step 3: Select the first search result | ||
applicationFormTaskList.selectFirstSearchResult(); | ||
|
||
// Step 4: Click on school application form | ||
applicationFormTaskList.clickSchoolApplicationForm(); | ||
|
||
//Step 4.1: Check URL contains to contain school-application-form | ||
applicationFormTaskList.checkUrlContainsSchoolApplicationForm(); | ||
|
||
//Step 4.2: Check the route | ||
applicationFormTaskList.checkRouteAppForm('Voluntary conversion'); | ||
|
||
// Step 5: Check the table contents | ||
const expectedContents = [ | ||
'Overview', | ||
'About the conversion', | ||
'Further information', | ||
'Finances', | ||
'Future pupil numbers', | ||
'Land and buildings', | ||
'Pre-opening support grant', | ||
'Consultation', | ||
'Declaration' | ||
]; | ||
applicationFormTaskList.checkTableContents(expectedContents); | ||
|
||
// Step 6: Check Overview1_value | ||
applicationFormTaskList.checkElementText('[test-id="Overview1_value"]', 'PLYMOUTH CAST with Plymstock School'); | ||
FahadDarw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Step 7: Check Application reference | ||
applicationFormTaskList.checkElementText('[test-id="Overview2"]', 'A2B_124378'); | ||
}); | ||
|
||
it('Should filter and select the project, then verify details of a Form a MAT project', () => { | ||
|
||
// Step 1: Filter search | ||
applicationFormTaskList.clickFormAMAT(); | ||
applicationFormTaskList.filterSearch('Fahads Cypress Trust'); | ||
|
||
|
||
// Step 2: Select the first search result | ||
applicationFormTaskList.selectFirstSearchResultFormAMAT(); | ||
|
||
//Step 2.1: Check URL contains to contain school-application-form | ||
applicationFormTaskList.checkUrlContainsschoolsinthismat(); | ||
//step 2.2: Click on the first project | ||
applicationFormTaskList.selectFirstProjectFormAMAT(); | ||
//Step 2.3: Check the route | ||
applicationFormTaskList.checkRouteAppForm('Form a MAT Voluntary conversion'); | ||
// Step 3: Click on school application form | ||
applicationFormTaskList.clickSchoolApplicationFormForFormAMAT(); | ||
|
||
// Step 4: Check the table contents | ||
|
||
const expectedContents = [ | ||
'Overview', | ||
'Trust information', | ||
'Key people within the trust', | ||
'About the conversion', | ||
'Further information', | ||
'Finances', | ||
'Future pupil numbers', | ||
'Land and buildings', | ||
'Pre-opening support grant', | ||
'Consultation', | ||
'Declaration' | ||
]; | ||
applicationFormTaskList.checkTableContents(expectedContents); | ||
|
||
// Step 5: Check Overview1_value | ||
applicationFormTaskList.checkElementText('[test-id="Overview1_value"]', 'Plymouth with Fahads Cypress Trust'); | ||
|
||
// Step 6: Check Application reference | ||
applicationFormTaskList.checkElementText('[test-id="Overview2"]', 'A2B_124335'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
class ApplicationFormTaskList { | ||
// Method to interact with the filter search input | ||
filterSearch(title) { | ||
cy.get('[data-cy="select-projectlist-filter-title"]').type(title); | ||
cy.get('[data-cy="select-projectlist-filter-apply"]').click(); | ||
} | ||
|
||
// Method to select the first search result | ||
selectFirstSearchResult() { | ||
cy.get('#school-name-0').click(); | ||
} | ||
|
||
// Method to select the first search result for Form a MAT | ||
selectFirstSearchResultFormAMAT() { | ||
cy.get('#trust-name-0').click(); | ||
} | ||
|
||
// Method to check the route | ||
checkRoute(expectedRoute) { | ||
cy.get('#type-and-route-0 > span').should('contain', expectedRoute); | ||
} | ||
|
||
// Method to check the page title | ||
checkTitle(title) { | ||
cy.get('#school-name-0').should('contain', title); | ||
} | ||
|
||
//method to click on the first form a mat project | ||
selectFirstProjectFormAMAT() { | ||
cy.get('#school-name-0').click(); | ||
} | ||
|
||
// Method to click on school application form | ||
clickSchoolApplicationForm() { | ||
|
||
cy.get('[data-cy="school_application_form"]').click(); | ||
} | ||
// Method to click on school application form for Form a MAT page | ||
clickSchoolApplicationFormForFormAMAT() { | ||
|
||
cy.get('[data-cy="school_application_form_formamat"]').click(); | ||
} | ||
// Method to click on school application form First project | ||
clickSchoolApplicationFormFirstProjet() { | ||
|
||
cy.get('#school-name-0').click(); | ||
} | ||
|
||
// Method to check the url contains school-application-form | ||
checkUrlContainsSchoolApplicationForm() { | ||
cy.url().should('contain', 'school-application-form'); | ||
} | ||
|
||
// Method to check the url contains schools-in-this-mat | ||
checkUrlContainsschoolsinthismat() { | ||
cy.url().should('contain', 'schools-in-this-mat'); | ||
} | ||
|
||
// Method to check the route in Application Form page | ||
checkRouteAppForm(expectedRouteAppRoute) { | ||
|
||
cy.get('[data-cy="route"]').should('contain', expectedRouteAppRoute); | ||
|
||
} | ||
// Method to check the contents of the table | ||
checkTableContents(expectedContents) { | ||
cy.get('[data-cy="content-Table"]').within(() => { | ||
expectedContents.forEach((content, index) => { | ||
cy.get('[data-cy="contents_list_items"]').eq(index).should('contain', content); | ||
}); | ||
}); | ||
} | ||
|
||
// Method to check specific elements for expected text | ||
checkElementText(selector, expectedText) { | ||
cy.get(selector).should('contain', expectedText); | ||
} | ||
|
||
clickFormAMAT() { | ||
cy.get('[data-cy="formAMatLink"]').click(); | ||
} | ||
} | ||
|
||
module.exports = new ApplicationFormTaskList(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,12 @@ | |
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h2 class="govuk-heading-l govuk-!-margin-bottom govuk-!-font-size-36">School application form</h2> | ||
<nav class="gem-c-contents-list" aria-label="Pages in this guide" role="navigation" data-module="gem-track-click"> | ||
<nav class="gem-c-contents-list" aria-label="Pages in this guide" role="navigation" data-module="gem-track-click" data-cy="content-Table"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably have some consistency in the tags i.e. all lowercase and using either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do :) |
||
<h2 class="gem-c-contents-list__title">Contents</h2> | ||
<ol class="gem-c-contents-list__list"> | ||
@foreach (BaseFormSection formSection in Model.Sections) | ||
{ | ||
<li class="gem-c-contents-list__list-item gem-c-contents-list__list-item--dashed"> | ||
<li class="gem-c-contents-list__list-item gem-c-contents-list__list-item--dashed" data-cy="contents_list_items"> | ||
<a id="@Model.GenerateId(formSection.Heading)_link" class="gem-c-contents-list__link govuk-link" href="#@Model.GenerateId(formSection.Heading)">@formSection.Heading</a> | ||
</li> | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just "Cypress Trust"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need it to be Fahads Cypress Trust as Elijah has already created those cases for me. but next time I can try and change the name