From e5e2815f0d484fd3b28278c05a895e585f3aee60 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Tue, 30 Jun 2020 14:27:20 +0200 Subject: [PATCH 01/22] feature: User creattion and signup test flows --- cypress/integration/create-user.spec.js | 79 +++++++++++++++++++++++++ cypress/integration/signup.spec.js | 59 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 cypress/integration/create-user.spec.js create mode 100644 cypress/integration/signup.spec.js diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js new file mode 100644 index 0000000..2670ba8 --- /dev/null +++ b/cypress/integration/create-user.spec.js @@ -0,0 +1,79 @@ +/// +/* globals cy, expect */ + +context('Creat User Browser Testing', () => { + const firstName = 'First', + lastName = 'Last', + username = 'testuser_creation_' + Math.floor(1000 + Math.random() * 9000), + email = username + '@testemail.com'; + before(() => { + cy.clearLocalStorage({ domain: null}); + cy.clearCookies({ domain: null }); + }); + it('visit the homepage', () => { + cy.visit('/'); + }); + it('should await for an user login', () => { + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/auth/login/'); + }); + }); + describe('User Creation process', () => { + it('should login', () => { + cy.get('#id_username').type('admin'); + cy.get('#id_username').should('have.value', 'admin'); + cy.get('#id_password').type('admin'); + cy.get('#id_password').should('have.value', 'admin'); + cy.get('.connection-btn').click(); + cy.get('.accept-button').click(); + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/'); + }); + }); + 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'); + }); + // Workaround - seems to be a bug when accessing the route directly + cy.get('.accept-button').click(); + // End workaround + }); + /*it('should enter erroneous user data and submit', () => { + 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 erroneous user data', () => { + // TO-DO: Check for error messages + cy.get('element') + .should('contain.text', 'Error message.'); + });*/ + it('should enter user data and submit', () => { + 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/admin-users'); + }); + }); + }); +}); diff --git a/cypress/integration/signup.spec.js b/cypress/integration/signup.spec.js new file mode 100644 index 0000000..4a77c44 --- /dev/null +++ b/cypress/integration/signup.spec.js @@ -0,0 +1,59 @@ +/// +/* globals cy, expect */ + +context('Signup Browser Testing', () => { + const username = 'testuser_signup_' + Math.floor(1000 + Math.random() * 9000), + email = username + '@testemail.com', + password = 'testpwd'; + before(() => { + cy.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('visit the homepage', () => { + cy.visit('/'); + }); + it('should await for an user login', () => { + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/auth/login/'); + }); + }); + describe('Signup process', () => { + it('should click on signup page link', () => { + cy.get('.sib-link.sib-register-link').click(); + }); + it('should write erroneous 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 erroneous 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(); + }); + }); +}); From 8b84de7b37eeca6991eb2c0a6bdd30923a2c38a8 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Fri, 3 Jul 2020 19:25:23 +0200 Subject: [PATCH 02/22] feature: user, project, channel and job offer create test flows and project, channel and job offer edit test flows --- cypress/fixtures/admin.json | 4 ++ cypress/integration/create-channel.spec.js | 58 +++++++++++++++++ cypress/integration/create-job-offer.spec.js | 64 +++++++++++++++++++ cypress/integration/create-project.spec.js | 64 +++++++++++++++++++ cypress/integration/create-user.spec.js | 59 +++++++---------- cypress/integration/edit-channel.spec.js | 58 +++++++++++++++++ cypress/integration/edit-job-offer.spec.js | 59 +++++++++++++++++ cypress/integration/edit-project.spec.js | 62 ++++++++++++++++++ cypress/integration/retire-project.spec.js | 35 ++++++++++ .../{tests.spec.js => signin.spec.js} | 60 ++++++++--------- cypress/integration/signup.spec.js | 29 +++++---- cypress/support/commands.js | 55 ++++++++++++++++ cypress/support/index.js | 15 +++-- 13 files changed, 533 insertions(+), 89 deletions(-) create mode 100644 cypress/fixtures/admin.json create mode 100644 cypress/integration/create-channel.spec.js create mode 100644 cypress/integration/create-job-offer.spec.js create mode 100644 cypress/integration/create-project.spec.js create mode 100644 cypress/integration/edit-channel.spec.js create mode 100644 cypress/integration/edit-job-offer.spec.js create mode 100644 cypress/integration/edit-project.spec.js create mode 100644 cypress/integration/retire-project.spec.js rename cypress/integration/{tests.spec.js => signin.spec.js} (70%) diff --git a/cypress/fixtures/admin.json b/cypress/fixtures/admin.json new file mode 100644 index 0000000..fb25ded --- /dev/null +++ b/cypress/fixtures/admin.json @@ -0,0 +1,4 @@ +{ + "username": "admin", + "password": "admin" +} \ No newline at end of file diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js new file mode 100644 index 0000000..8a89d97 --- /dev/null +++ b/cypress/integration/create-channel.spec.js @@ -0,0 +1,58 @@ +/// +/* globals cy, expect */ + +context('Create Channel Browser Testing', () => { + let channelName = 'Test Channel ', + description = 'Test Description '; + before(() => { + cy.randomNum().then(num => { + channelName += num; + description += num; + }); + cy.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + describe('Channel Creation process', () => { + it('should login', () => cy.login()); + it('should visit the channel creation screen', () => cy.naviagte('/admin/admin-circle-create')); + /*it('should enter incorrect channel data', () => { + cy.get('#admin-circle-create input[name="name"]').type('!"#$%&'); + cy.get('#admin-circle-create input[name="name"]').should('have.value', '!"#$%&'); + cy.get('#admin-circle-create input[name="description"]').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 provide errors about incorrect channel data', () => { + // TO-DO: Check for error messages + cy.get('element') + .should('contain.text', 'Error message.'); + });*/ + it('should enter correct channel data', () => { + 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'); + }); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + 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"); + }); + }); + }); +}); diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js new file mode 100644 index 0000000..f968154 --- /dev/null +++ b/cypress/integration/create-job-offer.spec.js @@ -0,0 +1,64 @@ +/// +/* globals cy, expect */ + +context('Create Job Offer Browser Testing', () => { + let jobDate = '', + jobTitle = 'Test Job Offer ', + description = 'Test Description '; + before(() => { + cy.nextYear(1).then(year => { + jobDate = year + '-12-31'; + }); + cy.randomNum().then(num => { + jobTitle += num; + description += num; + }); + cy.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + describe('Job Offer Creation process', () => { + it('should login', () => cy.login()); + it('should visit the job offer creation screen', () => cy.naviagte('/job-offers/job-offers-create')); + /*it('should enter incorrect job offer data', () => { + cy.get('#job-offers-create input[name="closingDate"]').type('!"#$%&'); + cy.get('#job-offers-create input[name="closingDate"]').should('have.value', '!"#$%&'); + cy.get('#job-offers-create input[name="title"]').type('!"#$%&'); + cy.get('#job-offers-create input[name="title"]').should('have.value', '!"#$%&'); + cy.get('#job-offers-create textarea[name="description"]').type(description); + cy.get('#job-offers-create textarea[name="description"]').should('have.value', description); + }); + it('should click on create job offer button', () => { + cy.get('#job-offers-create input[type="submit"]').click(); + }); + it('should provide errors about incorrect job offer data', () => { + // TO-DO: Check for error messages + cy.get('element') + .should('contain.text', 'Error message.'); + });*/ + it('should enter correct job offer data', () => { + cy.get('#job-offers-create input[name="closingDate"]').clear().type(jobDate); + cy.get('#job-offers-create input[name="closingDate"]').should('have.value', jobDate); + cy.get('#job-offers-create input[name="title"]').clear().type(jobTitle); + cy.get('#job-offers-create input[name="title"]').should('have.value', jobTitle); + cy.get('#job-offers-create textarea[name="description"]').clear().type(description); + cy.get('#job-offers-create textarea[name="description"]').should('have.value', description); + }); + it('should click on create job offer button', () => { + cy.get('#job-offers-create input[type="submit"]').click(); + }); + it('should land on job offers list screen', () => { + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/job-offers'); + }); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + it('should land newly created job offer on job offers list screen', () => { + cy.contains('solid-display-value[name="title"]', jobTitle).should("exist"); + cy.contains('solid-display-value[name="description"]', description).should("exist"); + }); + }); +}); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js new file mode 100644 index 0000000..65af225 --- /dev/null +++ b/cypress/integration/create-project.spec.js @@ -0,0 +1,64 @@ +/// +/* globals cy, expect */ + +context('Create Project Browser Testing', () => { + let projectName = 'Test Project ', + customerName = 'Test Customer ', + description = 'Test Description '; + before(() => { + cy.randomNum().then(num => { + projectName += num; + customerName += num; + description += num; + }); + cy.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + describe('Project Creation process', () => { + it('should login', () => cy.login()); + it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects/admin-project-create')); + /*it('should enter incorrect project data', () => { + cy.get('#admin-project-create input[name="customer.name"]').type('!"#$%&'); + cy.get('#admin-project-create input[name="customer.name"]').should('have.value', '!"#$%&'); + cy.get('#admin-project-create input[name="name"]').type('!"#$%&'); + cy.get('#admin-project-create input[name="name"]').should('have.value', '!"#$%&'); + cy.get('#admin-project-create textarea[name="description"]').type(description); + cy.get('#admin-project-create textarea[name="description"]').should('have.value', description); + }); + it('should click on create project button', () => { + cy.get('#admin-project-create input[type="submit"]').click(); + }); + it('should provide errors about incorrect project data', () => { + // TO-DO: Check for error messages + cy.get('element') + .should('contain.text', 'Error message.'); + });*/ + it('should enter correct project data', () => { + cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName); + 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', () => { + cy.get('#admin-project-create input[type="submit"]').click(); + }); + it('should land on projects list screen', () => { + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/admin/admin-projects'); + }); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + 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"); + }); + }); + }); +}); diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index 2670ba8..b6dc322 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -1,45 +1,26 @@ /// /* globals cy, expect */ -context('Creat User Browser Testing', () => { - const firstName = 'First', - lastName = 'Last', - username = 'testuser_creation_' + Math.floor(1000 + Math.random() * 9000), - email = username + '@testemail.com'; +context('Create User Browser Testing', () => { + let firstName = 'First ', + lastName = 'Last ', + username = 'testuser_creation_', + email = ''; before(() => { - cy.clearLocalStorage({ domain: null}); + cy.randomNum().then(num => { + firstName += num; + lastName += num; + username += num; + email = username + '@testemail.com'; + }); + cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - it('visit the homepage', () => { - cy.visit('/'); - }); - it('should await for an user login', () => { - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/auth/login/'); - }); - }); + it('should visit user login screen', () => cy.userLogin()); describe('User Creation process', () => { - it('should login', () => { - cy.get('#id_username').type('admin'); - cy.get('#id_username').should('have.value', 'admin'); - cy.get('#id_password').type('admin'); - cy.get('#id_password').should('have.value', 'admin'); - cy.get('.connection-btn').click(); - cy.get('.accept-button').click(); - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/'); - }); - }); - 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'); - }); - // Workaround - seems to be a bug when accessing the route directly - cy.get('.accept-button').click(); - // End workaround - }); - /*it('should enter erroneous user data and submit', () => { + it('should login', () => cy.login()); + 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); @@ -52,12 +33,12 @@ context('Creat User Browser Testing', () => { it('should click on create user button', () => { cy.get('#admin-users-create input[type="submit"]').click(); }); - it('should provide errors about erroneous user data', () => { + 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 user data and submit', () => { + 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); @@ -75,5 +56,9 @@ context('Creat User Browser Testing', () => { expect(loc.pathname).to.eq('/admin/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"); + }); }); }); diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js new file mode 100644 index 0000000..32a702a --- /dev/null +++ b/cypress/integration/edit-channel.spec.js @@ -0,0 +1,58 @@ +/// +/* 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.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + describe('Channel Edition process', () => { + it('should login', () => cy.login()); + it('should visit the channel 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 enter new channel data', () => { + cy.get('#circle-edit input[name="name"]').clear().type(channelName); + cy.get('#circle-edit input[name="name"]').should('have.value', channelName); + cy.get('#circle-edit input[name="description"]').clear().type(description); + cy.get('#circle-edit input[name="description"]').should('have.value', description); + }); + it('should click button to save the channel', () => { + cy.get('#circle-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('/circle/@' + id + '/circle-information'); + }); + })); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + 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"); + }); + }); +}); diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js new file mode 100644 index 0000000..10a7b27 --- /dev/null +++ b/cypress/integration/edit-job-offer.spec.js @@ -0,0 +1,59 @@ +/// +/* 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.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + 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 last project 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); + })); + }); + 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'); + }); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + it('should show edited project data on project information screen', () => { + cy.contains('solid-display-value[name="title"]', jobTitle).should("exist"); + cy.contains('solid-display-value[name="description"]', description).should("exist"); + }); + }); +}); diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js new file mode 100644 index 0000000..e7a532d --- /dev/null +++ b/cypress/integration/edit-project.spec.js @@ -0,0 +1,62 @@ +/// +/* 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.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + 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 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'); + })); + }); + it('should enter new project data', () => { + cy.get('#project-edit input[name="customer.name"]').clear().type(customerName); + cy.get('#project-edit input[name="customer.name"]').should('have.value', customerName); + cy.get('#project-edit input[name="name"]').clear().type(projectName); + cy.get('#project-edit input[name="name"]').should('have.value', projectName); + cy.get('#project-edit textarea[name="description"]').clear().type(description); + cy.get('#project-edit textarea[name="description"]').should('have.value', description); + }); + it('should click button to save the project', () => { + cy.get('#project-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('/project/@' + id + '/project-information'); + }); + })); + // Workaround - component reactivity bug + cy.reload(); + cy.get('.accept-button').click(); + // End workaround + }); + 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"); + }); + }); +}); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js new file mode 100644 index 0000000..0584d6e --- /dev/null +++ b/cypress/integration/retire-project.spec.js @@ -0,0 +1,35 @@ +/// +/* globals cy, expect */ + +context('Retire Project Browser Testing', () => { + before(() => { + cy.clearLocalStorage({ domain: null }); + cy.clearCookies({ domain: null }); + }); + it('should visit user login screen', () => cy.userLogin()); + describe('Project Retirement process', () => { + it('should login', () => cy.login()); + it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects')); + it('should visit the last project edit screen', () => { + cy.get('solid-display[widget-project="hubl-menu-fix-url-project"][fields="project"]:last-child solid-display') + .invoke('attr', 'data-src') + .then(url => cy.encodeUrl(url).then(id => { + cy.naviagte('/project/@' + id + '/project-information/project-edit'); + })); + }); + 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('solid-display[widget-project="hubl-menu-fix-url-project"]:last-child solid-display') + .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'); + }); + })); + }); + // TO-DO: ceraify what needs to happen after and do the checks + }); +}); diff --git a/cypress/integration/tests.spec.js b/cypress/integration/signin.spec.js similarity index 70% rename from cypress/integration/tests.spec.js rename to cypress/integration/signin.spec.js index ba53571..62e1265 100644 --- a/cypress/integration/tests.spec.js +++ b/cypress/integration/signin.spec.js @@ -1,43 +1,36 @@ /// - +/* globals cy, expect */ context('Browser testing', () => { - before(() => { - cy.clearLocalStorage({ domain: null}); - cy.clearCookies({ domain: null }); + before(() => { + 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('visit the homepage', () => { - cy.visit('/'); + it('should click on login button', () => { + cy.get(':nth-child(1) > .flex-column > [type="submit"]').click(); }); - it('should await for an user login', () => { + 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('/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) => { @@ -103,6 +96,5 @@ context('Browser testing', () => { // expect(loc.pathname).to.eq('/auth/login/'); // }); // }); - }); }); - +}); diff --git a/cypress/integration/signup.spec.js b/cypress/integration/signup.spec.js index 4a77c44..9597980 100644 --- a/cypress/integration/signup.spec.js +++ b/cypress/integration/signup.spec.js @@ -1,27 +1,24 @@ /// -/* globals cy, expect */ +/* globals cy */ context('Signup Browser Testing', () => { - const username = 'testuser_signup_' + Math.floor(1000 + Math.random() * 9000), - email = username + '@testemail.com', - password = 'testpwd'; + let username = 'testuser_creation_', + email = '', + password = 'testpwd'; before(() => { + cy.randomNum().then(num => { + username += num; + email = username + '@testemail.com'; + }); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - it('visit the homepage', () => { - cy.visit('/'); - }); - it('should await for an user login', () => { - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/auth/login/'); - }); - }); + 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 erroneous user data', () => { + 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]); @@ -34,7 +31,7 @@ context('Signup Browser Testing', () => { it('should click on signup button', () => { cy.get('.sib-registration-btn').click(); }); - it('should provide errors about erroneous user data', () => { + 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') @@ -55,5 +52,9 @@ context('Signup Browser Testing', () => { 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"); + }); }); }); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index ca4d256..1450915 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -23,3 +23,58 @@ // // -- This will overwrite an existing command -- // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) + +/* globals Cypress, cy, expect */ + +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.get('.accept-button').click(); + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/'); + }); + }); +}); + +Cypress.Commands.add('naviagte', route => { + cy.visit(route); + cy.location().should((loc) => { + expect(loc.pathname).to.eq(route); + }); + // Workaround - seems to be a bug when accessing the route directly + cy.get('.accept-button').click(); + cy.wait(2000); + // End workaround +}); + +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 ); +}); diff --git a/cypress/support/index.js b/cypress/support/index.js index 92fa6f5..cc8bcf0 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -13,10 +13,12 @@ // https://on.cypress.io/configuration // *********************************************************** -// Import commands.js using ES2015 syntax: -import './commands' +/* globals Cypress */ -//require('cypress-terminal-report').installSupport(); +// Import commands.js using ES2015 syntax: +import './commands'; + +require('cypress-terminal-report').installSupport(); // Alternatively you can use CommonJS syntax: // require('./commands') @@ -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(); + } +}); From 6f2a8aa877201831a59cdc4c811f9df06a0c1c9f Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Fri, 3 Jul 2020 19:27:55 +0200 Subject: [PATCH 03/22] feature: project retire test flow --- cypress/integration/retire-project.spec.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index 0584d6e..36daa5d 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -2,16 +2,21 @@ /* globals cy, expect */ context('Retire Project Browser Testing', () => { + let menuQuery = [ + 'solid-display.project-tab', + 'solid-display:last-child', + 'solid-display[order-by="customer.name"]' + ];; before(() => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - it('should visit user login screen', () => cy.userLogin()); + it('should visit user login screend', () => cy.userLogin()); describe('Project Retirement process', () => { it('should login', () => cy.login()); it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects')); it('should visit the last project edit screen', () => { - cy.get('solid-display[widget-project="hubl-menu-fix-url-project"][fields="project"]:last-child solid-display') + cy.get(menuQuery.join(' ')) .invoke('attr', 'data-src') .then(url => cy.encodeUrl(url).then(id => { cy.naviagte('/project/@' + id + '/project-information/project-edit'); @@ -22,7 +27,7 @@ context('Retire Project Browser Testing', () => { cy.get('solid-delete[data-label="Retirer"] button').click(); }); it('should stay on project edit screen', () => { - cy.get('solid-display[widget-project="hubl-menu-fix-url-project"]:last-child solid-display') + cy.get(menuQuery.join(' ')) .invoke('attr', 'data-src') .then(url => cy.encodeUrl(url).then(id => { cy.location().should((loc) => { @@ -30,6 +35,6 @@ context('Retire Project Browser Testing', () => { }); })); }); - // TO-DO: ceraify what needs to happen after and do the checks + // TO-DO: clearify what needs to happen after and do the checks }); }); From 2da9de541422a7eeb92b1c8adeec8e532cf32fd8 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Fri, 3 Jul 2020 19:40:42 +0200 Subject: [PATCH 04/22] fix: comment out terminal report --- cypress/support/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/support/index.js b/cypress/support/index.js index cc8bcf0..c1a0001 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -18,7 +18,7 @@ // Import commands.js using ES2015 syntax: import './commands'; -require('cypress-terminal-report').installSupport(); +//require('cypress-terminal-report').installSupport(); // Alternatively you can use CommonJS syntax: // require('./commands') From ff41638e2b10df5483819a19fb8c5efcd5ec7a20 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Wed, 8 Jul 2020 14:03:44 +0200 Subject: [PATCH 05/22] update: background user token persistance --- cypress/integration/create-channel.spec.js | 1 + cypress/integration/create-job-offer.spec.js | 1 + cypress/integration/create-project.spec.js | 1 + cypress/integration/create-user.spec.js | 1 + cypress/integration/edit-channel.spec.js | 1 + cypress/integration/edit-job-offer.spec.js | 1 + cypress/integration/edit-project.spec.js | 1 + cypress/integration/retire-project.spec.js | 1 + cypress/support/commands.js | 11 +++++++---- 9 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js index 8a89d97..ba1eaaf 100644 --- a/cypress/integration/create-channel.spec.js +++ b/cypress/integration/create-channel.spec.js @@ -12,6 +12,7 @@ context('Create Channel Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js index f968154..1c5b225 100644 --- a/cypress/integration/create-job-offer.spec.js +++ b/cypress/integration/create-job-offer.spec.js @@ -16,6 +16,7 @@ context('Create Job Offer Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js index 65af225..77652c6 100644 --- a/cypress/integration/create-project.spec.js +++ b/cypress/integration/create-project.spec.js @@ -14,6 +14,7 @@ context('Create Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Project Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index b6dc322..f2d9416 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -16,6 +16,7 @@ context('Create User Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('User Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js index 32a702a..03f3fc5 100644 --- a/cypress/integration/edit-channel.spec.js +++ b/cypress/integration/edit-channel.spec.js @@ -17,6 +17,7 @@ context('Edit Channel Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js index 10a7b27..649a469 100644 --- a/cypress/integration/edit-job-offer.spec.js +++ b/cypress/integration/edit-job-offer.spec.js @@ -20,6 +20,7 @@ context('Edit Job Offer Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index e7a532d..31482bb 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -19,6 +19,7 @@ context('Edit Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Project Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index 36daa5d..102f0a5 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -11,6 +11,7 @@ context('Retire Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screend', () => cy.userLogin()); describe('Project Retirement process', () => { it('should login', () => cy.login()); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 1450915..6700e64 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -36,19 +36,22 @@ Cypress.Commands.add('login', () => { cy.get('.accept-button').click(); cy.location().should((loc) => { expect(loc.pathname).to.eq('/'); + cy.wrap(Cypress.localStorage.getItem('solid-auth-client')).as('currentUser'); }); }); }); +Cypress.Commands.add('setToken', () => { + if ( this.currentUser ) { + Cypress.localStorage.setItem('solid-auth-client', this.currentUser); + } +}); + Cypress.Commands.add('naviagte', route => { cy.visit(route); cy.location().should((loc) => { expect(loc.pathname).to.eq(route); }); - // Workaround - seems to be a bug when accessing the route directly - cy.get('.accept-button').click(); - cy.wait(2000); - // End workaround }); Cypress.Commands.add('userLogin', () => { From 9a6ea85bbb8f60f57e527e9b882f46b203248ea1 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Wed, 8 Jul 2020 15:41:05 +0200 Subject: [PATCH 06/22] update: loccalStorage persistance using externallibrary --- cypress/integration/create-channel.spec.js | 8 +++----- cypress/integration/create-job-offer.spec.js | 8 +++----- cypress/integration/create-project.spec.js | 8 +++----- cypress/integration/create-user.spec.js | 4 +++- cypress/integration/edit-channel.spec.js | 8 +++----- cypress/integration/edit-job-offer.spec.js | 8 +++----- cypress/integration/edit-project.spec.js | 8 +++----- cypress/integration/retire-project.spec.js | 6 ++++-- cypress/integration/signin.spec.js | 1 + cypress/integration/signup.spec.js | 1 + cypress/support/commands.js | 14 +++++--------- package-lock.json | 6 ++++++ package.json | 1 + 13 files changed, 39 insertions(+), 42 deletions(-) diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js index ba1eaaf..7dda64b 100644 --- a/cypress/integration/create-channel.spec.js +++ b/cypress/integration/create-channel.spec.js @@ -9,10 +9,12 @@ context('Create Channel Browser Testing', () => { channelName += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Creation process', () => { it('should login', () => cy.login()); @@ -44,10 +46,6 @@ context('Create Channel Browser Testing', () => { cy.location().should((loc) => { expect(loc.pathname).to.eq('/admin'); }); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should land newly created channel on channels list screen', () => { cy.contains('solid-display-value[name="circle.name"]', channelName).should("exist"); diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js index 1c5b225..b4d6d43 100644 --- a/cypress/integration/create-job-offer.spec.js +++ b/cypress/integration/create-job-offer.spec.js @@ -13,10 +13,12 @@ context('Create Job Offer Browser Testing', () => { jobTitle += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Creation process', () => { it('should login', () => cy.login()); @@ -52,10 +54,6 @@ context('Create Job Offer Browser Testing', () => { cy.location().should((loc) => { expect(loc.pathname).to.eq('/job-offers'); }); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should land newly created job offer on job offers list screen', () => { cy.contains('solid-display-value[name="title"]', jobTitle).should("exist"); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js index 77652c6..9322c21 100644 --- a/cypress/integration/create-project.spec.js +++ b/cypress/integration/create-project.spec.js @@ -11,10 +11,12 @@ context('Create Project Browser Testing', () => { customerName += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Project Creation process', () => { it('should login', () => cy.login()); @@ -50,10 +52,6 @@ context('Create Project Browser Testing', () => { cy.location().should((loc) => { expect(loc.pathname).to.eq('/admin/admin-projects'); }); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should land newly created project on projects list screen', () => { cy.contains('solid-display-value[name="project.name"]', projectName).should("exist"); diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index f2d9416..1abd7a1 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -13,10 +13,12 @@ context('Create User Browser Testing', () => { username += num; email = username + '@testemail.com'; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('User Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js index 03f3fc5..ea53551 100644 --- a/cypress/integration/edit-channel.spec.js +++ b/cypress/integration/edit-channel.spec.js @@ -14,10 +14,12 @@ context('Edit Channel Browser Testing', () => { channelName += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Edition process', () => { it('should login', () => cy.login()); @@ -46,10 +48,6 @@ context('Edit Channel Browser Testing', () => { expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information'); }); })); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should show edited channel data on channel information screen', () => { cy.contains('solid-display-value[name="name"]', channelName).should("exist"); diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js index 649a469..53d6dca 100644 --- a/cypress/integration/edit-job-offer.spec.js +++ b/cypress/integration/edit-job-offer.spec.js @@ -17,10 +17,12 @@ context('Edit Job Offer Browser Testing', () => { jobTitle += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Edition process', () => { it('should login', () => cy.login()); @@ -47,10 +49,6 @@ context('Edit Job Offer Browser Testing', () => { cy.location().should((loc) => { expect(loc.pathname).to.eq('/job-offers'); }); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should show edited project data on project information screen', () => { cy.contains('solid-display-value[name="title"]', jobTitle).should("exist"); diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index 31482bb..42e1386 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -16,10 +16,12 @@ context('Edit Project Browser Testing', () => { customerName += num; description += num; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); describe('Project Edition process', () => { it('should login', () => cy.login()); @@ -50,10 +52,6 @@ context('Edit Project Browser Testing', () => { expect(loc.pathname).to.eq('/project/@' + id + '/project-information'); }); })); - // Workaround - component reactivity bug - cy.reload(); - cy.get('.accept-button').click(); - // End workaround }); it('should show edited project data on project information screen', () => { cy.contains('solid-display-value[name="customer.name"]', customerName).should("exist"); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index 102f0a5..e319d83 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -6,12 +6,14 @@ context('Retire Project Browser Testing', () => { 'solid-display.project-tab', 'solid-display:last-child', 'solid-display[order-by="customer.name"]' - ];; + ]; before(() => { + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); - beforeEach(() => cy.setToken()); + beforeEach(() => cy.restoreLocalStorage()); + afterEach(() => cy.saveLocalStorage()); it('should visit user login screend', () => cy.userLogin()); describe('Project Retirement process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/signin.spec.js b/cypress/integration/signin.spec.js index 62e1265..53457ed 100644 --- a/cypress/integration/signin.spec.js +++ b/cypress/integration/signin.spec.js @@ -3,6 +3,7 @@ context('Browser testing', () => { before(() => { + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null}); cy.clearCookies({ domain: null }); }); diff --git a/cypress/integration/signup.spec.js b/cypress/integration/signup.spec.js index 9597980..05ee1b8 100644 --- a/cypress/integration/signup.spec.js +++ b/cypress/integration/signup.spec.js @@ -10,6 +10,7 @@ context('Signup Browser Testing', () => { username += num; email = username + '@testemail.com'; }); + cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 6700e64..2ece0ad 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -26,6 +26,8 @@ /* 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); @@ -33,20 +35,14 @@ Cypress.Commands.add('login', () => { 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((loc) => { - expect(loc.pathname).to.eq('/'); - cy.wrap(Cypress.localStorage.getItem('solid-auth-client')).as('currentUser'); + cy.location().should(location => { + expect(location.pathname).to.eq('/'); }); }); }); -Cypress.Commands.add('setToken', () => { - if ( this.currentUser ) { - Cypress.localStorage.setItem('solid-auth-client', this.currentUser); - } -}); - Cypress.Commands.add('naviagte', route => { cy.visit(route); cy.location().should((loc) => { diff --git a/package-lock.json b/package-lock.json index f19ba14..5c89a88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1468,6 +1468,12 @@ } } }, + "cypress-localstorage-commands": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/cypress-localstorage-commands/-/cypress-localstorage-commands-1.2.1.tgz", + "integrity": "sha512-wWGElZS5fHAQDonZM8xtOA1tM+bTBUdwEMm6XrshLMKjq8Nxw4+Ysbl9/Yc+gZyv66EQe4hPNDLWANnp/zPkcA==", + "dev": true + }, "cypress-terminal-report": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/cypress-terminal-report/-/cypress-terminal-report-1.2.1.tgz", diff --git a/package.json b/package.json index 3792914..7f979d3 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ }, "devDependencies": { "cypress": "^4.5.0", + "cypress-localstorage-commands": "^1.2.1", "cypress-terminal-report": "^1.2.1" } } From a9f86520bb34d3ecf300a78c8905eb22e4172503 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Tue, 14 Jul 2020 16:11:54 +0200 Subject: [PATCH 07/22] feature: Leave project test flow --- .gitlab-ci.yml | 1 + cypress/integration/leave-project.spec.js | 50 ++++++++++++++++++++++ cypress/integration/retire-project.spec.js | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 cypress/integration/leave-project.spec.js diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a660e45..a17e7c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,6 +23,7 @@ build: stage: build before_script: - npm ci --cache .npm --prefer-offline --only=production + - npm i cypress-localstorage-commands script: - cp config.sample.json config.json - npm run build diff --git a/cypress/integration/leave-project.spec.js b/cypress/integration/leave-project.spec.js new file mode 100644 index 0000000..0ceef4c --- /dev/null +++ b/cypress/integration/leave-project.spec.js @@ -0,0 +1,50 @@ +/// +/* globals cy, expect */ + +context('Leave Project Browser Testing', () => { + let tableQuery = [ + 'solid-display.table-body', + 'solid-display:last-child', + 'hubl-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()); + describe('Project Leaving process', () => { + it('should login', () => cy.login()); + it('should visit the projects list screen', () => cy.naviagte('/admin/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', () => { + cy.get(tableListQuery.join(' ')).its('length').should(length => { + 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'); + }); + })); + });*/ + }); +}); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index e319d83..71d23b6 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -17,7 +17,7 @@ context('Retire Project Browser Testing', () => { it('should visit user login screend', () => cy.userLogin()); describe('Project Retirement process', () => { it('should login', () => cy.login()); - it('should visit the project creation 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', () => { cy.get(menuQuery.join(' ')) .invoke('attr', 'data-src') From c548add2360a1fe1c218b33871ad73583b82fa57 Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Thu, 16 Jul 2020 15:50:16 +0200 Subject: [PATCH 08/22] update: wrapping up and final adjustments to completed test flows --- cypress/README.md | 54 +++++++++ cypress/integration/create-channel.spec.js | 88 ++++++++++---- cypress/integration/create-job-offer.spec.js | 18 +-- cypress/integration/create-project.spec.js | 73 +++++++----- cypress/integration/create-user.spec.js | 20 +--- cypress/integration/delete-channel.spec.js | 55 +++++++++ cypress/integration/edit-channel.spec.js | 2 +- cypress/integration/edit-job-offer.spec.js | 6 +- cypress/integration/edit-project.spec.js | 2 +- cypress/integration/edit-user.spec.js | 68 +++++++++++ cypress/integration/leave-channel.spec.js | 37 ++++++ cypress/integration/leave-project.spec.js | 17 +-- cypress/integration/list-job-offers.spec.js | 79 ++++++++++++ cypress/integration/list-users.spec.js | 119 +++++++++++++++++++ cypress/integration/retire-channel.spec.js | 55 +++++++++ cypress/integration/retire-project.spec.js | 28 +++-- 16 files changed, 607 insertions(+), 114 deletions(-) create mode 100644 cypress/README.md create mode 100644 cypress/integration/delete-channel.spec.js create mode 100644 cypress/integration/edit-user.spec.js create mode 100644 cypress/integration/leave-channel.spec.js create mode 100644 cypress/integration/list-job-offers.spec.js create mode 100644 cypress/integration/list-users.spec.js create mode 100644 cypress/integration/retire-channel.spec.js diff --git a/cypress/README.md b/cypress/README.md new file mode 100644 index 0000000..3081ad7 --- /dev/null +++ b/cypress/README.md @@ -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 +``` diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js index 7dda64b..54d2d8a 100644 --- a/cypress/integration/create-channel.spec.js +++ b/cypress/integration/create-channel.spec.js @@ -2,13 +2,7 @@ /* globals cy, expect */ context('Create Channel Browser Testing', () => { - let channelName = 'Test Channel ', - description = 'Test Description '; before(() => { - cy.randomNum().then(num => { - channelName += num; - description += num; - }); cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); @@ -16,28 +10,78 @@ context('Create Channel Browser Testing', () => { beforeEach(() => cy.restoreLocalStorage()); afterEach(() => cy.saveLocalStorage()); 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 enter incorrect channel data', () => { - cy.get('#admin-circle-create input[name="name"]').type('!"#$%&'); - cy.get('#admin-circle-create input[name="name"]').should('have.value', '!"#$%&'); - cy.get('#admin-circle-create input[name="description"]').type(description); - cy.get('#admin-circle-create input[name="description"]').should('have.value', description); + 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', () => { cy.get('#admin-circle-create input[type="submit"]').click(); }); - it('should provide errors about incorrect channel data', () => { - // TO-DO: Check for error messages - cy.get('element') - .should('contain.text', 'Error message.'); - });*/ + 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 #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', () => { - 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); + 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', () => { + 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', () => { cy.get('#admin-circle-create input[type="submit"]').click(); diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js index b4d6d43..0940eaa 100644 --- a/cypress/integration/create-job-offer.spec.js +++ b/cypress/integration/create-job-offer.spec.js @@ -20,25 +20,9 @@ context('Create Job Offer Browser Testing', () => { beforeEach(() => cy.restoreLocalStorage()); afterEach(() => cy.saveLocalStorage()); it('should visit user login screen', () => cy.userLogin()); + it('should login', () => cy.login()); describe('Job Offer Creation process', () => { - it('should login', () => cy.login()); it('should visit the job offer creation screen', () => cy.naviagte('/job-offers/job-offers-create')); - /*it('should enter incorrect job offer data', () => { - cy.get('#job-offers-create input[name="closingDate"]').type('!"#$%&'); - cy.get('#job-offers-create input[name="closingDate"]').should('have.value', '!"#$%&'); - cy.get('#job-offers-create input[name="title"]').type('!"#$%&'); - cy.get('#job-offers-create input[name="title"]').should('have.value', '!"#$%&'); - cy.get('#job-offers-create textarea[name="description"]').type(description); - cy.get('#job-offers-create textarea[name="description"]').should('have.value', description); - }); - it('should click on create job offer button', () => { - cy.get('#job-offers-create input[type="submit"]').click(); - }); - it('should provide errors about incorrect job offer data', () => { - // TO-DO: Check for error messages - cy.get('element') - .should('contain.text', 'Error message.'); - });*/ it('should enter correct job offer data', () => { cy.get('#job-offers-create input[name="closingDate"]').clear().type(jobDate); cy.get('#job-offers-create input[name="closingDate"]').should('have.value', jobDate); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js index 9322c21..ba198c7 100644 --- a/cypress/integration/create-project.spec.js +++ b/cypress/integration/create-project.spec.js @@ -2,15 +2,7 @@ /* globals cy, expect */ context('Create Project Browser Testing', () => { - let projectName = 'Test Project ', - customerName = 'Test Customer ', - description = 'Test Description '; before(() => { - cy.randomNum().then(num => { - projectName += num; - customerName += num; - description += num; - }); cy.clearLocalStorageSnapshot(); cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); @@ -18,32 +10,57 @@ context('Create Project Browser Testing', () => { beforeEach(() => cy.restoreLocalStorage()); afterEach(() => cy.saveLocalStorage()); 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 enter incorrect project data', () => { - cy.get('#admin-project-create input[name="customer.name"]').type('!"#$%&'); - cy.get('#admin-project-create input[name="customer.name"]').should('have.value', '!"#$%&'); - cy.get('#admin-project-create input[name="name"]').type('!"#$%&'); - cy.get('#admin-project-create input[name="name"]').should('have.value', '!"#$%&'); - cy.get('#admin-project-create textarea[name="description"]').type(description); - cy.get('#admin-project-create textarea[name="description"]').should('have.value', description); + it('should enter correct project data', () => { + cy.randomNum().then(num => { + projectName += num; + customerName += num; + description += num; + cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName); + 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', () => { cy.get('#admin-project-create input[type="submit"]').click(); }); - it('should provide errors about incorrect project data', () => { - // TO-DO: Check for error messages - cy.get('element') - .should('contain.text', 'Error message.'); - });*/ + it('should land on projects list screen', () => { + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/admin/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.naviagte('/admin/admin-projects/admin-project-create')); it('should enter correct project data', () => { - cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName); - 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); + cy.randomNum().then(num => { + projectName += num; + customerName += num; + description += num; + cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName); + 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', () => { cy.get('#admin-project-create input[type="submit"]').click(); diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index 1abd7a1..f3fe42c 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -20,27 +20,9 @@ context('Create User Browser Testing', () => { 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 login', () => cy.login()); 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', () => { 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); diff --git a/cypress/integration/delete-channel.spec.js b/cypress/integration/delete-channel.spec.js new file mode 100644 index 0000000..e022546 --- /dev/null +++ b/cypress/integration/delete-channel.spec.js @@ -0,0 +1,55 @@ +/// +/* 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); + }); + }); + }); +}); diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js index ea53551..f0baa3b 100644 --- a/cypress/integration/edit-channel.spec.js +++ b/cypress/integration/edit-channel.spec.js @@ -21,8 +21,8 @@ context('Edit Channel Browser Testing', () => { 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 login', () => cy.login()); it('should visit the channel list screen', () => cy.naviagte('/admin')); it('should visit the last channel edit screen', () => { cy.get(menuQuery.join(' ')) diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js index 53d6dca..16c0f99 100644 --- a/cypress/integration/edit-job-offer.spec.js +++ b/cypress/integration/edit-job-offer.spec.js @@ -24,10 +24,10 @@ context('Edit Job Offer Browser Testing', () => { 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 login', () => cy.login()); 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(' ')) .invoke('attr', 'data-src') .then(url => cy.encodeUrl(url).then(id => { @@ -50,7 +50,7 @@ context('Edit Job Offer Browser Testing', () => { 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="description"]', description).should("exist"); }); diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index 42e1386..766c252 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -23,8 +23,8 @@ context('Edit Project Browser Testing', () => { 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 login', () => cy.login()); it('should visit the project list screen', () => cy.naviagte('/admin/admin-projects')); it('should visit the last project edit screen', () => { cy.get(menuQuery.join(' ')) diff --git a/cypress/integration/edit-user.spec.js b/cypress/integration/edit-user.spec.js new file mode 100644 index 0000000..ac29f41 --- /dev/null +++ b/cypress/integration/edit-user.spec.js @@ -0,0 +1,68 @@ +/// +/* 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"); + }); + }); +}); diff --git a/cypress/integration/leave-channel.spec.js b/cypress/integration/leave-channel.spec.js new file mode 100644 index 0000000..638eb58 --- /dev/null +++ b/cypress/integration/leave-channel.spec.js @@ -0,0 +1,37 @@ +/// +/* 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); + }); + }); + }); +}); diff --git a/cypress/integration/leave-project.spec.js b/cypress/integration/leave-project.spec.js index 0ceef4c..8c623fe 100644 --- a/cypress/integration/leave-project.spec.js +++ b/cypress/integration/leave-project.spec.js @@ -21,30 +21,17 @@ context('Leave Project Browser Testing', () => { 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 login', () => cy.login()); it('should visit the projects list screen', () => cy.naviagte('/admin/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', () => { + it('should check if project was left', () => { cy.get(tableListQuery.join(' ')).its('length').should(length => { 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'); - }); - })); - });*/ }); }); diff --git a/cypress/integration/list-job-offers.spec.js b/cypress/integration/list-job-offers.spec.js new file mode 100644 index 0000000..badf05d --- /dev/null +++ b/cypress/integration/list-job-offers.spec.js @@ -0,0 +1,79 @@ +/// +/* 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); + }); + });*/ + }); +}); diff --git a/cypress/integration/list-users.spec.js b/cypress/integration/list-users.spec.js new file mode 100644 index 0000000..9db3595 --- /dev/null +++ b/cypress/integration/list-users.spec.js @@ -0,0 +1,119 @@ +/// +/* 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); + }); + }); + }); +}); diff --git a/cypress/integration/retire-channel.spec.js b/cypress/integration/retire-channel.spec.js new file mode 100644 index 0000000..6f0a659 --- /dev/null +++ b/cypress/integration/retire-channel.spec.js @@ -0,0 +1,55 @@ +/// +/* 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); + }); + }); + }); +}); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index 71d23b6..a660395 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -3,10 +3,15 @@ context('Retire Project Browser Testing', () => { let menuQuery = [ - 'solid-display.project-tab', - 'solid-display:last-child', - 'solid-display[order-by="customer.name"]' - ]; + '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 }); @@ -15,8 +20,9 @@ context('Retire Project Browser Testing', () => { beforeEach(() => cy.restoreLocalStorage()); afterEach(() => cy.saveLocalStorage()); it('should visit user login screend', () => cy.userLogin()); + it('should login', () => cy.login()); 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 last project edit screen', () => { cy.get(menuQuery.join(' ')) @@ -25,9 +31,11 @@ context('Retire Project Browser Testing', () => { 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', () => { - cy.scrollTo('bottom'); - cy.get('solid-delete[data-label="Retirer"] button').click(); + cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click(); }); it('should stay on project edit screen', () => { 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); + }); + }); }); }); From 66b8b57f146d3f547863430c73bc84c536c3b38d Mon Sep 17 00:00:00 2001 From: Jure Ursic Date: Thu, 16 Jul 2020 16:07:25 +0200 Subject: [PATCH 09/22] fix: install cypress-localstorage-commands in the right place --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a17e7c9..eca06b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,6 @@ build: stage: build before_script: - npm ci --cache .npm --prefer-offline --only=production - - npm i cypress-localstorage-commands script: - cp config.sample.json config.json - npm run build @@ -45,6 +44,7 @@ test:e2e: before_script: # install missing dependencies - npm install -g sirv-cli + - npm install cypress-localstorage-commands # making sure the process is orphan - sirv dist --port 3000 > /dev/null 2>&1 & script: From 18bb5a53ee4aa40f928431768e9eaa0f205d4f16 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Tue, 15 Sep 2020 10:32:36 +0200 Subject: [PATCH 10/22] update: toggle the user list on chevron --- src/scripts/menu-toggle.js | 11 +++++++++++ src/styles/base/main.scss | 2 +- src/styles/base/menu-left.scss | 18 +++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/scripts/menu-toggle.js diff --git a/src/scripts/menu-toggle.js b/src/scripts/menu-toggle.js new file mode 100644 index 0000000..8f96670 --- /dev/null +++ b/src/scripts/menu-toggle.js @@ -0,0 +1,11 @@ +document.addEventListener("DOMContentLoaded", () => { + const menuWrappers = Array.from(document.querySelectorAll(".menu-wrapper")); + + //- Toggle sub-menus + menuWrappers.forEach(menuWrapper => { + const menu = menuWrapper.querySelector(".menu"); + menu.addEventListener("click", e => { + menuWrapper.classList.toggle("is-closed"); + }); + }); +}); \ No newline at end of file diff --git a/src/styles/base/main.scss b/src/styles/base/main.scss index 950b85a..835e8db 100644 --- a/src/styles/base/main.scss +++ b/src/styles/base/main.scss @@ -61,7 +61,7 @@ solid-dashboard section { position: sticky; top: 0; overflow-x: hidden; - overflow-y: auto; + overflow-y: scroll; } &.jsLeftMenu { diff --git a/src/styles/base/menu-left.scss b/src/styles/base/menu-left.scss index a018b5d..6996fb6 100644 --- a/src/styles/base/menu-left.scss +++ b/src/styles/base/menu-left.scss @@ -13,13 +13,21 @@ solid-router { .menu-wrapper { - &.is-closed { - .sub-menu { - display: none; + .menu-icon.icon-arrow-up { + visibility: hidden; + } + @include breakpoint(lg) { + .menu-icon.icon-arrow-up { + visibility: visible; } + &.is-closed { + .sub-menu { + display: none; + } - .menu-chevron { - transform: rotate(180deg); + .menu-chevron { + transform: rotate(180deg); + } } } } From 81b1b33bce5da0b9c5fd56faaf97e06a0d1c41cd Mon Sep 17 00:00:00 2001 From: gaelle morin Date: Tue, 15 Sep 2020 15:24:45 +0200 Subject: [PATCH 11/22] feature: circle - private message to member of a circle --- src/styles/base/user-thumb.scss | 15 +++++++++++++++ src/templates/hubl-circle-team.pug | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/styles/base/user-thumb.scss b/src/styles/base/user-thumb.scss index 8814efb..487a5de 100644 --- a/src/styles/base/user-thumb.scss +++ b/src/styles/base/user-thumb.scss @@ -37,6 +37,21 @@ margin-right: 1rem; } +.user-thumb__send { + position: relative; + bottom: 7px; + left: -5px; + + solid-link { + @include icon('speech'); + + &::before { + display: inline-block; + color: #FF6765; + } + } +} + .user-thumb__admin:not(:empty) { display: block !important; @extend %tag-admin; diff --git a/src/templates/hubl-circle-team.pug b/src/templates/hubl-circle-team.pug index 2aff831..f3e2f88 100644 --- a/src/templates/hubl-circle-team.pug +++ b/src/templates/hubl-circle-team.pug @@ -4,11 +4,15 @@ solid-widget(name='hubl-circle-team-template') template solid-display.user-thumb.is-spaced( data-src='${await value.user}' - fields='account.picture, sup(name, isadmin), sub(profile.city)' + fields='account.picture, sup(name, send, isadmin), sub(profile.city)' value-isadmin='${await value.is_admin}' + action-send="messages" + label-send="" + class-account.picture='avatar user-thumb__picture' class-name='user-thumb__name' + class-send='user-thumb__send' class-isadmin='user-thumb__admin' class-profile.city='user-thumb__city' From 91dec8717b73240657fd9661dd8e35afff1b626a Mon Sep 17 00:00:00 2001 From: gaelle morin Date: Wed, 16 Sep 2020 14:27:39 +0200 Subject: [PATCH 12/22] feature: circle - private message to member of a project --- src/templates/hubl-project-team.pug | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/templates/hubl-project-team.pug b/src/templates/hubl-project-team.pug index f8334c7..8125a41 100644 --- a/src/templates/hubl-project-team.pug +++ b/src/templates/hubl-project-team.pug @@ -4,12 +4,15 @@ solid-widget(name='hubl-project-team') template solid-display.user-thumb.is-spaced( data-src='${await value}' - fields='user.account.picture, sup(user.name, isadmin), sub(user.profile.city, name)' + fields='user.account.picture, sup(user.name, send, isadmin), sub(user.profile.city, name)' value-isadmin='${await value.is_admin}' - class-user.account.picture='avatar user-thumb__picture' + action-send="messages" + label-send="" + class-user.account.picture='avatar user-thumb__picture' class-user.name='user-thumb__name' + class-send='user-thumb__send' class-isadmin='user-thumb__admin' class-user.profile.city='user-thumb__city' class-name='user-thumb__lead' From 8729e8b6311005f62dbddbd466139768165b1316 Mon Sep 17 00:00:00 2001 From: gaelle morin Date: Wed, 16 Sep 2020 17:19:28 +0200 Subject: [PATCH 13/22] feature: circle - private message to member of a project: widget added --- src/templates/hubl-project-team.pug | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/templates/hubl-project-team.pug b/src/templates/hubl-project-team.pug index 8125a41..76c02c4 100644 --- a/src/templates/hubl-project-team.pug +++ b/src/templates/hubl-project-team.pug @@ -1,18 +1,21 @@ include hubl-user-avatar.pug +solid-widget(name='hubl-project-team-contact') + template + solid-link(data-src='\${value}', next='messages') + solid-widget(name='hubl-project-team') template solid-display.user-thumb.is-spaced( data-src='${await value}' - fields='user.account.picture, sup(user.name, send, isadmin), sub(user.profile.city, name)' + fields='user.account.picture, sup(user.name, user, isadmin), sub(user.profile.city, name)' value-isadmin='${await value.is_admin}' - action-send="messages" - label-send="" + widget-user='hubl-project-team-contact' class-user.account.picture='avatar user-thumb__picture' class-user.name='user-thumb__name' - class-send='user-thumb__send' + class-user='user-thumb__send' class-isadmin='user-thumb__admin' class-user.profile.city='user-thumb__city' class-name='user-thumb__lead' From 01cea418a481faf1318898bd740b86dc2782133d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Wed, 16 Sep 2020 21:31:26 +0200 Subject: [PATCH 14/22] feature: solid-xmpp-chat Converse IndexedDB Websocket --- src/dependencies.pug | 2 +- src/scripts/unreads-menu.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dependencies.pug b/src/dependencies.pug index a688ab5..685d6da 100644 --- a/src/dependencies.pug +++ b/src/dependencies.pug @@ -31,7 +31,7 @@ if endpoints.dashboards || (endpoints.get && endpoints.get.dashboards) //- script(type="module" src="/lib/solid-dashboard/dist/index.js" defer) if endpoints.users || (endpoints.get && endpoints.get.users) - script(type="module" src="https://unpkg.com/@startinblox/component-chat@0.8" defer) + script(type="module" src="https://unpkg.com/@startinblox/component-chat@1.0" defer) //- script(type="module" src="/lib/solid-xmpp-chat/dist/index.js" defer) script(src="/scripts/index.js" defer) diff --git a/src/scripts/unreads-menu.js b/src/scripts/unreads-menu.js index bd6abc7..ae5dc2c 100644 --- a/src/scripts/unreads-menu.js +++ b/src/scripts/unreads-menu.js @@ -1,7 +1,7 @@ document.addEventListener("DOMContentLoaded", function (event) { window.addEventListener('newMessage', event => { let jid = event.detail.jid; - Array.from(document.querySelectorAll('[data-jabberID="'+jid+'"]')).forEach(el => { + Array.from(document.querySelectorAll('[data-jabberID="' + jid + '"]')).forEach(el => { el.parentElement.parentElement.classList.add('unread'); }); }); @@ -9,7 +9,12 @@ document.addEventListener("DOMContentLoaded", function (event) { window.addEventListener('read', (event) => { if (event.detail && event.detail.resource && event.detail.resource['@id']) { const badge = document.querySelector(`solid-badge[data-src="${event.detail.resource['@id']}"]`); - if (badge) badge.parentElement.parentElement.classList.remove('unread'); + if (badge) { + badge.parentElement.parentElement.classList.remove('unread'); + const project = badge.parentElement.parentElement.querySelector('.unread'); + if (project) project.classList.remove('unread'); + } + } }); }); \ No newline at end of file From 7adfce37ec9de2ed2893631b5fd36b22fe66650a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 17 Sep 2020 12:08:42 +0200 Subject: [PATCH 16/22] cicd: don't create cypress video --- cypress.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index 2f9683b..533f1db 100644 --- a/cypress.json +++ b/cypress.json @@ -3,5 +3,6 @@ "defaultCommandTimeout": 60000, "chromeWebSecurity": false, "viewportWidth": 1920, - "viewportHeight": 1080 + "viewportHeight": 1080, + "video": false } From 9a0beef4fb4dbfbce8146c1c50910731a4effd06 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 17 Sep 2020 12:56:59 +0200 Subject: [PATCH 17/22] cy: testing timeout on dom interactions --- cypress.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index 533f1db..e9eeb68 100644 --- a/cypress.json +++ b/cypress.json @@ -1,6 +1,6 @@ { "baseUrl": "http://127.0.0.1:3000", - "defaultCommandTimeout": 60000, + "defaultCommandTimeout": 4000, "chromeWebSecurity": false, "viewportWidth": 1920, "viewportHeight": 1080, From 4ab6ab976454f165f3af58285a9dd57ae7922198 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 17 Sep 2020 13:08:44 +0200 Subject: [PATCH 18/22] cy: no more naviagte --- cypress/integration/create-channel.spec.js | 21 +++++++++++++++++--- cypress/integration/create-job-offer.spec.js | 7 ++++++- cypress/integration/create-project.spec.js | 14 +++++++++++-- cypress/integration/create-user.spec.js | 7 ++++++- cypress/integration/delete-channel.spec.js | 12 +++++++++-- cypress/integration/edit-channel.spec.js | 12 +++++++++-- cypress/integration/edit-job-offer.spec.js | 12 +++++++++-- cypress/integration/edit-project.spec.js | 14 ++++++++++--- cypress/integration/edit-user.spec.js | 7 ++++++- cypress/integration/leave-channel.spec.js | 7 ++++++- cypress/integration/leave-project.spec.js | 7 ++++++- cypress/integration/list-job-offers.spec.js | 7 ++++++- cypress/integration/list-users.spec.js | 7 ++++++- cypress/integration/retire-channel.spec.js | 12 +++++++++-- cypress/integration/retire-project.spec.js | 12 +++++++++-- cypress/support/commands.js | 7 ------- 16 files changed, 133 insertions(+), 32 deletions(-) diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js index 54d2d8a..b28c0f1 100644 --- a/cypress/integration/create-channel.spec.js +++ b/cypress/integration/create-channel.spec.js @@ -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; diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js index 0940eaa..ad960d4 100644 --- a/cypress/integration/create-job-offer.spec.js +++ b/cypress/integration/create-job-offer.spec.js @@ -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); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js index ba198c7..8775a1e 100644 --- a/cypress/integration/create-project.spec.js +++ b/cypress/integration/create-project.spec.js @@ -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; diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index f3fe42c..8cf9ee9 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -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); diff --git a/cypress/integration/delete-channel.spec.js b/cypress/integration/delete-channel.spec.js index e022546..ac97861 100644 --- a/cypress/integration/delete-channel.spec.js +++ b/cypress/integration/delete-channel.spec.js @@ -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', () => { diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js index f0baa3b..b1a8227 100644 --- a/cypress/integration/edit-channel.spec.js +++ b/cypress/integration/edit-channel.spec.js @@ -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', () => { diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js index 16c0f99..0ce7690 100644 --- a/cypress/integration/edit-job-offer.spec.js +++ b/cypress/integration/edit-job-offer.spec.js @@ -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', () => { diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index 766c252..ba34765 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -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', () => { diff --git a/cypress/integration/edit-user.spec.js b/cypress/integration/edit-user.spec.js index ac29f41..5bc2923 100644 --- a/cypress/integration/edit-user.spec.js +++ b/cypress/integration/edit-user.spec.js @@ -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(); diff --git a/cypress/integration/leave-channel.spec.js b/cypress/integration/leave-channel.spec.js index 638eb58..3b762c3 100644 --- a/cypress/integration/leave-channel.spec.js +++ b/cypress/integration/leave-channel.spec.js @@ -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(); diff --git a/cypress/integration/leave-project.spec.js b/cypress/integration/leave-project.spec.js index 8c623fe..886d3a2 100644 --- a/cypress/integration/leave-project.spec.js +++ b/cypress/integration/leave-project.spec.js @@ -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(); diff --git a/cypress/integration/list-job-offers.spec.js b/cypress/integration/list-job-offers.spec.js index badf05d..8def06b 100644 --- a/cypress/integration/list-job-offers.spec.js +++ b/cypress/integration/list-job-offers.spec.js @@ -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); }); diff --git a/cypress/integration/list-users.spec.js b/cypress/integration/list-users.spec.js index 9db3595..ddd848e 100644 --- a/cypress/integration/list-users.spec.js +++ b/cypress/integration/list-users.spec.js @@ -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); }); diff --git a/cypress/integration/retire-channel.spec.js b/cypress/integration/retire-channel.spec.js index 6f0a659..6ae42d2 100644 --- a/cypress/integration/retire-channel.spec.js +++ b/cypress/integration/retire-channel.spec.js @@ -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', () => { diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index a660395..b54b90d 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -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', () => { diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 2ece0ad..cff3858 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -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) => { From 0441d5fb1ae2f8e61367c4be2a09ebb10b4195a1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 17 Sep 2020 13:17:55 +0200 Subject: [PATCH 19/22] fix: typo --- cypress/integration/edit-project.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index ba34765..f3d7c54 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -34,7 +34,7 @@ context('Edit Project Browser Testing', () => { it('should visit the last project edit screen', () => { cy.get(menuQuery.join(' ')) .invoke('attr', 'data-src') - .then(url => cy.encodeUrl(url).then(id => {{ + .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'); From 79ad8f410483e16086d56cdda8adb103f93fbe12 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 17 Sep 2020 13:27:46 +0200 Subject: [PATCH 20/22] cy: timeout on dom to 1 sec --- cypress.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index e9eeb68..eaf2081 100644 --- a/cypress.json +++ b/cypress.json @@ -1,6 +1,6 @@ { "baseUrl": "http://127.0.0.1:3000", - "defaultCommandTimeout": 4000, + "defaultCommandTimeout": 1000, "chromeWebSecurity": false, "viewportWidth": 1920, "viewportHeight": 1080, From 4e29918ec4c5d00ee22b709497be4710ca8c049c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Fri, 18 Sep 2020 11:38:31 +0200 Subject: [PATCH 21/22] bugfix: hide arrow on menu --- src/menu-left.pug | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/menu-left.pug b/src/menu-left.pug index 6538c09..93304e5 100644 --- a/src/menu-left.pug +++ b/src/menu-left.pug @@ -74,7 +74,8 @@ solid-router#navbar-router(default-route='dashboard') solid-link(next='admin-project-list') div.menu div.menu-chevron - div.menu-icon.icon-arrow-right-circle + div.menu-icon + //- div.menu-icon.icon-arrow-right-circle div.menu-label Projets div.menu-icon.icon-folder-alt solid-route(name='project', rdf-type='hd:project', use-id='', hidden) @@ -101,7 +102,8 @@ solid-router#navbar-router(default-route='dashboard') solid-link(next='admin-circle-list') div.menu div.menu-chevron - div.menu-icon.icon-arrow-right-circle + div.menu-icon + //- div.menu-icon.icon-arrow-right-circle div.menu-label Cercles div.menu-icon.icon-folder-alt solid-route(name='circle', rdf-type='hd:circle', use-id='', hidden) From 9faf5ad6ac56f9810fcc4832df3dd497ff0fa02c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Tue, 22 Sep 2020 13:03:05 +0200 Subject: [PATCH 22/22] fix: links on left menu --- src/menu-left.pug | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/menu-left.pug b/src/menu-left.pug index 93304e5..3180ce7 100644 --- a/src/menu-left.pug +++ b/src/menu-left.pug @@ -71,7 +71,8 @@ solid-router#navbar-router(default-route='dashboard') div.divider if endpoints.projects || (endpoints.get && endpoints.get.projects) div - solid-link(next='admin-project-list') + solid-link + //- (next='admin-project-list') div.menu div.menu-chevron div.menu-icon @@ -99,7 +100,8 @@ solid-router#navbar-router(default-route='dashboard') div.divider if endpoints.circles || (endpoints.get && endpoints.get.circles) div - solid-link(next='admin-circle-list') + solid-link + //- (next='admin-circle-list') div.menu div.menu-chevron div.menu-icon