-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathFullStackLifecycle.test.js
More file actions
124 lines (105 loc) · 4.06 KB
/
FullStackLifecycle.test.js
File metadata and controls
124 lines (105 loc) · 4.06 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
describe('FullStackLifecycle ssr', () => {
beforeAll(async () => {
await page.goto('http://localhost:6969/full-stack-lifecycle')
})
test('prepare should run', async () => {
await page.waitForSelector('[data-prepared]')
const element = await page.$('[data-prepared]')
expect(element).toBeTruthy()
})
test('prepare should run in the server for ssr', async () => {
await page.waitForSelector('[data-prepare-env="server"]')
const element = await page.$('[data-prepare-env="server"]')
expect(element).toBeTruthy()
})
test('initiate should run', async () => {
await page.waitForSelector('[data-initiated]')
const element = await page.$('[data-initiated]')
expect(element).toBeTruthy()
})
test('initiate should run in the server for ssr', async () => {
await page.waitForSelector('[data-initiate-env="server"]')
const element = await page.$('[data-initiate-env="server"]')
expect(element).toBeTruthy()
})
test('launch should run', async () => {
await page.waitForSelector('[data-launched]')
const element = await page.$('[data-launched]')
expect(element).toBeTruthy()
})
test('launch should run in the server for ssr', async () => {
await page.waitForSelector('[data-launch-env="server"]')
const element = await page.$('[data-launch-env="server"]')
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()
})
})
describe('FullStackLifecycle spa', () => {
beforeAll(async () => {
await page.goto('http://localhost:6969/')
await page.waitForSelector('[data-application-hydrated]')
await page.click('a[href="/full-stack-lifecycle"]')
await page.waitForSelector('[data-hydrated]')
})
test('prepare should run', async () => {
await page.waitForSelector('[data-prepared]')
const element = await page.$('[data-prepared]')
expect(element).toBeTruthy()
})
test('prepare should run in the client for spa', async () => {
await page.waitForSelector('[data-prepare-env="client"]')
const element = await page.$('[data-prepare-env="client"]')
expect(element).toBeTruthy()
})
test('initiate should run', async () => {
await page.waitForSelector('[data-initiated]')
const element = await page.$('[data-initiated]')
expect(element).toBeTruthy()
})
test('initiate should run in the client for spa', async () => {
await page.waitForSelector('[data-initiate-env="client"]')
const element = await page.$('[data-initiate-env="client"]')
expect(element).toBeTruthy()
})
test('launch should run', async () => {
await page.waitForSelector('[data-launched]')
const element = await page.$('[data-launched]')
expect(element).toBeTruthy()
})
test('launch should run in the client for spa', async () => {
await page.waitForSelector('[data-launch-env="client"]')
const element = await page.$('[data-launch-env="client"]')
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()
})
})