From 4ab6ab976454f165f3af58285a9dd57ae7922198 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Pasquier <contact@jbpasquier.eu>
Date: Thu, 17 Sep 2020 13:08:44 +0200
Subject: [PATCH] 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 54d2d8af..b28c0f12 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 0940eaaa..ad960d44 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 ba198c79..8775a1ec 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 f3fe42c5..8cf9ee94 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 e0225462..ac978616 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 f0baa3bd..b1a82276 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 16c0f994..0ce7690f 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 766c252c..ba347656 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 ac29f412..5bc2923b 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 638eb588..3b762c3e 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 8c623fe0..886d3a27 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 badf05d9..8def06bd 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 9db3595b..ddd848e4 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 6f0a659b..6ae42d29 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 a660395d..b54b90d6 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 2ece0ad2..cff38585 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) => {
-- 
GitLab