2020-07-03 17:25:23 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Create Job Offer Browser Testing', () => {
|
|
|
|
let jobDate = '',
|
|
|
|
jobTitle = 'Test Job Offer ',
|
|
|
|
description = 'Test Description ';
|
|
|
|
before(() => {
|
|
|
|
cy.nextYear(1).then(year => {
|
|
|
|
jobDate = year + '-12-31';
|
|
|
|
});
|
|
|
|
cy.randomNum().then(num => {
|
|
|
|
jobTitle += num;
|
|
|
|
description += num;
|
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
cy.clearLocalStorageSnapshot();
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.clearLocalStorage({ domain: null });
|
|
|
|
cy.clearCookies({ domain: null });
|
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
|
|
afterEach(() => cy.saveLocalStorage());
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit user login screen', () => cy.userLogin());
|
|
|
|
describe('Job Offer Creation process', () => {
|
|
|
|
it('should login', () => cy.login());
|
|
|
|
it('should visit the job offer creation screen', () => cy.naviagte('/job-offers/job-offers-create'));
|
|
|
|
/*it('should enter incorrect job offer data', () => {
|
|
|
|
cy.get('#job-offers-create input[name="closingDate"]').type('!"#$%&');
|
|
|
|
cy.get('#job-offers-create input[name="closingDate"]').should('have.value', '!"#$%&');
|
|
|
|
cy.get('#job-offers-create input[name="title"]').type('!"#$%&');
|
|
|
|
cy.get('#job-offers-create input[name="title"]').should('have.value', '!"#$%&');
|
|
|
|
cy.get('#job-offers-create textarea[name="description"]').type(description);
|
|
|
|
cy.get('#job-offers-create textarea[name="description"]').should('have.value', description);
|
|
|
|
});
|
|
|
|
it('should click on create job offer button', () => {
|
|
|
|
cy.get('#job-offers-create input[type="submit"]').click();
|
|
|
|
});
|
|
|
|
it('should provide errors about incorrect job offer data', () => {
|
|
|
|
// TO-DO: Check for error messages
|
|
|
|
cy.get('element')
|
|
|
|
.should('contain.text', 'Error message.');
|
|
|
|
});*/
|
|
|
|
it('should enter correct job offer data', () => {
|
|
|
|
cy.get('#job-offers-create input[name="closingDate"]').clear().type(jobDate);
|
|
|
|
cy.get('#job-offers-create input[name="closingDate"]').should('have.value', jobDate);
|
|
|
|
cy.get('#job-offers-create input[name="title"]').clear().type(jobTitle);
|
|
|
|
cy.get('#job-offers-create input[name="title"]').should('have.value', jobTitle);
|
|
|
|
cy.get('#job-offers-create textarea[name="description"]').clear().type(description);
|
|
|
|
cy.get('#job-offers-create textarea[name="description"]').should('have.value', description);
|
|
|
|
});
|
|
|
|
it('should click on create job offer button', () => {
|
|
|
|
cy.get('#job-offers-create 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 land newly created job offer on job offers list screen', () => {
|
|
|
|
cy.contains('solid-display-value[name="title"]', jobTitle).should("exist");
|
|
|
|
cy.contains('solid-display-value[name="description"]', description).should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|