update: wrapping up and final adjustments to completed test flows

This commit is contained in:
Jure Ursic 2020-07-16 15:50:16 +02:00
parent 564e8d71da
commit c548add236
16 changed files with 607 additions and 114 deletions

54
cypress/README.md Normal file
View File

@ -0,0 +1,54 @@
## Users:
```
- signin
- signup
- create
- listing
- edit
// TO-FIX: Uncomment workaround (blocked by: nested routing bug)
```
## Job Offers:
```
- create
- edit
- listing
// TO-FIX: Search by title and description (blocked by: no search fields available)
- post
// TO-DO: Entire flow (blocked by: no published / unpublished flag)
```
## Channels:
```
- create
- edit
- leave
- retire
- delete
- join
// TO-DO: Join other user created project (blocked by: can't create new user to create a channel)
- invite
// TO-DO
```
## Projects:
```
- create
- edit
- leave
- retire
- delete
// TO-DO: Delete a project (blocked by: no option to delete a project)
- join
// TO-DO: Join other user created project (blocked by: can't create new user to create a project)
- invite
// TO-DO
```
## Breakdown:
```
DONE: 15
TO-FIX: 2
BLOCKED: 4
NOT DONE: 2
```

View File

@ -2,13 +2,7 @@
/* globals cy, expect */ /* globals cy, expect */
context('Create Channel Browser Testing', () => { context('Create Channel Browser Testing', () => {
let channelName = 'Test Channel ',
description = 'Test Description ';
before(() => { before(() => {
cy.randomNum().then(num => {
channelName += num;
description += num;
});
cy.clearLocalStorageSnapshot(); cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
@ -16,28 +10,78 @@ context('Create Channel Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Channel Creation process', () => { it('should login', () => cy.login());
it('should login', () => cy.login()); describe('Channel Creation process #1', () => {
let channelName = 'Test Channel ',
description = 'Test Description ';
it('should visit the channel creation screen', () => cy.naviagte('/admin/admin-circle-create')); it('should visit the channel creation screen', () => cy.naviagte('/admin/admin-circle-create'));
/*it('should enter incorrect channel data', () => { it('should enter correct channel data', () => {
cy.get('#admin-circle-create input[name="name"]').type('!"#$%&'); cy.randomNum().then(num => {
cy.get('#admin-circle-create input[name="name"]').should('have.value', '!"#$%&'); channelName += num;
cy.get('#admin-circle-create input[name="description"]').type(description); description += num;
cy.get('#admin-circle-create input[name="description"]').should('have.value', description); cy.get('#admin-circle-create input[name="name"]').clear().type(channelName);
cy.get('#admin-circle-create input[name="name"]').should('have.value', channelName);
cy.get('#admin-circle-create input[name="description"]').clear().type(description);
cy.get('#admin-circle-create input[name="description"]').should('have.value', description);
});
}); });
it('should click on create channel button', () => { it('should click on create channel button', () => {
cy.get('#admin-circle-create input[type="submit"]').click(); cy.get('#admin-circle-create input[type="submit"]').click();
}); });
it('should provide errors about incorrect channel data', () => { it('should land on channels list screen', () => {
// TO-DO: Check for error messages cy.location().should((loc) => {
cy.get('element') expect(loc.pathname).to.eq('/admin');
.should('contain.text', 'Error message.'); });
});*/ });
it('should land newly created channel on channels list screen', () => {
cy.contains('solid-display-value[name="circle.name"]', channelName).should("exist");
cy.fixture('admin.json').then(admin => {
cy.contains('solid-display-value[name="username"]', admin.username).should("exist");
});
});
});
describe('Channel Creation process #2', () => {
let channelName = 'Test Channel ',
description = 'Test Description ';
it('should visit the channel creation screen', () => cy.naviagte('/admin/admin-circle-create'));
it('should enter correct channel data', () => { it('should enter correct channel data', () => {
cy.get('#admin-circle-create input[name="name"]').clear().type(channelName); cy.randomNum().then(num => {
cy.get('#admin-circle-create input[name="name"]').should('have.value', channelName); channelName += num;
cy.get('#admin-circle-create input[name="description"]').clear().type(description); description += num;
cy.get('#admin-circle-create input[name="description"]').should('have.value', description); cy.get('#admin-circle-create input[name="name"]').clear().type(channelName);
cy.get('#admin-circle-create input[name="name"]').should('have.value', channelName);
cy.get('#admin-circle-create input[name="description"]').clear().type(description);
cy.get('#admin-circle-create input[name="description"]').should('have.value', description);
});
});
it('should click on create channel button', () => {
cy.get('#admin-circle-create input[type="submit"]').click();
});
it('should land on channels list screen', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin');
});
});
it('should land newly created channel on channels list screen', () => {
cy.contains('solid-display-value[name="circle.name"]', channelName).should("exist");
cy.fixture('admin.json').then(admin => {
cy.contains('solid-display-value[name="username"]', admin.username).should("exist");
});
});
});
describe('Channel Creation process #3', () => {
let channelName = 'Test Channel ',
description = 'Test Description ';
it('should visit the channel creation screen', () => cy.naviagte('/admin/admin-circle-create'));
it('should enter correct channel data', () => {
cy.randomNum().then(num => {
channelName += num;
description += num;
cy.get('#admin-circle-create input[name="name"]').clear().type(channelName);
cy.get('#admin-circle-create input[name="name"]').should('have.value', channelName);
cy.get('#admin-circle-create input[name="description"]').clear().type(description);
cy.get('#admin-circle-create input[name="description"]').should('have.value', description);
});
}); });
it('should click on create channel button', () => { it('should click on create channel button', () => {
cy.get('#admin-circle-create input[type="submit"]').click(); cy.get('#admin-circle-create input[type="submit"]').click();

View File

@ -20,25 +20,9 @@ context('Create Job Offer Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Job Offer Creation process', () => { 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 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', () => { 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"]').clear().type(jobDate);
cy.get('#job-offers-create input[name="closingDate"]').should('have.value', jobDate); cy.get('#job-offers-create input[name="closingDate"]').should('have.value', jobDate);

View File

@ -2,15 +2,7 @@
/* globals cy, expect */ /* globals cy, expect */
context('Create Project Browser Testing', () => { context('Create Project Browser Testing', () => {
let projectName = 'Test Project ',
customerName = 'Test Customer ',
description = 'Test Description ';
before(() => { before(() => {
cy.randomNum().then(num => {
projectName += num;
customerName += num;
description += num;
});
cy.clearLocalStorageSnapshot(); cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
@ -18,32 +10,57 @@ context('Create Project Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Project Creation process', () => { it('should login', () => cy.login());
it('should login', () => cy.login()); describe('Project Creation process #1', () => {
let projectName = 'Test Project ',
customerName = 'Test Customer ',
description = 'Test Description ';
it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects/admin-project-create')); it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects/admin-project-create'));
/*it('should enter incorrect project data', () => { it('should enter correct project data', () => {
cy.get('#admin-project-create input[name="customer.name"]').type('!"#$%&'); cy.randomNum().then(num => {
cy.get('#admin-project-create input[name="customer.name"]').should('have.value', '!"#$%&'); projectName += num;
cy.get('#admin-project-create input[name="name"]').type('!"#$%&'); customerName += num;
cy.get('#admin-project-create input[name="name"]').should('have.value', '!"#$%&'); description += num;
cy.get('#admin-project-create textarea[name="description"]').type(description); cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName);
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description); cy.get('#admin-project-create input[name="customer.name"]').should('have.value', customerName);
cy.get('#admin-project-create input[name="name"]').clear().type(projectName);
cy.get('#admin-project-create input[name="name"]').should('have.value', projectName);
cy.get('#admin-project-create textarea[name="description"]').clear().type(description);
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description);
});
}); });
it('should click on create project button', () => { it('should click on create project button', () => {
cy.get('#admin-project-create input[type="submit"]').click(); cy.get('#admin-project-create input[type="submit"]').click();
}); });
it('should provide errors about incorrect project data', () => { it('should land on projects list screen', () => {
// TO-DO: Check for error messages cy.location().should((loc) => {
cy.get('element') expect(loc.pathname).to.eq('/admin/admin-projects');
.should('contain.text', 'Error message.'); });
});*/ });
it('should land newly created project on projects list screen', () => {
cy.contains('solid-display-value[name="project.name"]', projectName).should("exist");
cy.fixture('admin.json').then(admin => {
cy.contains('solid-display-value[name="username"]', admin.username).should("exist");
});
});
});
describe('Project Creation process #2', () => {
let projectName = 'Test Project ',
customerName = 'Test Customer ',
description = 'Test Description ';
it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects/admin-project-create'));
it('should enter correct project data', () => { it('should enter correct project data', () => {
cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName); cy.randomNum().then(num => {
cy.get('#admin-project-create input[name="customer.name"]').should('have.value', customerName); projectName += num;
cy.get('#admin-project-create input[name="name"]').clear().type(projectName); customerName += num;
cy.get('#admin-project-create input[name="name"]').should('have.value', projectName); description += num;
cy.get('#admin-project-create textarea[name="description"]').clear().type(description); cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName);
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description); cy.get('#admin-project-create input[name="customer.name"]').should('have.value', customerName);
cy.get('#admin-project-create input[name="name"]').clear().type(projectName);
cy.get('#admin-project-create input[name="name"]').should('have.value', projectName);
cy.get('#admin-project-create textarea[name="description"]').clear().type(description);
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description);
});
}); });
it('should click on create project button', () => { it('should click on create project button', () => {
cy.get('#admin-project-create input[type="submit"]').click(); cy.get('#admin-project-create input[type="submit"]').click();

View File

@ -20,27 +20,9 @@ context('Create User Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('User Creation process', () => { describe('User Creation process', () => {
it('should login', () => cy.login());
it('should visit the user creation screen', () => cy.naviagte('/admin/admin-users/admin-users-create')); it('should visit the user creation screen', () => cy.naviagte('/admin/admin-users/admin-users-create'));
/*it('should enter incorrect user data', () => {
cy.get('#admin-users-create input[name="first_name"]').type(firstName);
cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);
cy.get('#admin-users-create input[name="last_name"]').type(lastName);
cy.get('#admin-users-create input[name="last_name"]').should('have.value', lastName);
cy.get('#admin-users-create input[name="username"]').type('!"#$%&');
cy.get('#admin-users-create input[name="username"]').should('have.value', '!"#$%&');
cy.get('#admin-users-create input[name="email"]').type(email.split('.')[0]);
cy.get('#admin-users-create input[name="email"]').should('have.value', email.split('.')[0]);
});
it('should click on create user button', () => {
cy.get('#admin-users-create input[type="submit"]').click();
});
it('should provide errors about incorrect user data', () => {
// TO-DO: Check for error messages
cy.get('element')
.should('contain.text', 'Error message.');
});*/
it('should enter correct user data', () => { it('should enter correct user data', () => {
cy.get('#admin-users-create input[name="first_name"]').clear().type(firstName); cy.get('#admin-users-create input[name="first_name"]').clear().type(firstName);
cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName); cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);

View File

@ -0,0 +1,55 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Delete Channel Browser Testing', () => {
let menuQuery = [
'solid-display.circle-tab',
'solid-display:last-child',
'solid-display[order-by="name"]'
],
menuCountQuery = [
'solid-display.circle-tab',
'solid-display',
'solid-display[order-by="name"]'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Channel Retirement process', () => {
let channelsLength;
it('should visit the channels list screen', () => cy.naviagte('/admin'));
it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.naviagte('/circle/@' + id + '/circle-information');
}));
});
it('should count the number of joined channels', () => {
cy.get(menuCountQuery.join(' ')).its('length').then(length => channelsLength = length);
});
it('should click button to retire the channel', () => {
cy.get('#circle-profile solid-delete[data-label="Supprimer le canal"] button').click();
});
it('should stay on channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information');
});
}));
});
it('should check if chennel was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(channelsLength - 1);
});
});
});
});

View File

@ -21,8 +21,8 @@ context('Edit Channel Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Channel Edition process', () => { describe('Channel Edition process', () => {
it('should login', () => cy.login());
it('should visit the channel list screen', () => cy.naviagte('/admin')); it('should visit the channel list screen', () => cy.naviagte('/admin'));
it('should visit the last channel edit screen', () => { it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' ')) cy.get(menuQuery.join(' '))

View File

@ -24,10 +24,10 @@ context('Edit Job Offer Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Job Offer Edition process', () => { 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 job offers list screen', () => cy.naviagte('/job-offers'));
it('should visit the last project edit screen', () => { it('should visit the last job offer edit screen', () => {
cy.get(menuQuery.join(' ')) cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src') .invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => { .then(url => cy.encodeUrl(url).then(id => {
@ -50,7 +50,7 @@ context('Edit Job Offer Browser Testing', () => {
expect(loc.pathname).to.eq('/job-offers'); expect(loc.pathname).to.eq('/job-offers');
}); });
}); });
it('should show edited project data on project information screen', () => { it('should show edited job offer data on job offer information screen', () => {
cy.contains('solid-display-value[name="title"]', jobTitle).should("exist"); cy.contains('solid-display-value[name="title"]', jobTitle).should("exist");
cy.contains('solid-display-value[name="description"]', description).should("exist"); cy.contains('solid-display-value[name="description"]', description).should("exist");
}); });

View File

@ -23,8 +23,8 @@ context('Edit Project Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Edition process', () => { describe('Project Edition process', () => {
it('should login', () => cy.login());
it('should visit the project list screen', () => cy.naviagte('/admin/admin-projects')); it('should visit the project list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the last project edit screen', () => { it('should visit the last project edit screen', () => {
cy.get(menuQuery.join(' ')) cy.get(menuQuery.join(' '))

View File

@ -0,0 +1,68 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Edit User Browser Testing', () => {
let userFirstName = 'Edited User First Name ',
userLastName = 'Edited User Last Name ',
jobDescription = 'Edited Job Description ',
city = 'Edited City ',
phone = '+1234',
website = 'https://test.site/';
before(() => {
cy.randomNum().then(num => {
userFirstName += num;
userLastName += num;
jobDescription += num;
city += num;
phone += num;
website += 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());
it('should login', () => cy.login());
describe('User Edition process', () => {
it('should visit the user edit screen', () => cy.naviagte('/profile/solid-profile-edit-profile'));
/// Workaround - Routing bug - user won't land on edit profile screen
it('should navigate to user edit screen', () => {
cy.get('#solid-profile-my-profile solid-link[next="solid-profile-edit-profile"]').click();
});
/// End workaround
it('should enter new user data', () => {
cy.get('#solid-profile-edit-profile input[name="first_name"]').clear().type(userFirstName);
cy.get('#solid-profile-edit-profile input[name="first_name"]').should('have.value', userFirstName);
cy.get('#solid-profile-edit-profile input[name="last_name"]').clear().type(userLastName);
cy.get('#solid-profile-edit-profile input[name="last_name"]').should('have.value', userLastName);
cy.get('#solid-profile-edit-profile textarea[name="profile.job"]').clear().type(jobDescription);
cy.get('#solid-profile-edit-profile textarea[name="profile.job"]').should('have.value', jobDescription);
cy.get('#solid-profile-edit-profile input[name="profile.city"]').clear().type(city);
cy.get('#solid-profile-edit-profile input[name="profile.city"]').should('have.value', city);
cy.get('#solid-profile-edit-profile input[name="profile.phone"]').clear().type(phone);
cy.get('#solid-profile-edit-profile input[name="profile.phone"]').should('have.value', phone);
cy.get('#solid-profile-edit-profile input[name="profile.website"]').clear().type(website);
cy.get('#solid-profile-edit-profile input[name="profile.website"]').should('have.value', website);
});
it('should click button to save the user', () => {
cy.get('#solid-profile-edit-profile input[value="ENREGISTRER"]').click();
});
it('should land on user information screen', () => {
cy.location().should(location => {
/// Workaround - Routing bug - route pathname won't be /profile as it should
expect(location.pathname).to.eq('/');
// expect(location.pathname).to.eq('/profile');
/// End workaround
});
});
it('should show edited user data on user information screen', () => {
cy.contains('solid-display-value[name="name"]', userFirstName + ' ' + userLastName).should("exist");
cy.contains('solid-display-value[name="profile.job"]', jobDescription).should("exist");
cy.contains('solid-display-value[name="profile.city"]', city).should("exist");
cy.contains('solid-display-tel[name="profile.phone"] a', phone).should("exist");
cy.contains('profile-website[name="profile.website"] a', website).should("exist");
});
});
});

View File

@ -0,0 +1,37 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Leave Channel Browser Testing', () => {
let tableQuery = [
'solid-display.table-body',
'solid-display:last-child',
'hubl-admin-circle-leave-button',
'solid-delete'
],
tableListQuery = [
'solid-display[nested-field="circles"]',
'div >',
'solid-display'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Channel Leaving process', () => {
it('should visit the channels list screen', () => cy.naviagte('/admin'));
it('should click the last channel leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('channelsLength');
cy.get(tableQuery.join(' ')).click();
});
it('should check if chennel was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.channelsLength - 1);
});
});
});
});

View File

@ -21,30 +21,17 @@ context('Leave Project Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin()); it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Leaving process', () => { describe('Project Leaving process', () => {
it('should login', () => cy.login());
it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects')); it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects'));
it('should click the last project leave button', () => { it('should click the last project leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('projectsLength'); cy.get(tableListQuery.join(' ')).its('length').as('projectsLength');
cy.get(tableQuery.join(' ')).click(); cy.get(tableQuery.join(' ')).click();
}); });
it('should check', () => { it('should check if project was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => { cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.projectsLength - 1); expect(length).to.eq(this.projectsLength - 1);
}); });
}); });
/*it('should click button to retire the project', () => {
cy.scrollTo('bottom');
cy.get('solid-delete[data-label="Retirer"] button').click();
});
it('should stay on project edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/project/@' + id + '/project-information/project-edit');
});
}));
});*/
}); });
}); });

