Skip to content

Commit

Permalink
[EN-4026] chore(inputs): finished tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emile-bex committed Aug 21, 2023
1 parent 2946dc0 commit e0c79ba
Show file tree
Hide file tree
Showing 23 changed files with 551 additions and 149 deletions.
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = defineConfig({
projectId: process.env.CYPRESS_IO_PROJECT_ID,
defaultCommandTimeout: 10000,
pageLoadTimeout: 120000,
scrollBehavior: "center",
env: {
adresseLocauxParis: `${process.env.ADRESSE_LOCAUX_PARIS}`,
},
Expand Down
51 changes: 37 additions & 14 deletions cypress/e2e/admin.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ describe('Admin', () => {
{
fixture: 'user-admin-candidates-search-res',
}
).as('getExternalCandidates');
).as('getExternalCandidatesJane');

cy.intercept(
'GET',
`/user/search?query=Emile&role=Candidat+externe&organizationId=${entourageOrganizationId}`,
{
fixture: 'user-admin-candidates-search-res',
}
).as('getExternalCandidatesEmile');

cy.intercept('GET', '/organization?limit=50&offset=0&zone[]=LYON', {
fixture: 'organization-search-res',
Expand Down Expand Up @@ -180,7 +188,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Paris')
.click();

Expand Down Expand Up @@ -213,7 +221,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Admin')
.click();

Expand All @@ -227,7 +235,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Candidats')
.click();
});
Expand All @@ -237,7 +245,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Candidat LKO')
.click();

Expand Down Expand Up @@ -268,7 +276,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Coach LKO')
.click();

Expand Down Expand Up @@ -299,7 +307,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Candidat externe')
.click();

Expand Down Expand Up @@ -345,7 +353,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Coach externe')
.click();

Expand Down Expand Up @@ -373,7 +381,7 @@ describe('Admin', () => {
.scrollIntoView()
.type('Jane');

cy.wait('@getExternalCandidates');
cy.wait('@getExternalCandidatesJane');

cy.get('#form-add-user-userToLinkId')
.find('.Select__menu')
Expand All @@ -382,6 +390,21 @@ describe('Admin', () => {
.find('.Select__option')
.contains('Jane Doe')
.click();

cy.get('#form-add-user-userToLinkId')
.should('be.visible')
.scrollIntoView()
.type('Emile');

cy.wait('@getExternalCandidatesEmile');

cy.get('#form-add-user-userToLinkId')
.find('.Select__menu')
.should('be.visible')
.scrollIntoView()
.find('.Select__option')
.contains('Emile Sf Bex')
.click();
});
});

Expand Down Expand Up @@ -424,7 +447,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Paris')
.click();

Expand Down Expand Up @@ -466,7 +489,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Candidat externe')
.click();
});
Expand All @@ -476,7 +499,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Coach externe')
.click();
});
Expand Down Expand Up @@ -529,7 +552,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Paris')
.click();

