dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { execSync } from 'child_process';
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Certification intro page', () => {
|
|
// Use the development user so the certification blocks are incomplete and
|
|
// therefore rendered expanded. The fully certified user has completed every
|
|
// challenge, which collapses the blocks and hides their descriptions.
|
|
test.use({ storageState: 'playwright/.auth/development-user.json' });
|
|
|
|
test.beforeAll(() => {
|
|
execSync('node ../tools/scripts/seed/seed-demo-user');
|
|
});
|
|
|
|
test.afterAll(() => {
|
|
execSync('node ../tools/scripts/seed/seed-demo-user --certified-user');
|
|
});
|
|
|
|
test('Should render and toggle correctly', async ({ page }) => {
|
|
const firstBlockToggle = page.getByRole('button', {
|
|
name: /^Learn HTML by Building a Cat Photo App/
|
|
});
|
|
|
|
const firstBlockText = page.getByText(
|
|
'HTML tags give a webpage its structure. You can use HTML tags to add photos, buttons, and other elements to your webpage.'
|
|
);
|
|
|
|
const secondBlockText = page.getByText(
|
|
'CSS tells the browser how to display your webpage. You can use CSS to set the color, font, size, and other aspects of HTML elements.'
|
|
);
|
|
|
|
const superBlockText = page.getByText(
|
|
"this Responsive Web Design Certification, you'll learn the languages that developers use to build webpages"
|
|
);
|
|
|
|
await page.goto('/learn/2022/responsive-web-design');
|
|
|
|
await expect(page).toHaveTitle(
|
|
'Legacy Responsive Web Design V8 | freeCodeCamp.org'
|
|
);
|
|
await expect(superBlockText).toBeVisible();
|
|
await expect(firstBlockText).toBeVisible();
|
|
await expect(secondBlockText).not.toBeVisible();
|
|
|
|
await firstBlockToggle.click();
|
|
await expect(firstBlockText).not.toBeVisible();
|
|
|
|
await firstBlockToggle.click();
|
|
await expect(firstBlockText).toBeVisible();
|
|
});
|
|
});
|