View File

@ -0,0 +1,79 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('List Job Offers Browser Testing', () => {
let listQuery = 'solid-display.job-board__list',
filtersQuery = [
listQuery,
'solid-form',
'input'
],
listingCountQuery = [
listQuery,
'solid-display'
],
firstListingQuery = [
listQuery,
'solid-display:first-child',
'solid-display-value'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Job Offer Listing process', () => {
let listingTitle,
listingDesccription,
listingCount;
it('should visit the job offers listing screen', () => cy.naviagte('/job-offers'));
it('should get the listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => listingCount = length);
});
it('should get the first job offer listing data', () => {
cy.get(firstListingQuery.join(' ') + '[name="title"]').invoke('text').then(text => listingTitle = text);
cy.get(firstListingQuery.join(' ') + '[name="description"]').invoke('text').then(text => listingDesccription = text);
});
// TO-DO: Search by title and description
/*it('should filter the listing by first name', () => {
cy.get(filtersQuery.join(' ') + '[name="title"]').clear().type(listingTitle);
cy.get(filtersQuery.join(' ') + '[name="title"]').should('have.value', listingTitle);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => {
expect(length).to.eq(1);
});
});
it('should clear the first name filter', () => {
cy.get(filtersQuery.join(' ') + '[name="title"]').clear();
cy.get(filtersQuery.join(' ') + '[name="title"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => {
expect(length).to.eq(listingCount);
});
});
it('should filter the listing by first name', () => {
cy.get(filtersQuery.join(' ') + '[name="description"]').clear().type(listingDesccription);
cy.get(filtersQuery.join(' ') + '[name="description"]').should('have.value', listingDesccription);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => {
expect(length).to.eq(1);
});
});
it('should clear the first name filter', () => {
cy.get(filtersQuery.join(' ') + '[name="description"]').clear();
cy.get(filtersQuery.join(' ') + '[name="description"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => {
expect(length).to.eq(listingCount);
});
});*/
});
});

View File

@ -0,0 +1,119 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('List Users Browser Testing', () => {
let listQuery = 'solid-display#members-list__content',
filtersQuery = [
listQuery,
'solid-form',
'input'
],
listingCountQuery = [
listQuery,
'div:first-child',
'span'
],
firstListingQuery = [
listQuery,
'solid-display:first-child',
'solid-display-value'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('User Listing process', () => {
let listingFirstName,
listingLastName,
listingJob,
listingCity,
listingCount;
it('should visit the users listing screen', () => cy.naviagte('/members'));
it('should get the listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => listingCount = text);
});
it('should get the first user listing data', () => {
cy.get(firstListingQuery.join(' ') + '[name="first_name"]').invoke('text').then(text => listingFirstName = text);
cy.get(firstListingQuery.join(' ') + '[name="last_name"]').invoke('text').then(text => listingLastName = text);
cy.get(firstListingQuery.join(' ') + '[name="profile.job"]').invoke('text').then(text => listingJob = text);
cy.get(firstListingQuery.join(' ') + '[name="profile.city"]').invoke('text').then(text => listingCity = text);
});
it('should filter the listing by first name', () => {
cy.get(filtersQuery.join(' ') + '[name="name"]').clear().type(listingFirstName);
cy.get(filtersQuery.join(' ') + '[name="name"]').should('have.value', listingFirstName);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq('1 membres');
});
});
it('should clear the first name filter', () => {
cy.get(filtersQuery.join(' ') + '[name="name"]').clear();
cy.get(filtersQuery.join(' ') + '[name="name"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq(listingCount);
});
});
it('should filter the listing by last name', () => {
cy.get(filtersQuery.join(' ') + '[name="name"]').clear().type(listingLastName);
cy.get(filtersQuery.join(' ') + '[name="name"]').should('have.value', listingLastName);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq('1 membres');
});
});
it('should clear the last name filter', () => {
cy.get(filtersQuery.join(' ') + '[name="name"]').clear();
cy.get(filtersQuery.join(' ') + '[name="name"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq(listingCount);
});
});
it('should filter the listing by job description', () => {
cy.get(filtersQuery.join(' ') + '[name="member-job"]').clear().type(listingJob);
cy.get(filtersQuery.join(' ') + '[name="member-job"]').should('have.value', listingJob);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq('1 membres');
});
});
it('should clear the job description filter', () => {
cy.get(filtersQuery.join(' ') + '[name="member-job"]').clear();
cy.get(filtersQuery.join(' ') + '[name="member-job"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq(listingCount);
});
});
it('should filter the listing by city', () => {
cy.get(filtersQuery.join(' ') + '[name="member-city"]').clear().type(listingCity);
cy.get(filtersQuery.join(' ') + '[name="member-city"]').should('have.value', listingCity);
});
it('should get filtered listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq('1 membres');
});
});
it('should clear the city filter', () => {
cy.get(filtersQuery.join(' ') + '[name="member-city"]').clear();
cy.get(filtersQuery.join(' ') + '[name="member-city"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq(listingCount);
});
});
});
});

