freeCodeCamp/e2e/challenge-description.spec.ts
weilirs dc105a826f
test(e2e, playwright): add test for link properties in challenge-description (#52401)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
2023-11-28 17:45:19 -06:00

24 lines
909 B
TypeScript

import { test, expect } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto(
'/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/trophy-write-your-first-code-using-c-sharp'
);
});
test.describe('Challenge Description Component Tests', () => {
test('should display the content correctly', async ({ page }) => {
const challengeDescription = page.getByTestId('challenge-description');
await expect(challengeDescription).toBeVisible();
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');
});
});