From ab8ce12e058203b8379c44e3a3573aadc5424dd3 Mon Sep 17 00:00:00 2001 From: Rahul Suresh <22114682+rahulsuresh-git@users.noreply.github.com> Date: Tue, 5 Dec 2023 18:56:25 -0600 Subject: [PATCH] fix(e2e, playwright): resolved mobile test failure on editor-tabs.spec.ts (#52454) --- e2e/editor-tabs.spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/e2e/editor-tabs.spec.ts b/e2e/editor-tabs.spec.ts index b9107a11210..e9561853cd9 100644 --- a/e2e/editor-tabs.spec.ts +++ b/e2e/editor-tabs.spec.ts @@ -1,4 +1,5 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from '@playwright/test'; +import translations from '../client/i18n/locales/english/translations.json'; test.beforeEach(async ({ page }) => { await page.goto( @@ -6,12 +7,21 @@ test.beforeEach(async ({ page }) => { ); }); -test('should toggle editor visibility correctly', async ({ page }) => { +test('should toggle editor visibility correctly', async ({ + page, + isMobile +}) => { const htmlTabToggle = page.getByRole('button', { name: 'index.html Editor' }); const cssTabToggle = page.getByRole('button', { name: 'styles.css Editor' }); const htmlTab = page.getByTestId('editor-container-indexhtml'); const cssTab = page.getByTestId('editor-container-stylescss'); + if (isMobile) { + const codeButton = page.getByRole('tab', { + name: translations.learn['editor-tabs'].code + }); + await codeButton.click(); + } await expect(htmlTabToggle).toBeVisible(); // HTML tab is opened by default await expect(htmlTabToggle).toHaveAttribute('aria-expanded', 'true');