forked from nullstack/nullstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFullStackLifecycle.test.js
More file actions
49 lines (39 loc) · 1.3 KB
/
FullStackLifecycle.test.js
File metadata and controls
49 lines (39 loc) · 1.3 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
const puppeteer = require('puppeteer');
let browser;
let page;
beforeAll(async () => {
browser = await puppeteer.launch();
page = await browser.newPage();
await page.goto('http://localhost:6969/full-stack-lifecycle');
});
describe('FullStackLifecycle', () => {
test('prepare should run', async () => {
await page.waitForSelector('[data-prepared]');
const element = await page.$('[data-prepared]');
expect(element).toBeTruthy();
});
test('initiate should run', async () => {
await page.waitForSelector('[data-initiated]');
const element = await page.$('[data-initiated]');
expect(element).toBeTruthy();
});
test('hydrate should run', async () => {
await page.waitForSelector('[data-hydrated]');
const element = await page.$('[data-hydrated]');
expect(element).toBeTruthy();
});
test('update should run', async () => {
await page.waitForSelector('[data-updated]');
const element = await page.$('[data-updated]');
expect(element).toBeTruthy();
});
test('terminate should run', async () => {
await page.click('a[href="/"]');
await page.waitForFunction(() => location.search == '?terminated=true');
const element = await page.$('.FullStackLifecycle');
expect(element).toBeFalsy();
});
});
afterAll(async () => {
browser.close();
});