Skip to content

Commit

Permalink
fix(e2e, playwright): resolved mobile test failures on notes.spec.ts (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulsuresh-git authored Dec 6, 2023
1 parent dc806ef commit 645ea26
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions e2e/notes.spec.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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();
});

0 comments on commit 645ea26

Please sign in to comment.