mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: convert show cert from superblock tests to Playwright (#54836)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
describe('Front End Development Libraries Superblock', () => {
|
||||
before(() => {
|
||||
cy.task('seed');
|
||||
cy.login();
|
||||
cy.visit('/learn/front-end-development-libraries');
|
||||
});
|
||||
describe('Before submitting projects', () => {
|
||||
it('should navigate to "/settings#cert-front-end-development-libraries" when clicking the "Go to settings to claim your certification" anchor', () => {
|
||||
cy.contains('Go to settings to claim your certification').click();
|
||||
cy.url().should(
|
||||
'match',
|
||||
/\/settings\/?#cert-front-end-development-libraries/
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('When the user HAS NOT claimed their cert', () => {
|
||||
test.use({ storageState: 'playwright/.auth/development-user.json' });
|
||||
|
||||
test.beforeAll(() => {
|
||||
execSync('node ./tools/scripts/seed/seed-demo-user');
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/learn/front-end-development-libraries');
|
||||
});
|
||||
|
||||
test('should see a "Go to settings to claim your certification" pointing to "/settings#cert-front-end-development-libraries"', async ({
|
||||
page
|
||||
}) => {
|
||||
const link = page.getByRole('link', {
|
||||
name: 'Go to settings to claim your certification'
|
||||
});
|
||||
|
||||
await expect(link).toBeVisible();
|
||||
await expect(link).toHaveAttribute(
|
||||
'href',
|
||||
'/settings#cert-front-end-development-libraries'
|
||||
);
|
||||
});
|
||||
|
||||
test.afterAll(() => {
|
||||
execSync('node ./tools/scripts/seed/seed-demo-user certified-user');
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('When the user HAS claimed their cert', () => {
|
||||
test.use({ storageState: 'playwright/.auth/certified-user.json' });
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/learn/front-end-development-libraries');
|
||||
});
|
||||
|
||||
test('should see a "Show Certification" link pointing to "/certification/certifieduser/front-end-development-libraries"', async ({
|
||||
page
|
||||
}) => {
|
||||
const link = page.getByRole('link', {
|
||||
name: 'Show Certification'
|
||||
});
|
||||
|
||||
await expect(link).toBeVisible();
|
||||
await expect(link).toHaveAttribute(
|
||||
'href',
|
||||
'/certification/certifieduser/front-end-development-libraries'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user