feat(UI): added specific label for MacOS check-code button (#54276)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
Co-authored-by: Tomas Bern <bekjon_98@mail.ru>
This commit is contained in:
Giovanni Ruberto
2024-04-05 08:49:32 +02:00
committed by GitHub
parent 387f938975
commit c82a57e1d3
4 changed files with 24 additions and 23 deletions
+16 -10
View File
@@ -19,7 +19,7 @@ test('Check the initial states of submit button and "check your code" button', a
});
test('Click on the "check your code" button', async ({ page }) => {
const checkButton = page.getByTestId('lowerJaw-check-button');
const checkButton = page.getByRole('button', { name: 'Check Your Code' });
await checkButton.click();
@@ -43,20 +43,26 @@ test('Should render UI correctly', async ({ page }) => {
name: 'Check Your Code'
});
const lowerJawTips = page.getByTestId('failing-test-feedback');
await expect(codeCheckButton).toHaveText('Check Your Code (Ctrl + Enter)');
await expect(codeCheckButton).toBeVisible();
await expect(lowerJawTips).toHaveCount(0);
});
test('Should display full button text on desktop but hide (Ctrl + Enter on mobile)', async ({
test('Should display the text of the check code button accordingly based on device type and screen size', async ({
page,
isMobile
isMobile,
browserName
}) => {
const codeCheckButton = page.getByRole('button', {
name: 'Check Your Code'
});
await expect(codeCheckButton).toHaveText('Check Your Code (Ctrl + Enter)');
if (isMobile) {
await expect(codeCheckButton).toHaveText('Check Your Code');
await expect(
page.getByRole('button', { name: 'Check Your Code', exact: true })
).toBeVisible();
} else if (browserName === 'webkit') {
await expect(
page.getByRole('button', { name: 'Check Your Code (Command + Enter)' })
).toBeVisible();
} else {
await expect(
page.getByRole('button', { name: 'Check Your Code (Ctrl + Enter)' })
).toBeVisible();
}
});