mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
feat: convert Codeally test to Playwright (#54876)
This commit is contained in:
46
e2e/codeally.spec.ts
Normal file
46
e2e/codeally.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Before completing the project', () => {
|
||||
test.use({ storageState: 'playwright/.auth/development-user.json' });
|
||||
|
||||
test.beforeEach(() => {
|
||||
execSync('node ./tools/scripts/seed/seed-demo-user --donor');
|
||||
});
|
||||
|
||||
test('should not allow you to submit a URL', async ({ page }) => {
|
||||
await page.goto(
|
||||
'/learn/relational-database/build-a-celestial-bodies-database-project/build-a-celestial-bodies-database'
|
||||
);
|
||||
await page
|
||||
.getByRole('textbox', { name: 'solution' })
|
||||
.fill('https://example.com');
|
||||
await page.getByRole('textbox', { name: 'solution' }).press('Enter');
|
||||
await expect(page.getByTestId('flash-message')).toContainText(
|
||||
/You must complete the project first./
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('After completing the project', () => {
|
||||
test.use({ storageState: 'playwright/.auth/certified-user.json' });
|
||||
|
||||
test.beforeAll(() => {
|
||||
execSync('node ./tools/scripts/seed/seed-demo-user certified-user');
|
||||
});
|
||||
|
||||
test('should allow you to submit a URL', async ({ page }) => {
|
||||
await page.goto(
|
||||
'/learn/relational-database/build-a-celestial-bodies-database-project/build-a-celestial-bodies-database'
|
||||
);
|
||||
await page
|
||||
.getByRole('textbox', { name: 'solution' })
|
||||
.fill('https://example.com');
|
||||
await page.getByRole('textbox', { name: 'solution' }).press('Enter');
|
||||
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
await expect(page.getByRole('dialog')).toContainText(
|
||||
'Submit and go to next challenge'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user