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

This commit is contained in:
Rahul Suresh
2023-12-06 10:53:15 -06:00
committed by GitHub
parent dc806ef0a4
commit 645ea261e6

View File

@@ -1,10 +1,10 @@
import { test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
const notesButtonLabel = translations.learn['editor-tabs'].notes;
test('User can see notes', async ({ page }) => {
test('User can see notes', async ({ page, isMobile }) => {
const noteContent = 'This is a test note';
await page.route(
@@ -22,7 +22,10 @@ test('User can see notes', async ({ page }) => {
await page.goto(
'learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/step-30'
);
await page.getByRole('button', { name: notesButtonLabel }).click();
if (isMobile) {
await page.getByRole('tab', { name: notesButtonLabel }).click();
} else {
await page.getByRole('button', { name: notesButtonLabel }).click();
}
await expect(page.getByText(noteContent)).toBeVisible();
});