Skip to content

Commit

Permalink
Update education.cy.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
YuvanTec committed Jun 15, 2024
1 parent 19300bd commit 705cf68
Showing 1 changed file with 49 additions and 30 deletions.
79 changes: 49 additions & 30 deletions cypress/e2e/cv/education.cy.ts
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 {};

0 comments on commit 705cf68

Please sign in to comment.