mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
AB testing skill based landing page top (#60753)
Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
This commit is contained in:
+50
-52
@@ -51,70 +51,32 @@ test.describe('Landing Top - Variation B', () => {
|
||||
await goToLandingPage(page);
|
||||
});
|
||||
|
||||
test('The supporting copy renders correctly', async ({ page }) => {
|
||||
const landingH2Heading = page.getByTestId('landing-h2-heading-b');
|
||||
await expect(landingH2Heading).toHaveText(
|
||||
translations.landing['h2-heading-b'].replace(/<\/?strong>/g, '')
|
||||
test('Main heading copy renders correctly', async ({ page }) => {
|
||||
const bigHeading = page.getByTestId('big-heading-1-b');
|
||||
await expect(bigHeading).toHaveText(
|
||||
translations.landing['big-heading-1-b']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Second section - Variation B', () => {
|
||||
test('The component Why learn with freeCodeCamp renders correctly', async ({
|
||||
context,
|
||||
page
|
||||
}) => {
|
||||
await addGrowthbookCookie({ context, variation: 'C' });
|
||||
await goToLandingPage(page);
|
||||
const h2Element = page.locator(
|
||||
`h2:has-text("${translations.landing.benefits['heading']}")`
|
||||
test('Supporting copy renders correctly', async ({ page }) => {
|
||||
const bigHeading = page.getByTestId('advance-career');
|
||||
await expect(bigHeading).toHaveText(translations.landing['advance-career']);
|
||||
});
|
||||
|
||||
test('Logo row copy renders correctly', async ({ page }) => {
|
||||
const landingH2Heading = page.getByTestId('graduates-work');
|
||||
await expect(landingH2Heading).toHaveText(
|
||||
translations.landing['graduates-work'].replace(/<\/?strong>/g, '')
|
||||
);
|
||||
|
||||
await expect(h2Element).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Landing Top - Variation A', () => {
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
await addGrowthbookCookie({ context, variation: 'A' });
|
||||
await addGrowthbookCookie({ context, variation: 'newA' });
|
||||
await goToLandingPage(page);
|
||||
});
|
||||
|
||||
test('The supporting copy renders correctly', async ({ page }) => {
|
||||
const landingH2Heading = page.getByTestId('landing-h2-heading');
|
||||
await expect(landingH2Heading).toHaveText(
|
||||
translations.landing['h2-heading']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Second section - Variation A', () => {
|
||||
test('The component As Seen renders correctly', async ({ context, page }) => {
|
||||
await addGrowthbookCookie({ context, variation: 'E' });
|
||||
await goToLandingPage(page);
|
||||
const h2Element = page.locator(
|
||||
`h2:has-text("${translations.landing['as-seen-in']}")`
|
||||
);
|
||||
|
||||
await expect(h2Element).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Landing Page', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await goToLandingPage(page);
|
||||
});
|
||||
|
||||
test('Call to action buttons should render correctly', async ({ page }) => {
|
||||
const ctas = page.getByRole('link', {
|
||||
name: translations.buttons['logged-in-cta-btn']
|
||||
});
|
||||
await expect(ctas).toHaveCount(4);
|
||||
for (const cta of await ctas.all()) {
|
||||
await expect(cta).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('The headline renders correctly', async ({ page }) => {
|
||||
const landingHeading1 = page.getByTestId('landing-big-heading-1');
|
||||
await expect(landingHeading1).toHaveText(
|
||||
@@ -132,6 +94,42 @@ test.describe('Landing Page', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('Logo row copy renders correctly', async ({ page }) => {
|
||||
const landingH2Heading = page.getByTestId('h2-heading');
|
||||
await expect(landingH2Heading).toHaveText(
|
||||
translations.landing['h2-heading'].replace(/<\/?strong>/g, '')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Landing Page', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await goToLandingPage(page);
|
||||
});
|
||||
|
||||
test('The component Why learn with freeCodeCamp renders correctly', async ({
|
||||
context,
|
||||
page
|
||||
}) => {
|
||||
await addGrowthbookCookie({ context, variation: 'C' });
|
||||
await goToLandingPage(page);
|
||||
const h2Element = page.locator(
|
||||
`h2:has-text("${translations.landing.benefits['heading']}")`
|
||||
);
|
||||
|
||||
await expect(h2Element).toBeVisible();
|
||||
});
|
||||
|
||||
test('Call to action buttons should render correctly', async ({ page }) => {
|
||||
const ctas = page.getByRole('link', {
|
||||
name: translations.buttons['logged-in-cta-btn']
|
||||
});
|
||||
await expect(ctas).toHaveCount(4);
|
||||
for (const cta of await ctas.all()) {
|
||||
await expect(cta).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('Hero image should have an alt and a description', async ({
|
||||
isMobile,
|
||||
page
|
||||
|
||||
Reference in New Issue
Block a user