Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Donation Flow - e2e tests, Finalization and QA #1336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions e2e/data/donation-test.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const stripeSuccessFormData = {
cardNumber: '4242 4242 4242 4242',
email: '[email protected]',
expiryDate: '04 / 42',
cvc: '424',
country: 'BG',
}

export const stripeErrorNoBalanceFormData = {
cardNumber: '4000 0000 0000 9995',
email: '[email protected]',
expiryDate: '04 / 42',
cvc: '424',
country: 'BG',
}

export const stripeAuthenticationRequiredFormData = {
cardNumber: '4000 0027 6000 3184',
email: '[email protected]',
expiryDate: '04 / 42',
cvc: '424',
country: 'BG',
}
8 changes: 4 additions & 4 deletions e2e/data/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import enLocalizationValidationJson from '../../public/locales/en/validation.jso
import bgLocalizationCampaignsJson from '../../public/locales/bg/campaigns.json'
import enLocalizationCampaignsJson from '../../public/locales/en/campaigns.json'

import bgLocalizationOneTimeDonationJson from '../../public/locales/bg/one-time-donation.json'
import enLocalizationOneTimeDonationJson from '../../public/locales/en/one-time-donation.json'
import bgLocalizationDonationFlowJson from '../../public/locales/bg/donation-flow.json'
import enLocalizationDonationFlowJson from '../../public/locales/en/donation-flow.json'

// All these constants are used in the E2E test pages to manipulate web elements in a respective language
// Common localization terms
Expand All @@ -30,8 +30,8 @@ export const enLocalizationSupport = enLocalizationSupportJson
export const bgLocalizationCampaigns = bgLocalizationCampaignsJson
export const enLocalizationCampaigns = enLocalizationCampaignsJson
// Donations
export const bgLocalizationOneTimeDonation = bgLocalizationOneTimeDonationJson
export const enLocalizationOneTimeDonation = enLocalizationOneTimeDonationJson
export const bgLocalizationDonationFlow = bgLocalizationDonationFlowJson
export const enLocalizationDonationFlow = enLocalizationDonationFlowJson
// Validations
export const bgLocalizationValidation = bgLocalizationValidationJson
export const enLocalizationValidation = enLocalizationValidationJson
8 changes: 0 additions & 8 deletions e2e/data/support-page-tests.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ export const supportPageVolutneerTestData = {
phone: '+359888000000',
comment: 'E2E Test comment',
}

export const anonDonationTestData = {
cardNumber: '4242 4242 4242 4242',
cardExpDate: '04 / 42',
cardCvc: '424',
billingName: 'E2E Test Anonymous Donation',
country: 'BG',
}
245 changes: 0 additions & 245 deletions e2e/pages/web-pages/campaigns/donation-old.page.ts

This file was deleted.

40 changes: 40 additions & 0 deletions e2e/pages/web-pages/donation/donation-status.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Page, expect } from '@playwright/test'
import { LanguagesEnum } from '../../../data/enums/languages.enum'
import { bgLocalizationDonationFlow, enLocalizationDonationFlow } from '../../../data/localization'
import { SLUG_REGEX } from '../../../utils/helpers'
import { CampaignsPage } from '../campaigns/campaigns.page'
export class DonationStatusPage extends CampaignsPage {
constructor(page: Page) {
super(page)
}

// -> Status titles <-
private readonly bgSuccessTitle = bgLocalizationDonationFlow.status.success.title
private readonly enSuccessTitle = enLocalizationDonationFlow.status.success.title

// -> Wish form <-
private readonly wishSendText = bgLocalizationDonationFlow.status.success.wish.send

async checkPageUrlByRegExp(urlRegExpAsString?: string, timeoutParam = 10000): Promise<void> {
await expect(this.page, 'The URL is not correct!').toHaveURL(
new RegExp(urlRegExpAsString || `^(.*?)/campaigns/donation/${SLUG_REGEX}/status?.+$`),
{
timeout: timeoutParam,
},
)
}

async isSucceededStatusTitleDisplayed(): Promise<boolean> {
return this.isH4HeadingVisible(LanguagesEnum.BG, this.bgSuccessTitle, this.enSuccessTitle)
}

async submitWishForm(): Promise<void> {
const wishAreaLocator = await this.page.locator('textarea[name="wish"]')
await this.waitForElementToBeReadyByLocator(wishAreaLocator)
await wishAreaLocator.fill('e2e_test_wish')
const buttonLocator = await this.page.locator('button[type="submit"]', {
hasText: this.wishSendText,
})
await this.clickElementByLocator(buttonLocator)
}
}
Loading