Skip to content

Commit

Permalink
fix(e2e, playwright): resolved mobile test failure on editor-tabs.sp…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulsuresh-git authored Dec 6, 2023
1 parent 5acc652 commit ab8ce12
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions e2e/editor-tabs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
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(
'/learn/2022/responsive-web-design/build-a-survey-form-project/build-a-survey-form'
);
});

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');
Expand Down

0 comments on commit ab8ce12

Please sign in to comment.