mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(e2e, playwright): resolved mobile test failures on landing.spec.ts (#52474)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
+12
-5
@@ -1,6 +1,6 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import translations from '../client/i18n/locales/english/translations.json';
|
||||
import { expect, test, type Page } from '@playwright/test';
|
||||
import intro from '../client/i18n/locales/english/intro.json';
|
||||
import translations from '../client/i18n/locales/english/translations.json';
|
||||
|
||||
const landingPageElements = {
|
||||
heading: 'landing-header',
|
||||
@@ -79,14 +79,21 @@ test('The landing-top & testimonial sections should contain call-to-action, and
|
||||
}
|
||||
});
|
||||
|
||||
test("The landing-top should contain a descriptive text explaining the camper's image", async () => {
|
||||
test("The landing-top should contain a descriptive text explaining the camper's image", async ({
|
||||
isMobile
|
||||
}) => {
|
||||
const campersImage = page.getByAltText(translations.landing['hero-img-alt']);
|
||||
const captionText = page.getByText(
|
||||
translations.landing['hero-img-description']
|
||||
);
|
||||
|
||||
await expect(campersImage).toBeVisible();
|
||||
await expect(captionText).toBeVisible();
|
||||
if (isMobile) {
|
||||
await expect(campersImage).toBeHidden();
|
||||
await expect(captionText).toBeHidden();
|
||||
} else {
|
||||
await expect(campersImage).toBeVisible();
|
||||
await expect(captionText).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('The campers landing page figure is visible on desktop and hidden on mobile view', async ({
|
||||
|
||||
Reference in New Issue
Block a user