Expand Down Expand Up @@ -590,7 +613,7 @@ describe('Admin', () => {
.should('be.visible')
.scrollIntoView()
.click()
.find('button')
.find('.option')
.contains('Lyon')
.click();

Expand Down
88 changes: 51 additions & 37 deletions cypress/e2e/candidat.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('Candidat', () => {

cy.intercept('PUT', '/user/changePwd', {}).as('changePwd');
});

it('should open backoffice public offers', () => {
cy.visit('/backoffice/candidat/offres/public', {
onBeforeLoad: function async(window) {
Expand Down Expand Up @@ -130,31 +129,43 @@ describe('Candidat', () => {
);
});
cy.get('[data-testid="candidat-add-offer-main"]').click();
cy.get('#form-offer-external-title').scrollIntoView().type('test');
cy.get('#form-offer-external-company').scrollIntoView().type('test');
cy.get('#form-offer-external-department-container')
cy.get('#form-add-offer-external-title').scrollIntoView().type('test');
cy.get('#form-add-offer-external-company').scrollIntoView().type('test');

cy.get('#form-add-offer-external-department')
.should('be.visible')
.scrollIntoView()
.type('Par');

cy.get('#form-add-offer-external-department')
.find('.Select__menu')
.should('be.visible')
.scrollIntoView()
.find('.Select__option')
.contains('Paris (75)')
.click();
cy.get(
'#form-offer-external-department-container .options-container .option button'
)
.first()
.click();
cy.get('#form-offer-external-contract-container').scrollIntoView().click();
cy.get(
'#form-offer-external-contract-container .options-container .option button'
)
.first()

cy.get('#form-add-offer-external-contract-container')
.should('be.visible')
.scrollIntoView()
.click()
.find('.option')
.contains('CDI')
.click();
cy.get('#form-offer-external-recruiterFirstName')

cy.get('#form-add-offer-external-recruiterFirstName')
.scrollIntoView()
.type('test');
cy.get('#form-add-offer-external-recruiterName')
.scrollIntoView()
.type('test');
cy.get('#form-offer-external-recruiterName').scrollIntoView().type('test');
cy.get('#form-offer-external-recruiterMail')
cy.get('#form-add-offer-external-recruiterMail')
.scrollIntoView()
.type('[email protected]');
cy.get('#form-offer-external-description').scrollIntoView().type('test');
cy.get('#form-offer-external-link').scrollIntoView().type('test');
cy.get('#form-add-offer-external-description')
.scrollIntoView()
.type('test');
cy.get('#form-add-offer-external-link').scrollIntoView().type('test');
cy.get('button').contains('Envoyer').click();
cy.wait('@postExternal');

Expand All @@ -169,10 +180,10 @@ describe('Candidat', () => {
window.localStorage.setItem('release-version', 'v100');
},
});
cy.get(`[data-testid="test-catchphrase-edit-icon"]`).click({ force: true });
cy.get(`[data-testid="test-catchphrase-edit-icon"]`).click();
const catchPhrase = 'hello my name is Mike';
cy.get('#form-catchphrase-catchphrase').type(catchPhrase);
cy.get(`[data-testid="form-confirm-catchphrase-form"]`).click();
cy.get(`[data-testid="form-confirm-form-catchphrase"]`).click();
cy.get(`[data-testid="cv-edit-catchphrase-content"]`).should(
'contain',
catchPhrase
Expand All @@ -189,33 +200,36 @@ describe('Candidat', () => {
});

// toggle hide CV
cy.get(`[data-testid="test-toggle-hidden"]`).click({ force: true });
cy.get('label[for="ent-toggle-hidden"]').click();
cy.get(`[data-testid="test-confirm-hidden"]`).click();
cy.wait('@putCandidatParams');
cy.get(`[data-testid="test-toggle-hidden"]`).should('be.checked');
cy.get(`[data-testid="test-toggle-hidden"]`)
.click({ force: true })
.should('not.be.checked');
cy.get('label[for="ent-toggle-hidden"]').click();
cy.get(`[data-testid="test-toggle-hidden"]`).should('not.be.checked');

// toggle is employed
cy.get(`[data-testid="test-toggle-employedToggle"]`).click({ force: true });
cy.get('#form-edit-employed-contract').select('alt');
cy.get('label[for="ent-toggle-employedToggle"]').click();

cy.get('#form-edit-employed-contract-container')
.should('be.visible')
.scrollIntoView()
.click()
.find('.option')
.contains('Alternance')
.click();
cy.get('#form-edit-employed-endOfContract').type('2024-03-03');
cy.contains('Valider').click();
cy.wait('@putCandidatParams');
cy.get(`[data-testid="test-toggle-employedToggle"]`).should('be.checked');
cy.get(`[data-testid="test-toggle-employedToggle"]`)
.click({ force: true })
.should('not.be.checked');
cy.get('label[for="ent-toggle-employedToggle"]').click();
cy.get(`[data-testid="test-toggle-employedToggle"]`).should(
'not.be.checked'
);

// change password
cy.get('#form-change-pwd-oldPassword').type('blablabla', { force: true });
cy.get('#form-change-pwd-newPassword').type('Linkedout123!', {
force: true,
});
cy.get('#form-change-pwd-confirmPassword').type('Linkedout123!', {
force: true,
});
cy.get('#form-change-pwd-oldPassword').type('blablabla');
cy.get('#form-change-pwd-newPassword').type('Linkedout123!');
cy.get('#form-change-pwd-confirmPassword').type('Linkedout123!');
cy.contains('Modifier').click();
cy.wait('@changePwd');
});
Expand Down
Loading

0 comments on commit e0c79ba

Please sign in to comment.