forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeally.spec.ts
44 lines (38 loc) · 1.52 KB
/
codeally.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 --set-true isDonating');
});
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.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'
);
});
});