From e98257749fe1c7140032f7feaff884b16d17ff52 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Mon, 19 Jul 2021 21:51:14 +0200 Subject: [PATCH] test: fix cypress login in development (#42899) --- cypress/support/commands.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 42b9b23c2d..5603803e1f 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -36,7 +36,12 @@ Cypress.Commands.add('login', () => { cy.visit('/'); cy.contains("Get started (it's free)").click(); - cy.url().should('eq', Cypress.config().baseUrl + '/learn/'); + cy.location().should(loc => { + // I'm not 100% sure why logins get redirected to /learn/ via 301 in + // development, but not in production, but they do. Hence to make it easier + // work on tests, we'll just allow for both. + expect(loc.pathname).to.match(/^\/learn\/?$/); + }); cy.contains('Welcome back'); });