diff --git a/e2e-tests/cypress/e2e/SendCoins.feature b/e2e-tests/cypress/e2e/SendCoins.feature index 3ff332012..0329b10f7 100644 --- a/e2e-tests/cypress/e2e/SendCoins.feature +++ b/e2e-tests/cypress/e2e/SendCoins.feature @@ -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" "" "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 "" and "" 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 "" GDD from "" + When the user opens the "transaction" link in the browser + Then the "" and "" are displayed on the "overview" page + When the user navigates to page "/transactions" + Then the "" and "" are displayed on the "transactions" page + + Examples: + | senderName | amount | + # | Bob der Baumeister | 120.50 | + | Bob der Baumeister | 120,50 | + + diff --git a/e2e-tests/cypress/e2e/models/OverviewPage.ts b/e2e-tests/cypress/e2e/models/OverviewPage.ts index 345124c66..e8f881eba 100644 --- a/e2e-tests/cypress/e2e/models/OverviewPage.ts +++ b/e2e-tests/cypress/e2e/models/OverviewPage.ts @@ -2,6 +2,8 @@ export class OverviewPage { navbarName = '[data-test="navbar-item-username"]' + rightLastTransactionsList = '.rightside-last-transactions' + goto() { cy.visit('/overview') diff --git a/e2e-tests/cypress/support/step_definitions/email_steps.ts b/e2e-tests/cypress/support/step_definitions/email_steps.ts index d31e2474e..b0d88e9a7 100644 --- a/e2e-tests/cypress/support/step_definitions/email_steps.ts +++ b/e2e-tests/cypress/support/step_definitions/email_steps.ts @@ -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}"`) + } }) diff --git a/e2e-tests/cypress/support/step_definitions/send_coin_steps.ts b/e2e-tests/cypress/support/step_definitions/send_coin_steps.ts index 267de7dd1..2baf5968e 100644 --- a/e2e-tests/cypress/support/step_definitions/send_coin_steps.ts +++ b/e2e-tests/cypress/support/step_definitions/send_coin_steps.ts @@ -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}"`) + } }) \ No newline at end of file diff --git a/frontend/src/components/Transactions/TransactionReceive.vue b/frontend/src/components/Transactions/TransactionReceive.vue index 7778c6c6e..f9d776800 100644 --- a/frontend/src/components/Transactions/TransactionReceive.vue +++ b/frontend/src/components/Transactions/TransactionReceive.vue @@ -26,7 +26,7 @@
{{ $t('decay.types.receive') }}
-
{{ amount | GDD }}
+
{{ amount | GDD }}
{{ $t('via_link') }} {{ $t('decay.types.send') }}
-
{{ amount | GDD }}
+
{{ amount | GDD }}
{{ $t('via_link') }}