aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-10-23 10:55:22 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-02 04:09:56 +0000
commitc57204dda3ea73733b9a483fe1c05ee044c11764 (patch)
tree3027e5c5909badd8534433abe09e4c75f8f5b8d9
parent94a5eba33a069bd7e67347060630e1874cca37de (diff)
[Cypress] Have full login on temperamental tests.
These tests sometimes fail on Travis; e.g. fetching /report/1 returns a non-logged in version of the page, or the Inspector login works but you are still logged in as the previous user. See if we can stabilise it by doing a full login rather than a cy.request() one, and logging out / in rather than going directly to re-login.
-rw-r--r--.cypress/cypress/integration/borsetshire.js4
-rw-r--r--.cypress/cypress/integration/duplicates.js12
2 files changed, 9 insertions, 7 deletions
diff --git a/.cypress/cypress/integration/borsetshire.js b/.cypress/cypress/integration/borsetshire.js
index c2a2710fb..e3529a9aa 100644
--- a/.cypress/cypress/integration/borsetshire.js
+++ b/.cypress/cypress/integration/borsetshire.js
@@ -8,7 +8,9 @@ it('logs in without fuss', function() {
cy.contains('Customer service').click();
cy.url().should('include', '/reports');
- cy.visit('http://borsetshire.localhost:3001/auth');
+ cy.contains('Your account').click();
+ cy.contains('Sign out').click();
+ cy.contains('Sign in').click();
cy.contains('Inspector').click();
cy.url().should('include', '/my/planned');
diff --git a/.cypress/cypress/integration/duplicates.js b/.cypress/cypress/integration/duplicates.js
index c0e0d8004..c014e0593 100644
--- a/.cypress/cypress/integration/duplicates.js
+++ b/.cypress/cypress/integration/duplicates.js
@@ -51,12 +51,12 @@ describe('Duplicate tests', function() {
});
it('lets an inspector see duplicate reports coming from /reports', function() {
- cy.request({
- method: 'POST',
- url: 'http://borsetshire.localhost:3001/auth?r=/my',
- form: true,
- body: { username: 'admin@example.org', password_sign_in: 'password' }
- });
+ cy.visit('http://borsetshire.localhost:3001/auth');
+ cy.get('[name=username]').type('admin@example.org');
+ cy.contains('Sign in with a password').click();
+ cy.get('[name=password_sign_in]').type('password');
+ cy.get('[name=sign_in_by_password]').last().click();
+ cy.url().should('include', '/my');
cy.visit('http://borsetshire.localhost:3001/reports');
cy.get('[href$="/report/1"]:last').click();
cy.get('#report_inspect_form #state').select('Duplicate');