Skip to content

Commit

Permalink
♻️ Add command fillProjectForm to remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysoun committed Nov 14, 2023
1 parent 69f1f73 commit 0c57bb4
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions modules/ui/cypress/e2e/project-creation-and-edition.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ const newProjectId = generateId();
const projectNewName = buildProjectName(newProjectId)
const projectNewSmallName = buildProjectSmallName(newProjectId);

Cypress.Commands.add('fillProjectForm', (name, smallName) => {
cy.getBySelectorId('name')
.clear()
.type(name)
.should('have.value', name)
cy.getBySelectorId('smallName')
.clear()
.type(smallName)
.should('have.value', smallName)
cy.get('button[type=submit]').click()
})

describe('project creation and edition afterwards', () => {
it('create project', () => {
cy.visit('/projects')
cy.getBySelectorId('name')
.type(projectName)
.should('have.value', projectName)
cy.getBySelectorId('smallName')
.type(projectSmallName)
.should('have.value', projectSmallName)
cy.get('button[type=submit]').click()
cy.fillProjectForm(projectName, projectSmallName);
})

it('new project should appear in project hierarchies', () => {
Expand All @@ -40,16 +46,7 @@ describe('project creation and edition afterwards', () => {
cy.visit('/')
cy.contains(projectName).click();
cy.getBySelectorId('editProject').click();

cy.getBySelectorId('name')
.clear()
.type(projectNewName)
.should('have.value', projectNewName)
cy.getBySelectorId('smallName')
.clear()
.type(projectNewSmallName)
.should('have.value', projectNewSmallName)
cy.get('button[type=submit]').click()
cy.fillProjectForm(projectNewName, projectNewSmallName);
})

it('new name should appear in project hierarchies', () => {
Expand Down

0 comments on commit 0c57bb4

Please sign in to comment.