diff --git a/e2e/email-sign-up.spec.ts b/e2e/email-sign-up.spec.ts index 2526261fba7..721c7da4818 100644 --- a/e2e/email-sign-up.spec.ts +++ b/e2e/email-sign-up.spec.ts @@ -4,6 +4,24 @@ import translations from '../client/i18n/locales/english/translations.json'; const apiLocation = process.env.API_LOCATION || 'http://localhost:3000'; +const contents = [ + translations.learn['read-this'].heading, + translations.learn['read-this'].p1, + translations.learn['read-this'].p2, + translations.learn['read-this'].p3, + translations.learn['read-this'].p4, + translations.learn['read-this'].p5, + translations.learn['read-this'].p6, + translations.learn['read-this'].p7, + translations.learn['read-this'].p8, + "And if you want to learn more math and computer science theory, we also have thousands of hours of video courses on freeCodeCamp's YouTube channel.", + translations.learn['read-this'].p10, + 'You can do this on LinkedIn and GitHub, and also on the freeCodeCamp forum.', + translations.learn['read-this'].p12, + translations.misc.quincy, + translations.misc['email-blast'] +]; + test.describe('Email sign-up page when user is not signed in', () => { test.use({ storageState: { cookies: [], origins: [] } }); @@ -17,6 +35,28 @@ test.describe('Email sign-up page when user is not signed in', () => { await page.goto('/email-sign-up'); }); + test('should display the content correctly', async ({ page }) => { + for (const content of contents) { + await expect(page.getByText(content)).toBeVisible(); + } + + const youtubeLink = page.getByRole('link', { + name: "freeCodeCamp's YouTube channel" + }); + await expect(youtubeLink).toHaveAttribute( + 'href', + 'https://youtube.com/freecodecamp' + ); + + const forumLink = page.getByRole('link', { + name: 'the freeCodeCamp forum' + }); + await expect(forumLink).toHaveAttribute( + 'href', + 'https://forum.freecodecamp.org' + ); + }); + test("should not enable Quincy's weekly newsletter when the user clicks the sign up button", async ({ page, browserName @@ -90,6 +130,28 @@ test.describe('Email sign-up page when user is signed in', () => { await page.goto('/email-sign-up'); }); + test('should display the content correctly', async ({ page }) => { + for (const content of contents) { + await expect(page.getByText(content)).toBeVisible(); + } + + const youtubeLink = page.getByRole('link', { + name: "freeCodeCamp's YouTube channel" + }); + await expect(youtubeLink).toHaveAttribute( + 'href', + 'https://youtube.com/freecodecamp' + ); + + const forumLink = page.getByRole('link', { + name: 'the freeCodeCamp forum' + }); + await expect(forumLink).toHaveAttribute( + 'href', + 'https://forum.freecodecamp.org' + ); + }); + test("should disable Quincy's weekly newsletter if the user clicks No", async ({ page, browserName