Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cypress/e2e/projectsModule/projectsModuleUsingPOM.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@ describe('Verifying Add Project functionality of projects module', function(){
})
})

it('Create new project in projects module with non-empty fields', function() {
const randomGeneratedName = getRandomString()
addProjectPO.typeProjectName(randomGeneratedName)
addProjectPO.selectClientName('Jane Doe')
addProjectPO.clickAddProjectButton()

//TODOS make an assertion
})

})
33 changes: 33 additions & 0 deletions cypress/page_objects/projectsModulePO/addProject_PO.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
class addProjectPO{
elements = {
projectName : () => cy.get('[data-cy="addProjectname"]'),
clientName : () => cy.get('#client-id'),
billableKey : () => cy.get('[data-cy="toggleBillable"]'),
addProject : () => cy.get('[data-cy="newProjectCreateButton"]'),
validationError : () => cy.get('.alert-message'),
searchField : () => cy.get('.topnav input')
}

Expand All @@ -8,6 +13,34 @@ class addProjectPO{
cy.url().should('eq', 'https://frontendbootcamp.proshore.eu/projects')
}

verifyEmptyValidation(name){
if(name === 'project') {
this.elements.projectName().invoke('prop', 'validationMessage')
.should('equal', 'Please fill out this field.')
}
if(name == 'client'){
this.elements.clientName().invoke('prop', 'validationMessage')
.should('equal', 'Please select an item in the list.')
}
}

typeProjectName(projectName){
this.elements.projectName().wait(1000).type(projectName)
}

selectClientName(clientName){
this.elements.clientName().select(clientName)
}

checkbillableKeyFunctionality(){
this.elements.billableKey().should('have.attr', 'title', 'Billable')
this.elements.billableKey().click().should('have.attr', 'title', 'Non billable')
this.elements.billableKey().click().should('have.attr', 'title', 'Billable')
}

clickAddProjectButton(){
this.elements.addProject().contains('ADD PROJECT').click()
}
}

module.exports = new addProjectPO();