From 2c62b06427f7fe8494fc64e4f67b714fa1289448 Mon Sep 17 00:00:00 2001 From: Rahul Suresh <22114682+rahulsuresh-git@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:02:26 -0600 Subject: [PATCH] fix(e2e, playwright): resolved mobile test failures on landing.spec.ts (#52474) Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> --- e2e/landing.spec.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/e2e/landing.spec.ts b/e2e/landing.spec.ts index 1257c9a15f2..f8f79d09ee7 100644 --- a/e2e/landing.spec.ts +++ b/e2e/landing.spec.ts @@ -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 ({