-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,58 @@ | ||
describe('Education Editor Form Test', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:3000/login'); | ||
cy.get('input[type=email]').type('[email protected]'); | ||
cy.get('input[type=password]').type('123'); | ||
cy.contains('Sign In').click(); | ||
|
||
cy.url().should(url => { | ||
expect(url).to.match(/\/cv_gallery|\/editor/); | ||
}); | ||
|
||
// navegar al editor | ||
cy.url().then(url => { | ||
if (!url.includes('/editor')) { | ||
cy.visit('http://localhost:3000/editor'); | ||
} | ||
}); | ||
// Runs before each test case | ||
beforeEach(() => { | ||
cy.visit('http://localhost:3000/login'); | ||
cy.get('input[type=email]').type('[email protected]'); | ||
cy.get('input[type=password]').type('123'); | ||
cy.get('form').submit(); | ||
cy.url().should((url) => { | ||
expect(url).to.match(/\/cv_gallery|\/editor/); | ||
}); | ||
|
||
it ('Renders education section correctly', () => { | ||
cy.contains('Education').should('exist'); | ||
cy.url().then((url) => { | ||
if (!url.includes('/editor')) { | ||
cy.visit('http://localhost:3000/editor'); | ||
} | ||
}); | ||
}); | ||
|
||
it ('Updated Education Section', () => { | ||
cy.get('ul.steps').find('button').contains('Education').click(); | ||
cy.get('button').contains('Add New Education').click(); | ||
it('Updates the Education Section', () => { | ||
cy.get('ul.steps').find('button').contains('Education').click(); | ||
cy.get('button').contains('Add New Education').click(); | ||
|
||
// Fill out the form | ||
cy.get('input[name="school"]').type('UC Berkeley'); | ||
cy.get('input[name="education_degree"]').type('Bachelors in Computer Science'); | ||
cy.get('input[name="gpa"]').type('3.5'); | ||
cy.get('input[name="start_date"]').type('2018-01-01'); | ||
cy.get('input[name="end_date"]').type('2022-01-01'); | ||
cy.get('input[name="school"]').type('UC Berkeley'); | ||
cy.get('input[name="education_degree"]').type('Bachelors in Computer Science'); | ||
cy.get('input[name="gpa"]').type('3.5'); | ||
cy.get('input[name="start_date"]').type('2018-01-04'); | ||
cy.get('input[name="end_date"]').type('2022-01-01'); | ||
|
||
cy.get('button').contains('Save').click(); | ||
}); | ||
cy.get('button').contains('Save').click(); | ||
|
||
cy.contains('UC Berkeley').should('be.visible'); | ||
cy.contains('Bachelors in Computer Science').should('be.visible'); | ||
}); | ||
|
||
it('Validates Education Form Fields', () => { | ||
cy.get('ul.steps').find('button').contains('Education').click(); | ||
cy.get('button').contains('Add New Education').click(); | ||
|
||
cy.get('input[name="school"]').should('be.visible'); | ||
cy.get('input[name="education_degree"]').should('be.visible'); | ||
cy.get('input[name="gpa"]').should('be.visible'); | ||
cy.get('input[name="start_date"]').should('be.visible'); | ||
cy.get('input[name="end_date"]').should('be.visible'); | ||
}); | ||
|
||
}); | ||
|
||
it('Handles Invalid Form Submissions', () => { | ||
cy.get('ul.steps').find('button').contains('Education').click(); | ||
cy.get('button').contains('Add New Education').click(); | ||
|
||
cy.get('button').contains('Save').click(); | ||
|
||
}); | ||
|
||
|
||
}); | ||
|
||
export {}; |