mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add receive test to e2e feature send coins
This commit is contained in:
parent
5a86c10169
commit
203ddb27e3
@ -8,15 +8,33 @@ Feature: Send coins
|
||||
# | email | password | name |
|
||||
# | bob@baumeister.de | Aa12345_ | Bob Baumeister |
|
||||
# | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz |
|
||||
|
||||
|
||||
Scenario: Send GDD to other user
|
||||
Given the user is logged in as "bob@baumeister.de" "Aa12345_"
|
||||
And the user navigates to page "/send"
|
||||
When the user fills the send form with "raeuber@hotzenplotz.de" "120.50" "Some memo text"
|
||||
When the user fills the send form with "raeuber@hotzenplotz.de" "<amount>" "Some memo text"
|
||||
And the user submits the send form
|
||||
Then the transaction details are presented for confirmation
|
||||
When the user submits the transaction by confirming
|
||||
And the user navigates to page "/transactions"
|
||||
Then the transaction details are displayed on the transactions page
|
||||
|
||||
Then the "<receiverName>" and "<amount>" are displayed on the "transactions" page
|
||||
|
||||
Examples:
|
||||
| receiverName | amount |
|
||||
# | Räuber Hotzenplotz | 120.50 |
|
||||
| Räuber Hotzenplotz | 120,50 |
|
||||
|
||||
Scenario: Receive GDD from other user
|
||||
Given the user is logged in as "raeuber@hotzenplotz.de" "Aa12345_"
|
||||
And the user receives the transaction e-mail about "<amount>" GDD from "<senderName>"
|
||||
When the user opens the "transaction" link in the browser
|
||||
Then the "<senderName>" and "<amount>" are displayed on the "overview" page
|
||||
When the user navigates to page "/transactions"
|
||||
Then the "<senderName>" and "<amount>" are displayed on the "transactions" page
|
||||
|
||||
Examples:
|
||||
| senderName | amount |
|
||||
# | Bob der Baumeister | 120.50 |
|
||||
| Bob der Baumeister | 120,50 |
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
export class OverviewPage {
|
||||
navbarName = '[data-test="navbar-item-username"]'
|
||||
rightLastTransactionsList = '.rightside-last-transactions'
|
||||
|
||||
|
||||
goto() {
|
||||
cy.visit('/overview')
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { Then, When } from '@badeball/cypress-cucumber-preprocessor'
|
||||
import { And, Then, When } from '@badeball/cypress-cucumber-preprocessor'
|
||||
import { OverviewPage } from '../../e2e/models/OverviewPage'
|
||||
import { ResetPasswordPage } from '../../e2e/models/ResetPasswordPage'
|
||||
import { UserEMailSite } from '../../e2e/models/UserEMailSite'
|
||||
|
||||
const userEMailSite = new UserEMailSite()
|
||||
const resetPasswordPage = new ResetPasswordPage()
|
||||
|
||||
Then('the user receives an e-mail containing the {string} link', (linkName: string) => {
|
||||
let emailSubject: string
|
||||
@ -18,6 +18,10 @@ Then('the user receives an e-mail containing the {string} link', (linkName: stri
|
||||
emailSubject = 'asswor'
|
||||
linkPattern = /\/reset-password\/[0-9]+\d/
|
||||
break
|
||||
case 'transaction':
|
||||
emailSubject = 'has sent you'
|
||||
linkPattern = /\/overview/
|
||||
break
|
||||
default:
|
||||
throw new Error(`Error in "Then the user receives an e-mail containing the {string} link" step: incorrect linkname string "${linkName}"`)
|
||||
}
|
||||
@ -51,9 +55,53 @@ Then('the user receives an e-mail containing the {string} link', (linkName: stri
|
||||
)
|
||||
})
|
||||
|
||||
And('the user receives the transaction e-mail about {string} GDD from {string}', (amount: string, senderName:string) => {
|
||||
cy.origin(
|
||||
Cypress.env('mailserverURL'),
|
||||
{ args: { amount, senderName, userEMailSite } },
|
||||
({ amount, senderName, userEMailSite }) => {
|
||||
const subject = `Gradido: ${senderName} has sent you ${amount} Gradido`
|
||||
const linkPattern = /\/overview/
|
||||
cy.visit('/')
|
||||
cy.get(userEMailSite.emailInbox).should('be.visible')
|
||||
|
||||
cy.get(userEMailSite.emailList)
|
||||
.find('.email-item')
|
||||
.filter(`:contains(${subject})`)
|
||||
.first()
|
||||
.click()
|
||||
|
||||
cy.get(userEMailSite.emailMeta)
|
||||
.find(userEMailSite.emailSubject)
|
||||
.contains(subject)
|
||||
|
||||
cy.get('.email-content', { timeout: 2000})
|
||||
.find('.plain-text')
|
||||
.contains(linkPattern)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
const emailLink = text.match(linkPattern)[0]
|
||||
cy.task('setEmailLink', emailLink)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
When('the user opens the {string} link in the browser', (linkName: string) => {
|
||||
cy.task('getEmailLink').then((emailLink) => {
|
||||
cy.visit(emailLink)
|
||||
})
|
||||
cy.get(resetPasswordPage.newPasswordInput).should('be.visible')
|
||||
|
||||
switch (linkName) {
|
||||
case 'activation':
|
||||
const resetPasswordPage = new ResetPasswordPage()
|
||||
cy.get(resetPasswordPage.newPasswordInput).should('be.visible')
|
||||
break
|
||||
case 'transaction':
|
||||
const overviewPage = new OverviewPage()
|
||||
cy.get(overviewPage.rightLastTransactionsList).should('be.visible')
|
||||
break
|
||||
default:
|
||||
throw new Error(`Error in "Then the user receives an e-mail containing the {string} link" step: incorrect link name string "${linkName}"`)
|
||||
}
|
||||
})
|
||||
|
||||
@ -7,7 +7,7 @@ When(
|
||||
'the user fills the send form with {string} {string} {string}',
|
||||
(email: string, amount: string, memoText: string) => {
|
||||
sendPage.enterReceiverEmail(email)
|
||||
sendPage.enterAmount(amount)
|
||||
sendPage.enterAmount(`${amount}`)
|
||||
sendPage.enterMemoText(memoText)
|
||||
}
|
||||
)
|
||||
@ -53,8 +53,17 @@ When('the user submits the transaction by confirming', () => {
|
||||
cy.get('.align-items-center').contains('− 120.50 GDD')
|
||||
})
|
||||
|
||||
|
||||
Then('the transaction details are displayed on the transactions page', () => {
|
||||
cy.get('div.mt-3 > div > div.test-list-group-item').eq(0).contains('div.gdd-transaction-list-item-name', 'Räuber Hotzenplotz')
|
||||
cy.get('div.mt-3 > div > div.test-list-group-item').eq(0).contains('[data-test="send-amount"]', '− 120.50 GDD')
|
||||
Then('the {string} and {string} are displayed on the {string} page', (name: string, amount: string, page: string) => {
|
||||
switch (page) {
|
||||
case 'overview':
|
||||
cy.get('.align-items-center').contains(`${name}`)
|
||||
cy.get('.align-items-center').contains(`${amount} GDD`)
|
||||
break
|
||||
case 'transactions':
|
||||
cy.get('div.mt-3 > div > div.test-list-group-item').eq(0).contains('div.gdd-transaction-list-item-name', `${name}`)
|
||||
cy.get('div.mt-3 > div > div.test-list-group-item').eq(0).contains('[data-test="transaction-amount"]', `${amount} GDD`)
|
||||
break
|
||||
default:
|
||||
throw new Error(`Error in "Then the {string} and {string} are displayed on the {string}} page" step: incorrect page name string "${page}"`)
|
||||
}
|
||||
})
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="small mb-2">
|
||||
{{ $t('decay.types.receive') }}
|
||||
</div>
|
||||
<div class="font-weight-bold gradido-global-color-accent">{{ amount | GDD }}</div>
|
||||
<div class="font-weight-bold gradido-global-color-accent" data-test="transaction-amount">{{ amount | GDD }}</div>
|
||||
<div v-if="linkId" class="small">
|
||||
{{ $t('via_link') }}
|
||||
<b-icon
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="small mb-2">
|
||||
{{ $t('decay.types.send') }}
|
||||
</div>
|
||||
<div class="font-weight-bold text-140" data-test="send-amount">{{ amount | GDD }}</div>
|
||||
<div class="font-weight-bold text-140" data-test="transaction-amount">{{ amount | GDD }}</div>
|
||||
<div v-if="linkId" class="small">
|
||||
{{ $t('via_link') }}
|
||||
<b-icon
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user