diff --git a/cypress/e2e/default/learn/donate/donate-page-donor.ts b/cypress/e2e/default/learn/donate/donate-page-donor.ts deleted file mode 100644 index 4b3cb4e6546..00000000000 --- a/cypress/e2e/default/learn/donate/donate-page-donor.ts +++ /dev/null @@ -1,27 +0,0 @@ -describe('Donate page', () => { - beforeEach(() => { - cy.task('seed', ['--donor']); - cy.login(); - }); - - it('Donor CTA should be visible for donor', () => { - cy.visit('/donate'); - cy.get('[data-cy="donate.thank-you"]').should( - 'have.text', - 'Thank You for Being a Supporter' - ); - cy.get('[data-cy="donate.crucial-contribution"]').should( - 'have.text', - 'Your contribution will be crucial in creating resources that empower millions of people to learn new skills and support their families.' - ); - cy.get('[data-cy="donate.if-support-further"]').should( - 'have.text', - 'If you want to support our charity further, please consider making a one-time donation, sending us a check, or learning about other ways you could support our charity.' - ); - cy.get('[data-cy="donate-link"]').should( - 'contain.attr', - 'href', - 'https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp' - ); - }); -}); diff --git a/e2e/donate-page-donor.spec.ts b/e2e/donate-page-donor.spec.ts new file mode 100644 index 00000000000..1382bcf7d5a --- /dev/null +++ b/e2e/donate-page-donor.spec.ts @@ -0,0 +1,59 @@ +import { execSync } from 'child_process'; +import { test, expect } from '@playwright/test'; + +test.describe('Donate page', () => { + test.use({ storageState: 'playwright/.auth/development-user.json' }); + + test.beforeEach(async ({ page }) => { + execSync('node ./tools/scripts/seed/seed-demo-user --donor'); + await page.goto('/donate'); + }); + + test.afterAll(() => { + execSync('node ./tools/scripts/seed/seed-demo-user certified-user'); + }); + + test('should render the donate page correctly', async ({ page }) => { + await expect( + page.getByText('Thank You for Being a Supporter') + ).toBeVisible(); + + await expect( + page.getByText( + 'Your contribution will be crucial in creating resources that empower millions of people to learn new skills and support their families.' + ) + ).toBeVisible(); + + await expect( + page.getByText( + 'If you want to support our charity further, please consider making a one-time donation, sending us a check, or learning about other ways you could support our charity.' + ) + ).toBeVisible(); + + await expect( + page.getByRole('link', { name: 'making a one-time donation' }) + ).toHaveAttribute( + 'href', + 'https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#how-can-i-make-a-one-time-donation' + ); + }); + + test('The menu should have a supporters link', async ({ page }) => { + const menuButton = page.getByTestId('header-menu-button'); + const menu = page.getByTestId('header-menu'); + + await expect(menuButton).toBeVisible(); + await menuButton.click(); + + await expect(menu).toBeVisible(); + + await expect(page.getByRole('link', { name: 'Supporters' })).toBeVisible(); + }); + + test('The Avatar should have a special border for donors', async ({ + page + }) => { + const container = page.locator('.avatar-container'); + await expect(container).toHaveClass('avatar-container gold-border'); + }); +});