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:
Rahul Suresh
2023-12-06 09:54:59 -06:00
committed by GitHub
parent 061e40328e
commit f24b93599d
2 changed files with 8 additions and 4 deletions
@@ -1,6 +1,6 @@
import React from 'react';
import { faWindowRestore } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';
import { useTranslation } from 'react-i18next';
import EditorTabs from './editor-tabs';
@@ -86,7 +86,6 @@ const ActionRow = ({
<span aria-hidden='true'>{t('learn.editor-tabs.preview')}</span>
</button>
<button
data-playwright-test-label='preview-portal-button'
aria-expanded={!!showPreviewPortal}
onClick={() => togglePane('showPreviewPortal')}
>
+7 -2
View File
@@ -1,4 +1,5 @@
import { test, expect, type Page, type Locator } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
const challengeButtons = [
'Instructions',
@@ -25,7 +26,9 @@ function getTabsRowLocator(page: Page): Locator {
test('Action row buttons are visible', async ({ isMobile, page }) => {
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 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 ({
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 [newPage] = await Promise.all([