Skip to content

Commit e2da854

Browse files
author
Patrick Connolly
committed
e2e: Fixed issue with matching password reset token.
1 parent 5434026 commit e2da854

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

e2e/cypress/integration/polis/emails.spec.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,14 @@ describe('Emails', () => {
6363
cy.get('.email-content').should('contain', `${Cypress.config().baseUrl}/pwreset/`)
6464
cy.get('.email-content').then(($elem) => {
6565
const emailContent = $elem.text()
66-
// Had to remove one single-quote from regex so as not to confuse IDE.
67-
// See: https://www.regextester.com/94502
68-
const urlRegex = new RegExp(/(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&\(\)\*\+,;=.]+/g)
69-
const match = emailContent.match(urlRegex)
70-
cy.log(match)
66+
const tokenRegex = new RegExp('/pwreset/([a-zA-Z0-9]+)\n', 'g')
67+
const match = tokenRegex.exec(emailContent)
7168
// First "url" is email domain. Second url is the one we want.
72-
const passwordResetUrl = match[1]
69+
cy.log(JSON.stringify(match))
70+
const passwordResetToken = match[1]
7371

7472
// Submit password reset form with new password.
75-
cy.visit(passwordResetUrl)
73+
cy.visit(`/pwreset/${passwordResetToken}`)
7674

7775
cy.route({
7876
method: 'POST',

0 commit comments

Comments
 (0)