mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add email step definition for registration test
This commit is contained in:
parent
d60a79b607
commit
48cede9222
@ -2,6 +2,7 @@ import { defineConfig } from 'cypress'
|
||||
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'
|
||||
import browserify from '@badeball/cypress-cucumber-preprocessor/browserify'
|
||||
|
||||
let activationLink:string
|
||||
let resetPasswordLink: string
|
||||
|
||||
async function setupNodeEvents(
|
||||
@ -24,6 +25,12 @@ async function setupNodeEvents(
|
||||
getResetPasswordLink: () => {
|
||||
return resetPasswordLink
|
||||
},
|
||||
setActivationLink: (val) => {
|
||||
return (activationLink = val)
|
||||
},
|
||||
getActivationLink: () => {
|
||||
return activationLink
|
||||
},
|
||||
})
|
||||
|
||||
on('after:run', (results) => {
|
||||
|
||||
@ -12,7 +12,7 @@ Then('the user receives an e-mail containing the password reset link', () => {
|
||||
(userEMailSite) => {
|
||||
const linkPattern = /\/reset-password\/[0-9]+\d/
|
||||
|
||||
cy.visit('/') // navigate to user's e-maile site (on fake mail server)
|
||||
cy.visit('/') // navigate to user's e-mail site (on fake mail server)
|
||||
cy.get(userEMailSite.emailInbox).should('be.visible')
|
||||
|
||||
cy.get(userEMailSite.emailList)
|
||||
@ -24,9 +24,9 @@ Then('the user receives an e-mail containing the password reset link', () => {
|
||||
cy.get(userEMailSite.emailMeta)
|
||||
.find(userEMailSite.emailSubject)
|
||||
.contains('asswor')
|
||||
|
||||
|
||||
cy.get('.email-content')
|
||||
.find('.plain-text')
|
||||
.find('.plain-text', { timeout: 2000 })
|
||||
.contains(linkPattern)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
@ -37,9 +37,49 @@ Then('the user receives an e-mail containing the password reset link', () => {
|
||||
)
|
||||
})
|
||||
|
||||
Then('the user receives an e-mail containing the activation link', () => {
|
||||
cy.origin(
|
||||
Cypress.env('mailserverURL'),
|
||||
{ args: userEMailSite },
|
||||
(userEMailSite) => {
|
||||
const linkPattern = /\/checkEmail\/[0-9]+\d/
|
||||
|
||||
cy.visit('/') // navigate to user's e-mail site (on fake mail server)
|
||||
cy.get(userEMailSite.emailInbox).should('be.visible')
|
||||
|
||||
cy.get(userEMailSite.emailList)
|
||||
.find('.email-item')
|
||||
.filter(':contains(E-Mail Überprüfung)')
|
||||
.first()
|
||||
.click()
|
||||
|
||||
cy.get(userEMailSite.emailMeta)
|
||||
.find(userEMailSite.emailSubject)
|
||||
.contains('E-Mail Überprüfung')
|
||||
|
||||
cy.get('.email-content')
|
||||
.wait(2000)
|
||||
.find('.plain-text')
|
||||
.contains(linkPattern)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
const activationLink = text.match(linkPattern)[0]
|
||||
cy.task('setActivationLink', activationLink)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
When('the user opens the password reset link in the browser', () => {
|
||||
cy.task('getResetPasswordLink').then((passwordResetLink) => {
|
||||
cy.visit(passwordResetLink)
|
||||
})
|
||||
cy.get(resetPasswordPage.newPasswordRepeatBlock).should('be.visible')
|
||||
})
|
||||
|
||||
When('the user opens the activation link in the browser', () => {
|
||||
cy.task('getActivationLink').then((activationLink) => {
|
||||
cy.visit(activationLink)
|
||||
})
|
||||
cy.get(resetPasswordPage.newPasswordRepeatBlock).should('be.visible')
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user