mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(e2e, playwright): resolved mobile test failure on action-row.spec.ts (#52446)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
|
||||||
import { faWindowRestore } from '@fortawesome/free-solid-svg-icons';
|
import { faWindowRestore } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import EditorTabs from './editor-tabs';
|
import EditorTabs from './editor-tabs';
|
||||||
|
|
||||||
@@ -86,7 +86,6 @@ const ActionRow = ({
|
|||||||
<span aria-hidden='true'>{t('learn.editor-tabs.preview')}</span>
|
<span aria-hidden='true'>{t('learn.editor-tabs.preview')}</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
data-playwright-test-label='preview-portal-button'
|
|
||||||
aria-expanded={!!showPreviewPortal}
|
aria-expanded={!!showPreviewPortal}
|
||||||
onClick={() => togglePane('showPreviewPortal')}
|
onClick={() => togglePane('showPreviewPortal')}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect, type Page, type Locator } from '@playwright/test';
|
import { test, expect, type Page, type Locator } from '@playwright/test';
|
||||||
|
import translations from '../client/i18n/locales/english/translations.json';
|
||||||
|
|
||||||
const challengeButtons = [
|
const challengeButtons = [
|
||||||
'Instructions',
|
'Instructions',
|
||||||
@@ -25,7 +26,9 @@ function getTabsRowLocator(page: Page): Locator {
|
|||||||
|
|
||||||
test('Action row buttons are visible', async ({ isMobile, page }) => {
|
test('Action row buttons are visible', async ({ isMobile, page }) => {
|
||||||
const previewPaneButton = page.getByTestId('preview-pane-button');
|
const previewPaneButton = page.getByTestId('preview-pane-button');
|
||||||
const previewPortalButton = page.getByTestId('preview-portal-button');
|
const previewPortalButton = page.getByRole('button', {
|
||||||
|
name: translations.aria['move-preview-to-new-window']
|
||||||
|
});
|
||||||
const actionRow = getActionRowLocator(page);
|
const actionRow = getActionRowLocator(page);
|
||||||
const tabsRow = getTabsRowLocator(page);
|
const tabsRow = getTabsRowLocator(page);
|
||||||
|
|
||||||
@@ -106,7 +109,9 @@ test('Clicking Preview Pane button hides preview', async ({
|
|||||||
test('Clicking Preview Portal button opens the preview in a new tab', async ({
|
test('Clicking Preview Portal button opens the preview in a new tab', async ({
|
||||||
page
|
page
|
||||||
}) => {
|
}) => {
|
||||||
const previewPortalButton = page.getByTestId('preview-portal-button');
|
const previewPortalButton = page.getByRole('button', {
|
||||||
|
name: translations.aria['move-preview-to-new-window']
|
||||||
|
});
|
||||||
const browserContext = page.context();
|
const browserContext = page.context();
|
||||||
|
|
||||||
const [newPage] = await Promise.all([
|
const [newPage] = await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user