add send test of e2e feature send coins

This commit is contained in:
mahula 2023-06-16 16:32:19 +02:00
parent a837ce0a0d
commit e46ff56c1e
2 changed files with 80 additions and 0 deletions

View 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

View File

@ -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')
})