chore: import upstream snapshot with attribution
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
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
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import words from '../client/i18n/locales/english/motivation.json';
|
||||
|
||||
test.describe('Learn - Unauthenticated user', () => {
|
||||
test.use({ storageState: { cookies: [], origins: [] } });
|
||||
|
||||
test('the page should render correctly', async ({ page }) => {
|
||||
await page.goto('/learn');
|
||||
|
||||
await expect(page).toHaveTitle(
|
||||
'Learn to Code — For Free — Coding Courses for Busy People'
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', {
|
||||
level: 1,
|
||||
name: "Welcome to freeCodeCamp's curriculum."
|
||||
})
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: 'Sign in to save your progress' })
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Learn - Authenticated user)', () => {
|
||||
test('the page should render correctly', async ({ page }) => {
|
||||
await page.goto('/learn');
|
||||
|
||||
await expect(page).toHaveTitle(
|
||||
'Learn to Code — For Free — Coding Courses for Busy People'
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', {
|
||||
level: 1,
|
||||
name: 'Welcome back, Full Stack User.'
|
||||
})
|
||||
).toBeVisible();
|
||||
|
||||
const shownQuote = await page.getByTestId('random-quote').textContent();
|
||||
|
||||
const shownAuthorText = await page
|
||||
.getByTestId('random-author')
|
||||
.textContent();
|
||||
|
||||
const shownAuthor = shownAuthorText?.replace('- ', '');
|
||||
|
||||
const allMotivationalQuotes = words.motivationalQuotes.map(mq => mq.quote);
|
||||
const allAuthors = words.motivationalQuotes.map(mq => mq.author);
|
||||
|
||||
expect(allMotivationalQuotes).toContain(shownQuote);
|
||||
expect(allAuthors).toContain(shownAuthor);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user