mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
fix(e2e, playwright): resolved mobile test failure on editor-tabs.spec.ts (#52454)
This commit is contained in:
@@ -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 }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto(
|
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 htmlTabToggle = page.getByRole('button', { name: 'index.html Editor' });
|
||||||
const cssTabToggle = page.getByRole('button', { name: 'styles.css Editor' });
|
const cssTabToggle = page.getByRole('button', { name: 'styles.css Editor' });
|
||||||
const htmlTab = page.getByTestId('editor-container-indexhtml');
|
const htmlTab = page.getByTestId('editor-container-indexhtml');
|
||||||
const cssTab = page.getByTestId('editor-container-stylescss');
|
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();
|
await expect(htmlTabToggle).toBeVisible();
|
||||||
// HTML tab is opened by default
|
// HTML tab is opened by default
|
||||||
await expect(htmlTabToggle).toHaveAttribute('aria-expanded', 'true');
|
await expect(htmlTabToggle).toHaveAttribute('aria-expanded', 'true');
|
||||||
|
|||||||
Reference in New Issue
Block a user