test(e2e,playwright): ms-trophy-show improvements (#52447)

This commit is contained in:
weilirs
2023-12-04 06:14:30 -06:00
committed by GitHub
parent 3c7487da8b
commit 747dad8dc7
+18 -1
View File
@@ -10,10 +10,18 @@ test.beforeEach(async ({ page }) => {
);
});
test('the page should render with correct title', async ({ page }) => {
test('the page should render with correct title and description', async ({
page
}) => {
await expect(page).toHaveTitle(
'Write Your First Code Using C# - Trophy - Write Your First Code Using C# | Learn | freeCodeCamp.org'
);
const title = page.getByTestId('challenge-title');
await expect(title).toBeVisible();
await expect(title).toContainText('Trophy - Write Your First Code Using C#');
const description = page.getByTestId('challenge-description');
await expect(description).toBeVisible();
});
test('Correct Verify Trophy button', async ({ page }) => {
@@ -22,6 +30,7 @@ test('Correct Verify Trophy button', async ({ page }) => {
});
await expect(askHelpButton).toBeVisible();
await expect(askHelpButton).toHaveText(verifyTrophyButtonText);
await expect(askHelpButton).toBeDisabled();
});
test('Correct Ask for help button', async ({ page }) => {
@@ -30,4 +39,12 @@ test('Correct Ask for help button', async ({ page }) => {
});
await expect(checkAnswerButton).toBeVisible();
await expect(checkAnswerButton).toContainText(askForHelpButtonText);
await checkAnswerButton.click();
await expect(
page.getByRole('heading', {
name: translations.buttons['ask-for-help'],
exact: true
})
).toBeVisible();
});