mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add send test of e2e feature send coins
This commit is contained in:
parent
a837ce0a0d
commit
e46ff56c1e
20
e2e-tests/cypress/e2e/SendCoins.feature
Normal file
20
e2e-tests/cypress/e2e/SendCoins.feature
Normal file
@ -0,0 +1,20 @@
|
||||
Feature: Send coins
|
||||
As a user
|
||||
I want to send and receive GDD
|
||||
I want to see transaction details on overview and transactions pages
|
||||
|
||||
# Background:
|
||||
# Given the following "users" are in the database:
|
||||
# | 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"
|
||||
And the user submits the send form
|
||||
Then the transaction details are presented for confirmation
|
||||
When the user submits the transaction by confirming
|
||||
Then the transaction details are displayed on the transcations page
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
import { And, Then, When } from '@badeball/cypress-cucumber-preprocessor'
|
||||
import { SendPage } from '../../e2e/models/SendPage'
|
||||
|
||||
const sendPage = new SendPage()
|
||||
|
||||
When(
|
||||
'the user fills the send form with {string} {string} {string}',
|
||||
(email: string, amount: string, memoText: string) => {
|
||||
sendPage.enterReceiverEmail(email)
|
||||
sendPage.enterAmount(amount)
|
||||
sendPage.enterMemoText(memoText)
|
||||
}
|
||||
)
|
||||
|
||||
And('the user submits the send form', () => {
|
||||
sendPage.submit()
|
||||
cy.get('.transaction-confirm-send').should('be.visible')
|
||||
})
|
||||
|
||||
|
||||
Then('the transaction details are presented for confirmation', () => {
|
||||
cy.get('.transaction-confirm-send').contains('raeuber@hotzenplotz.de')
|
||||
cy.get('.transaction-confirm-send').contains('+ 120,50 GDD')
|
||||
cy.get('.transaction-confirm-send').contains('Some memo text')
|
||||
cy.get('.transaction-confirm-send').contains('+ 515,11 GDD')
|
||||
cy.get('.transaction-confirm-send').contains('− 120,50 GDD')
|
||||
cy.get('.transaction-confirm-send').contains('+ 394,61 GDD')
|
||||
})
|
||||
|
||||
When('the user submits the transaction by confirming', () => {
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: '/graphql',
|
||||
hostname: 'localhost',
|
||||
}).as('sendCoins')
|
||||
|
||||
sendPage.submit()
|
||||
|
||||
cy.wait('@sendCoins').then((interception) => {
|
||||
cy.wrap(interception.response?.statusCode).should('eq', 200)
|
||||
cy.wrap(interception.request.body)
|
||||
.should('have.property', 'query', `mutation ($identifier: String!, $amount: Decimal!, $memo: String!) {
|
||||
sendCoins(identifier: $identifier, amount: $amount, memo: $memo)
|
||||
}
|
||||
` )
|
||||
cy.wrap(interception.response?.body)
|
||||
.should('have.nested.property', 'data.sendCoins')
|
||||
.and('equal', true)
|
||||
})
|
||||
cy.get('[data-test="send-transaction-success-text"]').should('be.visible')
|
||||
cy.get('.rightside-last-transactions').should('be.visible')
|
||||
cy.get('.align-items-center').contains('Räuber Hotzenplotz')
|
||||
cy.get('.align-items-center').contains('− 120,50 GDD')
|
||||
})
|
||||
|
||||
Then('the transaction details are displayed on the transcations page', () => {
|
||||
cy.visit('/transactions')
|
||||
cy.get('.test-list-group-item').contains('Räuber Hotzenplotz')
|
||||
cy.get('.test-list-group-item').contains('− 120,50 GDD')
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user