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

Fix - e2e checkURL tests failing unexpectedly #1323

Merged
merged 3 commits into from
Feb 6, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/build-nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
${{ runner.os }}-build-yarn-

- name: Install dependencies
run: yarn
run: yarn install --immutable

- name: Build frontend
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
run: yarn
run: yarn install --immutable

- name: Lint frontend
run: yarn lint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ jobs:

- name: Install Frontend Dependencies
working-directory: ./frontend
run: yarn
run: yarn install --immutable

- name: Install e2e Dependencies
working-directory: ./frontend/e2e
run: yarn
run: yarn install --immutable

- name: Setup env
working-directory: ./frontend
Expand Down
10 changes: 8 additions & 2 deletions e2e/pages/web-pages/campaigns/campaigns.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { LanguagesEnum } from '../../../data/enums/languages.enum'
import { bgLocalizationCampaigns, enLocalizationCampaigns } from '../../../data/localization'
import { SLUG_REGEX } from '../../../utils/helpers'
Expand All @@ -24,7 +24,13 @@ export class CampaignsPage extends HomePage {
private readonly enSupportNowActionButtonText = enLocalizationCampaigns.cta['support-now']

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

/**
Expand Down
11 changes: 7 additions & 4 deletions e2e/pages/web-pages/campaigns/donation.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { LanguagesEnum } from '../../../data/enums/languages.enum'
import {
bgLocalizationOneTimeDonation,
Expand Down Expand Up @@ -61,9 +61,12 @@ export class DonationPage extends CampaignsPage {
private readonly enSuccessfulDonationTitle = enLocalizationOneTimeDonation.success.title

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

Expand Down
3 changes: 2 additions & 1 deletion e2e/pages/web-pages/support.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export class SupportPage extends HomePage {
await this.setInputFieldBySelector(this.contactFormPhoneInputField, volunteerData[3])
await this.setInputFieldBySelector(this.contactFormCommentInputField, volunteerData[4])
await this.selectCheckboxByLabelText([this.agreeWithTerms, this.understandTerms])
await this.clickSendSubmitButton()
// Stop form submission, because of email sending
// await this.clickSendSubmitButton()
}

/**
Expand Down
31 changes: 16 additions & 15 deletions e2e/tests/regression/support-as-member.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,20 @@ test.describe.serial('Support page - Join us as member - BG language version', a
).toBeFalsy()
})

test('"Thank you" step works correctly', async () => {
expect
.soft(
await supportPage.isContactDataStepActive(),
'Contact Data step is active, but should not be.',
)
.toBeFalsy()
expect
.soft(await supportPage.isParticipationStepActive(), 'Participation step is Not active.')
.toBeTruthy()
expect(
await supportPage.isThankYouSupportH4HeadingVisible(),
'Thank you greeting is not visible.',
).toBeTruthy()
})
// Comment out thank you step because of email sending
// test('"Thank you" step works correctly', async () => {
// expect
// .soft(
// await supportPage.isContactDataStepActive(),
// 'Contact Data step is active, but should not be.',
// )
// .toBeFalsy()
// expect
// .soft(await supportPage.isParticipationStepActive(), 'Participation step is Not active.')
// .toBeTruthy()
// expect(
// await supportPage.isThankYouSupportH4HeadingVisible(),
// 'Thank you greeting is not visible.',
// ).toBeTruthy()
// })
})
8 changes: 4 additions & 4 deletions src/components/one-time-donation/steps/FirstStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function FirstStep() {
options={paymentOptions}
/>
</Box>
<Collapse in={paymentField.value === 'bank'} timeout="auto">
<Collapse unmountOnExit in={paymentField.value === 'bank'} timeout="auto">
<List component="div" disablePadding>
<Typography marginTop={theme.spacing(4)} variant="h6">
{t('third-step.bank-details')}
Expand Down Expand Up @@ -173,7 +173,7 @@ export default function FirstStep() {
<Typography>{t('third-step.message-warning')}</Typography>
</List>
</Collapse>
<Collapse in={paymentField.value === 'card'} timeout="auto">
<Collapse unmountOnExit in={paymentField.value === 'card'} timeout="auto">
<Typography paragraph={true} variant="body2" sx={{ marginTop: theme.spacing(2) }}>
{t('third-step.card-fees')}
<ExternalLink href="https://stripe.com/en-bg/pricing">
Expand All @@ -197,7 +197,7 @@ export default function FirstStep() {
.concat({ label: t('first-step.other'), value: 'other' }) || []
}
/>
<Collapse in={amount.value === 'other'} timeout="auto">
<Collapse unmountOnExit in={amount.value === 'other'} timeout="auto">
<Grid
item
xs={12}
Expand Down Expand Up @@ -283,7 +283,7 @@ export default function FirstStep() {
) : null}
</Box>
</Collapse>
<Collapse in={paymentField.value === 'paypal'}>
<Collapse unmountOnExit in={paymentField.value === 'paypal'}>
<Grid container justifyContent="center">
<Grid my={2} item display="flex" justifyContent="center" xs={9}>
<Typography>
Expand Down