Skip to content

Commit

Permalink
Merge branch 'main' into feature/137597-word-doc-sponsored
Browse files Browse the repository at this point in the history
  • Loading branch information
dneed-nimble authored Sep 8, 2023
2 parents 996631b + 408a506 commit d1649f7
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/// <reference types ='Cypress'/>
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()

})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default class BasePage {
static setDesktopViewport()
{
cy.viewport('macbook-13')
}

static setLargeDesktopViewport()
{
cy.viewport(1980, 1080)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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--) {
Expand All @@ -44,6 +53,4 @@ class ProjectList {

return '';
};
};

export default new ProjectList();
};
Original file line number Diff line number Diff line change
@@ -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')


}
}

0 comments on commit d1649f7

Please sign in to comment.