File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
e2e/cypress/integration/polis Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,14 @@ describe('Emails', () => {
63
63
cy . get ( '.email-content' ) . should ( 'contain' , `${ Cypress . config ( ) . baseUrl } /pwreset/` )
64
64
cy . get ( '.email-content' ) . then ( ( $elem ) => {
65
65
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 ( / (?: h t t p ( 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 )
71
68
// 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 ]
73
71
74
72
// Submit password reset form with new password.
75
- cy . visit ( passwordResetUrl )
73
+ cy . visit ( `/pwreset/ ${ passwordResetToken } ` )
76
74
77
75
cy . route ( {
78
76
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments