-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from Ohtuilmo/fix/time_logs_validation
Fix/time logs validation
- Loading branch information
Showing
5 changed files
with
146 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
describe('Time Logs Page', () => { | ||
beforeEach(() => { | ||
cy.clearLocalStorage() | ||
cy.loginAsRegisteredUser() | ||
cy.createGroup({ | ||
name: 'Brand New Group', | ||
topicId: 1, | ||
configurationId: 1, | ||
instructorId: null, | ||
studentIds: ['012345698'] | ||
}) | ||
cy.visit('/sprints') | ||
cy.get('.sprints-container').should('exist') | ||
cy.get('#sprintNumber').type('1') | ||
cy.get('#startDate').type('2022-01-01') | ||
cy.get('#endDate').type('2022-01-31') | ||
cy.get('.button').click() | ||
cy.wait(200) | ||
|
||
cy.visit('/timelogs') | ||
}) | ||
|
||
//currently just placeholder, no such functionality immpemented | ||
it.skip('does not show log form when there are no sprints', () => { | ||
cy.wait(2500) | ||
cy.get('.timelogs-container-1').should('not.exist') | ||
}) | ||
|
||
it('creates timeLog successfully', () => { | ||
cy.visit('/timelogs') | ||
cy.get('.timelogs-container-1').should('exist') | ||
cy.get('.input-container').should('exist') | ||
cy.get('.date').type('2022-01-01') | ||
cy.get('.time').type('01:00') | ||
cy.get('.description').type('Test description') | ||
cy.get('.submit-button').click() | ||
|
||
cy.get('.notification').should('exist') | ||
cy.get('.notification').should('have.text', 'Time log created successfully') | ||
}) | ||
|
||
// this test will fail when frontend validation is done properly, remove at that point | ||
it('shows error from backend when creating timeLog fails too short description', () => { | ||
cy.visit('/timelogs') | ||
cy.get('.timelogs-container-1').should('exist') | ||
cy.get('.input-container').should('exist') | ||
cy.get('.date').type('2022-01-01') | ||
cy.get('.time').type('01:00') | ||
cy.get('.description').type('inv') | ||
cy.get('.submit-button').click() | ||
|
||
cy.get('.notification').should('exist') | ||
cy.get('.notification').should('have.text', 'Description must be over 5 characters.') | ||
}) | ||
|
||
it('shows error from backend when creating timeLog fails with data outside sprint', () => { | ||
cy.visit('/timelogs') | ||
cy.get('.timelogs-container-1').should('exist') | ||
cy.get('.input-container').should('exist') | ||
cy.get('.date').type('2022-02-01') | ||
cy.get('.time').type('01:00') | ||
cy.get('.description').type('valid description') | ||
cy.get('.submit-button').click() | ||
|
||
cy.get('.notification').should('exist') | ||
cy.get('.notification').should('have.text', 'The log date is not within sprint start and end date.') | ||
}) | ||
|
||
after(() => { | ||
cy.visit('/sprints') | ||
cy.get('.delete-sprint-button').click() | ||
cy.deleteAllGroups() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters