cy: no more naviagte

This commit is contained in:
Jean-Baptiste Pasquier 2020-09-17 13:08:44 +02:00
parent 9a0beef4fb
commit 4ab6ab9764
16 changed files with 133 additions and 32 deletions

View File

@ -14,7 +14,12 @@ context('Create Channel Browser Testing', () => {
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.visit('/admin/admin-circle-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-circle-create');
});
});
it('should enter correct channel data', () => {
cy.randomNum().then(num => {
channelName += num;
@ -43,7 +48,12 @@ context('Create Channel Browser Testing', () => {
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 visit the channel creation screen', () => {
cy.visit('/admin/admin-circle-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-circle-create');
});
});
it('should enter correct channel data', () => {
cy.randomNum().then(num => {
channelName += num;
@ -72,7 +82,12 @@ context('Create Channel Browser Testing', () => {
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 visit the channel creation screen', () => {
cy.visit('/admin/admin-circle-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-circle-create');
});
});
it('should enter correct channel data', () => {
cy.randomNum().then(num => {
channelName += num;

View File

@ -22,7 +22,12 @@ context('Create Job Offer Browser Testing', () => {
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Job Offer Creation process', () => {
it('should visit the job offer creation screen', () => cy.naviagte('/job-offers/job-offers-create'));
it('should visit the job offer creation screen', () => {
cy.visit('/job-offers/job-offers-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/job-offers/job-offers-create');
});
});
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);

View File

@ -15,7 +15,12 @@ context('Create Project Browser Testing', () => {
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.visit('/admin/admin-projects/admin-project-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects/admin-project-create');
});
});
it('should enter correct project data', () => {
cy.randomNum().then(num => {
projectName += num;
@ -48,7 +53,12 @@ context('Create Project Browser Testing', () => {
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.visit('/admin/admin-projects/admin-project-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects/admin-project-create');
});
});
it('should enter correct project data', () => {
cy.randomNum().then(num => {
projectName += num;

View File

@ -22,7 +22,12 @@ context('Create User Browser Testing', () => {
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('User Creation process', () => {
it('should visit the user creation screen', () => cy.naviagte('/admin/admin-users/admin-users-create'));
it('should visit the user creation screen', () => {
cy.visit('/admin/admin-users/admin-users-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-users/admin-users-create');
});
});
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"]').should('have.value', firstName);

View File

@ -23,12 +23,20 @@ context('Delete Channel Browser Testing', () => {
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 channels list screen', () => {
cy.visit('/admin');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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');
cy.visit('/circle/@' + id + '/circle-information');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information');
});
}));
});
it('should count the number of joined channels', () => {

View File

@ -23,12 +23,20 @@ context('Edit Channel Browser Testing', () => {
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Channel Edition process', () => {
it('should visit the channel list screen', () => cy.naviagte('/admin'));
it('should visit the channel list screen', () => {
cy.visit('/admin');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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');
cy.visit('/circle/@' + id + '/circle-information/circle-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information/circle-edit');
});
}));
});
it('should enter new channel data', () => {

View File

@ -26,12 +26,20 @@ context('Edit Job Offer Browser Testing', () => {
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Job Offer Edition process', () => {
it('should visit the job offers list screen', () => cy.naviagte('/job-offers'));
it('should visit the job offers list screen', () => {
cy.visit('/job-offers');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/job-offers');
});
});
it('should visit the last job offer 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);
cy.visit('/job-offers/job-offers-edit/@' + id);
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/job-offers/job-offers-edit/@' + id);
});
}));
});
it('should enter new job offer data', () => {

View File

@ -25,12 +25,20 @@ context('Edit Project Browser Testing', () => {
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Edition process', () => {
it('should visit the project list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the project list screen', () => {
cy.visit('/admin/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects');
});
});
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('/project/@' + id + '/project-information/project-edit');
.then(url => cy.encodeUrl(url).then(id => {{
cy.visit('/project/@' + id + '/project-information/project-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/project/@' + id + '/project-information/project-edit');
});
}));
});
it('should enter new project data', () => {

View File

@ -26,7 +26,12 @@ context('Edit User Browser Testing', () => {
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'));
it('should visit the user edit screen', () => {
cy.visit('/profile/solid-profile-edit-profile');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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();

View File

@ -23,7 +23,12 @@ context('Leave Channel Browser Testing', () => {
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 visit the channels list screen', () => {
cy.visit('/admin');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin');
});
});
it('should click the last channel leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('channelsLength');
cy.get(tableQuery.join(' ')).click();

View File

@ -23,7 +23,12 @@ context('Leave Project Browser Testing', () => {
it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Leaving process', () => {
it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the projects list screen', () => {
cy.visit('/admin/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects');
});
});
it('should click the last project leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('projectsLength');
cy.get(tableQuery.join(' ')).click();

View File

@ -30,7 +30,12 @@ context('List Job Offers Browser Testing', () => {
let listingTitle,
listingDesccription,
listingCount;
it('should visit the job offers listing screen', () => cy.naviagte('/job-offers'));
it('should visit the job offers listing screen', () => {
cy.visit('/job-offers');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/job-offers');
});
});
it('should get the listing count', () => {
cy.get(listingCountQuery.join(' ')).its('length').then(length => listingCount = length);
});

View File

@ -33,7 +33,12 @@ context('List Users Browser Testing', () => {
listingJob,
listingCity,
listingCount;
it('should visit the users listing screen', () => cy.naviagte('/members'));
it('should visit the users listing screen', () => {
cy.visit('/members');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/members');
});
});
it('should get the listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => listingCount = text);
});

View File

@ -23,12 +23,20 @@ context('Retire Channel Browser Testing', () => {
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 channels list screen', () => {
cy.visit('/admin');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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');
cy.visit('/circle/@' + id + '/circle-information/circle-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information/circle-edit');
});
}));
});
it('should count the number of joined channels', () => {

View File

@ -23,12 +23,20 @@ context('Retire Project Browser Testing', () => {
it('should login', () => cy.login());
describe('Project Retirement process', () => {
let projectsLength;
it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the projects list screen', () => {
cy.visit('/admin/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects');
});
});
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('/project/@' + id + '/project-information/project-edit');
cy.visit('/project/@' + id + '/project-information/project-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/project/@' + id + '/project-information/project-edit');
});
}));
});
it('should count the number of joined projects', () => {

View File

@ -43,13 +43,6 @@ Cypress.Commands.add('login', () => {
});
});
Cypress.Commands.add('naviagte', route => {
cy.visit(route);
cy.location().should((loc) => {
expect(loc.pathname).to.eq(route);
});
});
Cypress.Commands.add('userLogin', () => {
cy.visit('/');
cy.location().should((loc) => {