diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/voluntary-conversion.cy.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/voluntary-conversion.cy.js index e28a10ef3..acefbc0ed 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/voluntary-conversion.cy.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/voluntary-conversion.cy.js @@ -1,17 +1,20 @@ /// +import projectList from '../../pages/projectList' +import voluntaryProjectTaskList from '../../pages/voluntaryProjectTaskList' + +var projectName = 'Voluntary Cypress Project' describe('Voluntary conversion', { tags: ['@dev', '@stage'] }, () => { beforeEach(() => { cy.callAcademisationApi('POST', `cypress-data/add-voluntary-project.cy`, "{}") .then(() => { - cy.login({ titleFilter: 'Cypress Project' }) - .then(() => { - cy.get('[id="school-name-0"]').click(); - }); + projectList.selectProject(projectName) }); }) it('TC01: Voluntary conversion journey ', () => { // Go wild Dan! + voluntaryProjectTaskList.voluntaryProjectElementsVisible() + }) }) \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/BasePage.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/BasePage.js new file mode 100644 index 000000000..eaed67730 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/BasePage.js @@ -0,0 +1,11 @@ +export default class BasePage { + static setDesktopViewport() + { + cy.viewport('macbook-13') + } + + static setLargeDesktopViewport() + { + cy.viewport(1980, 1080) + } +} \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js index 1aef19c49..c910cc644 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js @@ -2,7 +2,9 @@ export const path = 'project-list'; -class ProjectList { +import BasePage from './BasePage' + +export default new class projectList extends BasePage { checkProjectListPage() { cy.url().should('include', path); @@ -28,12 +30,19 @@ class ProjectList { this.getNthProject().click(); } - selectProject(projectName = 'Gloucester school') { + selectProject(projectName = 'Gloucester School') { this.filterProjectList(projectName); this.selectFirstItem(); return cy.url().then(url => this.getIdFromUrl(url)); }; + selectVoluntaryProject() { + cy.login({titleFilter: 'Voluntary Cypress Project'}); + cy.get('[id="school-name-0"]').click(); + + return cy.url().then(url => this.getIdFromUrl(url)); + }; + getIdFromUrl(url) { const urlSplit = url.toString().split('/'); for (let i = urlSplit.length - 1; i > 0; i--) { @@ -44,6 +53,4 @@ class ProjectList { return ''; }; -}; - -export default new ProjectList(); \ No newline at end of file +}; \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/voluntaryProjectTaskList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/voluntaryProjectTaskList.js new file mode 100644 index 000000000..86c9186b1 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/voluntaryProjectTaskList.js @@ -0,0 +1,30 @@ +import BasePage from './BasePage' + +export default class voluntaryProjectTaskList extends BasePage { + + + static voluntaryProjectElementsVisible() + { + var projectName = 'Voluntary Cypress Project' + var routeType = 'Voluntary conversion' + var projectOwner = '' + var projectStatus = 'Approved with Conditions' + + // Check Header section of main Project Page + cy.get('h1[data-cy]').contains(projectName) + cy.get('p[class="govuk-body govuk-!-margin-bottom-1"]').contains('Route: ' + routeType) + cy.get('p[class="govuk-body govuk-!-margin-bottom-5"]').contains('Project owner: ' + projectOwner) + cy.get('.empty').contains('Empty') + cy.get('a[class="govuk-link govuk-!-padding-left-50"]').contains('Change') + cy.get('strong[class="govuk-tag govuk-tag--green"]').contains(projectStatus) + + // Check Project Tabs Section of main Project Page + cy.get('ul').eq(0).find('li').should('have.length',4) + + // Check Project details is default tab selected + cy.get('a[aria-Current="page"]').contains('Project details') + + + } +} +