fix(e2e, playwright): resolved mobile test failures on landing.spec.ts (#52474)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
pull/52505/head
Rahul Suresh 2023-12-06 11:02:26 -06:00 committed by GitHub
parent 645ea261e6
commit 2c62b06427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -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 ({