59 lines
2.3 KiB
JavaScript
59 lines
2.3 KiB
JavaScript
/// <reference types="Cypress" />
|
|
/* globals cy, expect */
|
|
|
|
context('Edit Job Offer Browser Testing', () => {
|
|
let jobDate = '',
|
|
jobTitle = 'Edited Test Job Offer ',
|
|
description = 'Edited Test Description ',
|
|
menuQuery = [
|
|
'solid-display.job-board__list',
|
|
'solid-display:last-child'
|
|
];
|
|
before(() => {
|
|
cy.nextYear(2).then(year => {
|
|
jobDate = year + '-12-31';
|
|
});
|
|
cy.randomNum().then(num => {
|
|
jobTitle += num;
|
|
description += num;
|
|
});
|
|
cy.clearLocalStorageSnapshot();
|
|
cy.clearLocalStorage({ domain: null });
|
|
cy.clearCookies({ domain: null });
|
|
});
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
afterEach(() => cy.saveLocalStorage());
|
|
it('should visit user login screen', () => cy.userLogin());
|
|
describe('Job Offer Edition process', () => {
|
|
it('should login', () => cy.login());
|
|
it('should visit the job offers list screen', () => cy.naviagte('/job-offers'));
|
|
it('should visit the last project edit screen', () => {
|
|
cy.get(menuQuery.join(' '))
|
|
.invoke('attr', 'data-src')
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
|
cy.naviagte('/job-offers/job-offers-edit/@' + id);
|
|
}));
|
|
});
|
|
it('should enter new job offer data', () => {
|
|
cy.get('#job-offers-edit input[name="closingDate"]').clear().type(jobDate);
|
|
cy.get('#job-offers-edit input[name="closingDate"]').should('have.value', jobDate);
|
|
cy.get('#job-offers-edit input[name="title"]').clear().type(jobTitle);
|
|
cy.get('#job-offers-edit input[name="title"]').should('have.value', jobTitle);
|
|
cy.get('#job-offers-edit textarea[name="description"]').clear().type(description);
|
|
cy.get('#job-offers-edit textarea[name="description"]').should('have.value', description);
|
|
});
|
|
it('should click button to save the job offer', () => {
|
|
cy.get('#job-offers-edit input[type="submit"]').click();
|
|
});
|
|
it('should land on job offers list screen', () => {
|
|
cy.location().should((loc) => {
|
|
expect(loc.pathname).to.eq('/job-offers');
|
|
});
|
|
});
|
|
it('should show edited project data on project information screen', () => {
|
|
cy.contains('solid-display-value[name="title"]', jobTitle).should("exist");
|
|
cy.contains('solid-display-value[name="description"]', description).should("exist");
|
|
});
|
|
});
|
|
});
|