mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
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:
+16
-10
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user