Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • applications/etuc/hubl
  • applications/hubl
  • decentral1se/hubl
  • rngadam/hubl
  • jvtrudel/hubl
  • 3wc/hubl
6 results
Show changes
Showing
with 1122 additions and 46 deletions
/// <reference types="Cypress" />
/* globals cy, expect */
context('Create Project Browser Testing', () => {
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('Project Creation process #1', () => {
let projectName = 'Test Project ',
customerName = 'Test Customer ',
description = 'Test Description ';
it('should visit the project creation screen', () => {
cy.visit('/admin-projects-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-projects-create');
});
});
it('should enter correct project data', () => {
cy.randomNum().then(num => {
projectName += num;
customerName += num;
description += num;
cy.get('#admin-projects-create input[name="customer.name"]').clear().type(customerName);
cy.get('#admin-projects-create input[name="customer.name"]').should('have.value', customerName);
cy.get('#admin-projects-create input[name="name"]').clear().type(projectName);
cy.get('#admin-projects-create input[name="name"]').should('have.value', projectName);
cy.get('#admin-projects-create [name="description"] [contenteditable="true"]').clear().type(description);
cy.get('#admin-projects-create [name="description"] [contenteditable="true"]').should('have.value', description);
});
});
it('should click on create project button', () => {
cy.get('#admin-projects-create input[type="submit"]').click();
});
it('should land on projects list screen', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-projects');
});
});
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.visit('/admin-projects-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-projects-create');
});
});
it('should enter correct project data', () => {
cy.randomNum().then(num => {
projectName += num;
customerName += num;
description += num;
cy.get('#admin-projects-create input[name="customer.name"]').clear().type(customerName);
cy.get('#admin-projects-create input[name="customer.name"]').should('have.value', customerName);
cy.get('#admin-projects-create input[name="name"]').clear().type(projectName);
cy.get('#admin-projects-create input[name="name"]').should('have.value', projectName);
cy.get('#admin-projects-create [name="description"] [contenteditable="true"]').clear().type(description);
cy.get('#admin-projects-create [name="description"] [contenteditable="true"]').should('have.value', description);
});
});
it('should click on create project button', () => {
cy.get('#admin-projects-create input[type="submit"]').click();
});
it('should land on projects list screen', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-projects');
});
});
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");
});
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
// Unable to create an user without a community. Unable to create community from app
// context('Create User Browser Testing', () => {
// let firstName = 'First ',
// lastName = 'Last ',
// username = 'testuser_creation_',
// email = '';
// before(() => {
// cy.randomNum().then(num => {
// firstName += num;
// lastName += num;
// username += num;
// email = username + '@testemail.com';
// });
// 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 Creation process', () => {
// it('should visit the user creation screen', () => {
// cy.visit('/admin-users-create');
// cy.location().should((loc) => {
// expect(loc.pathname).to.eq('/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);
// cy.get('#admin-users-create input[name="last_name"]').clear().type(lastName);
// cy.get('#admin-users-create input[name="last_name"]').should('have.value', lastName);
// cy.get('#admin-users-create input[name="username"]').clear().type(username);
// cy.get('#admin-users-create input[name="username"]').should('have.value', username);
// cy.get('#admin-users-create input[name="email"]').clear().type(email);
// cy.get('#admin-users-create input[name="email"]').should('have.value', email);
// });
// it('should click on create user button', () => {
// cy.get('#admin-users-create input[type="submit"]').click();
// });
// it('should land on users list screen', () => {
// cy.location().should((loc) => {
// expect(loc.pathname).to.eq('/admin-users');
// });
// });
// it('should land newly created user on users list screen', () => {
// cy.contains('solid-display-value[name="name"]', firstName + ' ' + lastName).should("exist");
// cy.contains('solid-display-value[name="username"]', username).should("exist");
// });
// });
// });
/// <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.visit('/admin-circles');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-circles');
});
});
it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.visit('/circles/@' + id + '/circles-information');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circles/@' + id + '/circles-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('#circles-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('/circles/@' + id + '/circles-information');
});
}));
});
it('should check if channel was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(channelsLength - 1);
});
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Edit Channel Browser Testing', () => {
let channelName = 'Edited Test Channel ',
description = 'Edited Test Description ',
menuQuery = [
'solid-display.circle-tab',
'solid-display:last-child',
'solid-display[order-by="name"]'
];
before(() => {
cy.randomNum().then(num => {
channelName += 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());
it('should login', () => cy.login());
describe('Channel Edition process', () => {
it('should visit the channel list screen', () => {
cy.visit('/admin-circles');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-circles');
});
});
it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.visit('/circles/@' + id + '/circles-information/circles-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circles/@' + id + '/circles-information/circles-edit');
});
}));
});
it('should enter new channel data', () => {
cy.get('#circles-edit input[name="name"]').clear().type(channelName);
cy.get('#circles-edit input[name="name"]').should('have.value', channelName);
cy.get('#circles-edit input[name="description"]').clear().type(description);
cy.get('#circles-edit input[name="description"]').should('have.value', description);
});
it('should click button to save the channel', () => {
cy.get('#circles-edit input[value="Enregistrer"]').click();
});
it('should land on channel information 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('/circles/@' + id + '/circles-information');
});
}));
});
it('should show edited channel data on channel information screen', () => {
cy.contains('solid-display-value[name="name"]', channelName).should("exist");
cy.contains('solid-display-value[name="description"]', description).should("exist");
});
});
});
/// <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());
it('should login', () => cy.login());
describe('Job Offer Edition process', () => {
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.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', () => {
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 job offer data on job offer information screen', () => {
cy.contains('solid-display-value[name="title"]', jobTitle).should("exist");
cy.contains('solid-display-value[name="description"]', description).should("exist");
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Edit Project Browser Testing', () => {
let projectName = 'Edited Test Project ',
customerName = 'Edited Test Customer ',
description = 'Edited Test Description ',
menuQuery = [
'solid-display.project-tab',
'solid-display:last-child',
'solid-display[order-by="customer.name"]'
];
before(() => {
cy.randomNum().then(num => {
projectName += num;
customerName += 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());
it('should login', () => cy.login());
describe('Project Edition process', () => {
it('should visit the project list screen', () => {
cy.visit('/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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.visit('/projects/@' + id + '/projects-information/projects-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/projects/@' + id + '/projects-information/projects-edit');
});
}));
});
it('should enter new project data', () => {
cy.get('#projects-edit input[name="customer.name"]').clear().type(customerName);
cy.get('#projects-edit input[name="customer.name"]').should('have.value', customerName);
cy.get('#projects-edit input[name="name"]').clear().type(projectName);
cy.get('#projects-edit input[name="name"]').should('have.value', projectName);
cy.get('#projects-edit textarea[name="description"]').clear().type(description);
cy.get('#projects-edit textarea[name="description"]').should('have.value', description);
});
it('should click button to save the project', () => {
cy.get('#projects-edit input[value="Enregistrer"]').click();
});
it('should land on project information 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('/projects/@' + id + '/projects-information');
});
}));
});
it('should show edited project data on project information screen', () => {
cy.contains('solid-display-value[name="customer.name"]', customerName).should("exist");
cy.contains('solid-display-value[name="name"]', projectName).should("exist");
});
});
});
/// <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.visit('/members/members-edit-profile');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/members/members-edit-profile');
});
});
/// Workaround - Routing bug - user won't land on edit profile screen
it('should navigate to user edit screen', () => {
cy.get('#members-my-profile solid-link[next="members-edit-profile"]').click();
});
/// End workaround
it('should enter new user data', () => {
cy.get('#members-edit-profile input[name="first_name"]').clear().type(userFirstName);
cy.get('#members-edit-profile input[name="first_name"]').should('have.value', userFirstName);
cy.get('#members-edit-profile input[name="last_name"]').clear().type(userLastName);
cy.get('#members-edit-profile input[name="last_name"]').should('have.value', userLastName);
cy.get('#members-edit-profile textarea[name="profile.job"]').clear().type(jobDescription);
cy.get('#members-edit-profile textarea[name="profile.job"]').should('have.value', jobDescription);
cy.get('#members-edit-profile input[name="profile.city"]').clear().type(city);
cy.get('#members-edit-profile input[name="profile.city"]').should('have.value', city);
cy.get('#members-edit-profile input[name="profile.phone"]').clear().type(phone);
cy.get('#members-edit-profile input[name="profile.phone"]').should('have.value', phone);
cy.get('#members-edit-profile input[name="profile.website"]').clear().type(website);
cy.get('#members-edit-profile input[name="profile.website"]').should('have.value', website);
});
it('should click button to save the user', () => {
cy.get('#members-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('/members');
/// 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('directory-link-tel a', phone).should("exist");
cy.contains('directory-website a', website).should("exist");
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Leave Channel Browser Testing', () => {
let tableQuery = [
'solid-display.table-body',
'solid-display:last-child',
'orbit-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.visit('/admin-circles');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-circles');
});
});
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 channel was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.channelsLength - 1);
});
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Leave Project Browser Testing', () => {
let tableQuery = [
'solid-display.table-body',
'solid-display:last-child',
'orbit-admin-project-leave-button',
'solid-delete'
],
tableListQuery = [
'solid-display[nested-field="projects"]',
'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('Project Leaving process', () => {
it('should visit the projects list screen', () => {
cy.visit('/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-projects');
});
});
it('should click the last project leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('projectsLength');
cy.get(tableQuery.join(' ')).click();
});
it('should check if project was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.projectsLength - 1);
});
});
});
});
/// <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.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);
});
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);
});
});*/
});
});
/// <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.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);
});
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="profile.job"]').clear().type(listingJob);
cy.get(filtersQuery.join(' ') + '[name="profile.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="profile.job"]').clear();
cy.get(filtersQuery.join(' ') + '[name="profile.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="profile.city"]').clear().type(listingCity);
cy.get(filtersQuery.join(' ') + '[name="profile.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="profile.city"]').clear();
cy.get(filtersQuery.join(' ') + '[name="profile.city"]').should('have.value', '');
});
it('should get previous listing count', () => {
cy.get(listingCountQuery.join(' ')).invoke('text').then(text => {
expect(text).to.eq(listingCount);
});
});
});
});
/// <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.visit('/admin-circles');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-circles');
});
});
it('should visit the last channel edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.visit('/circles/@' + id + '/circles-information/circles-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/circles/@' + id + '/circles-information/circles-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('/circles/@' + id + '/circles-information/circles-edit');
});
}));
});
it('should check if channel was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(channelsLength - 1);
});
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Retire Project Browser Testing', () => {
let menuQuery = [
'solid-display.project-tab',
'solid-display:last-child',
'solid-display[order-by="customer.name"]'
],
menuCountQuery = [
'solid-display.project-tab',
'solid-display',
'solid-display[order-by="customer.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('Project Retirement process', () => {
let projectsLength;
it('should visit the projects list screen', () => {
cy.visit('/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/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.visit('/projects/@' + id + '/projects-information/projects-edit');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/projects/@' + id + '/projects-information/projects-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', () => {
cy.get('solid-multiple[name="members"] 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('/projects/@' + id + '/projects-information/projects-edit');
});
}));
});
it('should check if project was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(projectsLength - 1);
});
});
});
});
/// <reference types="Cypress" />
/* globals cy, expect */
context('Browser testing', () => {
before(() => {
cy.clearLocalStorage({ domain: null});
cy.clearCookies({ domain: null });
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null});
cy.clearCookies({ domain: null });
});
it('should visit user login screen', () => cy.userLogin());
describe('Login process', () => {
it('should write "admin" on username field and "password" on password field', () => {
cy.get('#id_username').type('admin');
cy.get('#id_username').should('have.value', 'admin');
cy.get('#id_password').type('password');
cy.get('#id_password').should('have.value', 'password');
});
it('should click on login button', () => {
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
});
it('visit the homepage', () => {
cy.visit('/');
it('should provide an error, username and password mismatch.', () => {
cy.get('.error').should('contain.text', 'Ton nom d\'utilisateur et ton mot de passe ne correspondent pas. Réessaye.');
});
it('should await for an user login', () => {
it('should write "admin" on password field then press the login button', () => {
cy.get('#id_password').type('admin');
cy.get('#id_password').should('have.value', 'admin');
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
});
it('should ask for user permission to access their datas.', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/auth/login/');
expect(loc.pathname).to.eq('/authorize');
});
cy.get('.accept-button').click();
});
describe('Login process', () => {
it('should write "admin" on username field and "password" on password field', () => {
cy.get('#id_username').type('admin');
cy.get('#id_username').should('have.value', 'admin');
cy.get('#id_password').type('password');
cy.get('#id_password').should('have.value', 'password');
});
it('should click on login button', () => {
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
});
it('should provide an error, username and password mismatch.', () => {
cy.get('.error').should('contain.text', 'Ton nom d\'utilisateur et ton mot de passe ne correspondent pas. Réessaye.')
});
it('should write "admin" on password field then press the login button', () => {
cy.get('#id_password').type('admin');
cy.get('#id_password').should('have.value', 'admin');
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
});
it('should ask for user permission to access their datas.', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/authorize')
});
cy.get('.accept-button').click();
});
// it('should redirect the user to the app.', () => {
// cy.get('.accept-button').click();
// cy.location().should((loc) => {
......@@ -48,46 +42,46 @@ context('Browser testing', () => {
// });
// describe('Main interface', () => {
// // it('should show my name on top right', () => {
// // cy.get('sib-display-value').contains('Admin');
// // cy.get('solid-display-value').contains('Admin');
// // });
// it('should show my username on the left menu', () => {
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > sib-display-div > div').contains('admin');
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').contains('admin');
// });
// it('should open a chat with myself', () => {
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > sib-display-div > div').click();
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').click();
// cy.get('.name').contains('admin');
// });
// it('should not work, because I have no Prosody configured', () => {
// cy.get('.content-box > .chat-view > sib-chat').should('be.empty');
// cy.get('.content-box > .chat-view > solid-xmpp-chat').should('be.empty');
// });
// describe('Circles', () => {
// it('should navigate the Administration from left menu', () => {
// cy.get('.create > sib-link').click();
// cy.get('.create > solid-link').click();
// cy.get('#admin-circles > .content-box > .content-box__header > .without-margin').contains('Administration');
// cy.get('#admin-circle-list > .content-box__info > .admin-header > .admin-header__title').contains('Circles');
// cy.get('#admin-circles > .content-box__info > .admin-header > .admin-header__title').contains('Circles');
// });
// it('should navigate to Circle creation', () => {
// cy.get('#admin-circle-list > .content-box__info > .admin-header > .button').click();
// cy.get('#admin-circles > .content-box__info > .admin-header > .button').click();
// cy.location().should((loc) => {
// expect(loc.pathname).to.contain('admin-circle-create');
// expect(loc.pathname).to.contain('admin-circles-create');
// });
// });
// var name = new Uint32Array(1);
// crypto.getRandomValues(name);
// name = "Test Circle " + name;
// it('should allow Circle Creation', () => {
// cy.get('form > sib-form-label-text[name="name"] > label > input').type(name);
// cy.get('.content-box__info > sib-form > form > sib-form-label-text[name="description"] > label > input').type('With a great description!');
// cy.get('#admin-circle-create > .content-box__info > sib-form > form > [type="submit"]').click();
// cy.get('#admin-circle-list > div > div.table > sib-display').contains(name);
// cy.get('form > solid-form-label-text[name="name"] > label > input').type(name);
// cy.get('.content-box__info > solid-form > form > solid-form-label-text[name="description"] > label > input').type('With a great description!');
// cy.get('#admin-circles-create > .content-box__info > solid-form > form > [type="submit"]').click();
// cy.get('#admin-circles > div > div.table > solid-display').contains(name);
// });
// it('should open the circle information page', () => {
// cy.screenshot();
// cy.get('#navbar-router').contains(name).click();
// cy.get('[name="circle-information"] > li').click();
// cy.get('[name="circles-information"] > li').click();
// });
// it('should delete the circle', () => {
// cy.get('.box-button > sib-ac-checker > .button').click();
// cy.get('.box-button > solid-ac-checker > .button').click();
// cy.get('#navbar-router').should('not.contain', name);
// });
// });
......@@ -103,6 +97,5 @@ context('Browser testing', () => {
// expect(loc.pathname).to.eq('/auth/login/');
// });
// });
});
});
});
/// <reference types="Cypress" />
/* globals cy */
context('Signup Browser Testing', () => {
let username = 'testuser_creation_',
email = '',
password = 'testpwd';
before(() => {
cy.randomNum().then(num => {
username += num;
email = username + '@testemail.com';
});
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
it('should visit user login screen', () => cy.userLogin());
describe('Signup process', () => {
it('should click on signup page link', () => {
cy.get('.sib-link.sib-register-link').click();
});
it('should write incorrect user data', () => {
cy.get('#id_username').type('!"#$%&');
cy.get('#id_username').should('have.value', '!"#$%&');
cy.get('#id_email').type(email.split('.')[0]);
cy.get('#id_email').should('have.value', email.split('.')[0]);
cy.get('#id_password1').type(password + 'wrong1');
cy.get('#id_password1').should('have.value', password + 'wrong1');
cy.get('#id_password2').type(password + 'wrong2');
cy.get('#id_password2').should('have.value', password + 'wrong2');
});
it('should click on signup button', () => {
cy.get('.sib-registration-btn').click();
});
it('should provide errors about incorrect user data', () => {
cy.get('tbody tr:nth-child(1) ul.errorlist li')
.should('contain.text', 'Enter a valid username. This value may contain only letters, numbers, and ./+/-/_ characters.');
cy.get('tbody tr:nth-child(2) ul.errorlist li')
.should('contain.text', 'Enter a valid email address.');
cy.get('tbody tr:nth-child(4) ul.errorlist li')
.should('contain.text', 'The two password fields didn\'t match.');
});
it('should write correct user data', () => {
cy.get('#id_username').clear().type(username);
cy.get('#id_username').should('have.value', username);
cy.get('#id_email').clear().type(email);
cy.get('#id_email').should('have.value', email);
cy.get('#id_password1').clear().type(password);
cy.get('#id_password1').should('have.value', password);
cy.get('#id_password2').clear().type(password);
cy.get('#id_password2').should('have.value', password);
});
it('should click on signup button', () => {
cy.get('.sib-registration-btn').click();
});
it('should show email confirmation dialog', () => {
cy.contains('h1.text-center', 'Un e-mail d\'activation a été envoyé.').should("exist");
cy.contains('p.text-center', 'Vérifie ta boite mail et clique sur le lien pour activer ton compte.').should("exist");
});
});
});
{
"username": "admin",
"password": "admin"
}
\ No newline at end of file
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// require('cypress-terminal-report').installPlugin(on);
};
......@@ -23,3 +23,50 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
/* globals Cypress, cy, expect */
import 'cypress-localstorage-commands';
Cypress.Commands.add('login', () => {
cy.fixture('admin.json').then(admin => {
cy.get('#id_username').type(admin.username);
cy.get('#id_username').should('have.value', admin.username);
cy.get('#id_password').type(admin.password);
cy.get('#id_password').should('have.value', admin.password);
cy.get('.connection-btn').click();
cy.location('pathname').should('include', '/authorize');
cy.get('.accept-button').click();
cy.location().should(location => {
expect(location.pathname).to.eq('/');
});
});
});
Cypress.Commands.add('userLogin', () => {
cy.visit('/');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/auth/login/');
});
});
Cypress.Commands.add('encodeUrl', url => {
const encodeIdReplacement = [
['~', '~~'],
['.', '~!'],
[':', '~@'],
['/', '~_'],
];
encodeIdReplacement.forEach(([char, repl]) => {
url = url.split(char).join(repl);
});
return url;
});
Cypress.Commands.add('randomNum', () => {
return Math.floor(1000 + Math.random() * 9000);
});
Cypress.Commands.add('nextYear', increment => {
return new Date().getFullYear() + ( increment || 1 );
});
......@@ -13,8 +13,10 @@
// https://on.cypress.io/configuration
// ***********************************************************
/* globals Cypress */
// Import commands.js using ES2015 syntax:
import './commands'
import './commands';
//require('cypress-terminal-report').installSupport();
......@@ -27,4 +29,9 @@ Cypress.on('uncaught:exception', (err, runnable) => {
return false;
});
Cypress.on('fail', () => Cypress.runner.abort())
Cypress.on('fail', (error) => {
console.log(error);
if ( typeof Cypress.runner.abort == 'function' ) {
Cypress.runner.abort();
}
});
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"authority": "$SERVER",
"authorityName": "djangoldp-server-name",
"publicDirectory": true,
"endpoints": {
"get": {
"circles": "$SERVER/circles/",
"dashboards": "$SERVER/dashboards/",
"groups": "$SERVER/groups/",
"users": "$SERVER/users/",
"skills": "$SERVER/skills/",
"uploads": "$SERVER/upload/"
},
"post": {
"circles": "$SERVER/circles/",
"dashboards": "$SERVER/dashboards/",
"groups": "$SERVER/groups/",
"users": "$SERVER/users/",
"skills": "$SERVER/skills/",
"uploads": "$SERVER/upload/"
}
}
}