test(e2e, playwright): add test for link properties in challenge-description (#52401)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
weilirs
2023-11-28 17:45:19 -06:00
committed by GitHub
parent 02e1deebea
commit dc105a826f

View File

@@ -7,13 +7,17 @@ test.beforeEach(async ({ page }) => {
});
test.describe('Challenge Description Component Tests', () => {
test('should be visible', async ({ page }) => {
test('should display the content correctly', async ({ page }) => {
const challengeDescription = page.getByTestId('challenge-description');
await expect(challengeDescription).toBeVisible();
});
test('should contain text', async ({ page }) => {
const challengeDescription = page.getByTestId('challenge-description');
await expect(challengeDescription).toHaveText(/ */);
const link = page.getByRole('link', { name: 'your achievements page' });
await expect(link).toHaveAttribute(
'href',
'https://learn.microsoft.com/users/me/achievements#trophies-section'
);
await expect(link).toHaveAttribute('target', '_blank');
await expect(link).toHaveAttribute('rel', 'noreferrer');
});
});