View File

@ -0,0 +1,55 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Retire Channel Browser Testing', () => {
let menuQuery = [
'solid-display.circle-tab',
'solid-display:last-child',
'solid-display[order-by="name"]'
],
menuCountQuery = [
'solid-display.circle-tab',
'solid-display',
'solid-display[order-by="name"]'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Channel Retirement process', () => {
let channelsLength;
it('should visit the channels list screen', () => cy.naviagte('/admin'));
it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.naviagte('/circle/@' + id + '/circle-information/circle-edit');
}));
});
it('should count the number of joined channels', () => {
cy.get(menuCountQuery.join(' ')).its('length').then(length => channelsLength = length);
});
it('should click button to retire the channel', () => {
cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click();
});
it('should stay on channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information/circle-edit');
});
}));
});
it('should check if chennel was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(channelsLength - 1);
});
});
});
});

View File

@ -3,10 +3,15 @@
context('Retire Project Browser Testing', () => { context('Retire Project Browser Testing', () => {
let menuQuery = [ let menuQuery = [
'solid-display.project-tab', 'solid-display.project-tab',
'solid-display:last-child', 'solid-display:last-child',
'solid-display[order-by="customer.name"]' 'solid-display[order-by="customer.name"]'
]; ],
menuCountQuery = [
'solid-display.project-tab',
'solid-display',
'solid-display[order-by="customer.name"]'
];
before(() => { before(() => {
cy.clearLocalStorageSnapshot(); cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
@ -15,8 +20,9 @@ context('Retire Project Browser Testing', () => {
beforeEach(() => cy.restoreLocalStorage()); beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage()); afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin()); it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Retirement process', () => { describe('Project Retirement process', () => {
it('should login', () => cy.login()); let projectsLength;
it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects')); it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the last project edit screen', () => { it('should visit the last project edit screen', () => {
cy.get(menuQuery.join(' ')) cy.get(menuQuery.join(' '))
@ -25,9 +31,11 @@ context('Retire Project Browser Testing', () => {
cy.naviagte('/project/@' + id + '/project-information/project-edit'); cy.naviagte('/project/@' + id + '/project-information/project-edit');
})); }));
}); });
it('should count the number of joined projects', () => {
cy.get(menuCountQuery.join(' ')).its('length').then(length => projectsLength = length);
});
it('should click button to retire the project', () => { it('should click button to retire the project', () => {
cy.scrollTo('bottom'); cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click();
cy.get('solid-delete[data-label="Retirer"] button').click();
}); });
it('should stay on project edit screen', () => { it('should stay on project edit screen', () => {
cy.get(menuQuery.join(' ')) cy.get(menuQuery.join(' '))
@ -38,6 +46,10 @@ context('Retire Project Browser Testing', () => {
}); });
})); }));
}); });
// TO-DO: clearify what needs to happen after and do the checks it('should check if project was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(projectsLength - 1);
});
});
}); });
}); });