-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsmoke.spec.ts
More file actions
70 lines (63 loc) · 2.49 KB
/
smoke.spec.ts
File metadata and controls
70 lines (63 loc) · 2.49 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { expect, test } from '@playwright/test';
test.describe('frontend smoke', () => {
test('loads create flow and inline access-token gate', async ({ page }) => {
await page.route(/\/api\/v1$/, async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
success: true,
data: {
api: {
name: 'html2rss-web API',
description: 'RESTful API for converting websites to RSS feeds',
openapi_url: 'http://example.test/openapi.yaml',
},
instance: {
feed_creation: {
enabled: true,
access_token_required: true,
},
featured_feeds: [],
},
},
}),
});
});
await page.route(/\/api\/v1\/strategies$/, async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
success: true,
data: {
strategies: [
{ id: 'faraday', name: 'faraday', display_name: 'Default' },
{
id: 'browserless',
name: 'browserless',
display_name: 'JavaScript pages (recommended)',
},
],
},
meta: { total: 2 },
}),
});
});
await page.goto('/');
await expect(page.getByLabel('Page URL')).toBeVisible();
await expect(page.getByRole('button', { name: 'Generate feed URL' })).toBeVisible();
await expect(page.getByLabel('Utilities')).toBeVisible();
await expect(page.getByRole('link', { name: 'Bookmarklet' })).toBeVisible();
await page.getByLabel('Page URL').fill('https://example.com/articles');
await page.getByRole('button', { name: 'Generate feed URL' }).click();
await expect(page.getByRole('heading', { name: 'Enter access token' })).toBeVisible();
await expect(page.getByRole('textbox', { name: 'Access token' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Save and continue' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Back' })).toBeVisible();
await page.getByRole('button', { name: 'Back' }).click();
await expect(page.getByRole('button', { name: 'Generate feed URL' })).toBeVisible();
await expect(page.getByLabel('Utilities')).toBeVisible();
await expect(page.getByRole('link', { name: 'Bookmarklet' })).toBeVisible();
});
});