This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathasync_spec.js
72 lines (61 loc) · 2.78 KB
/
async_spec.js
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
describe('async angular1/2 hybrid using ngUpgrade application', () => {
describe('@angular/upgrade/static', () => {
it('should be able to click buttons and wait for $timeout', async () => {
await browser.get('/upgrade');
const rootBtn = $$('my-app button').first();
expect(await rootBtn.getText()).toEqual('Click Count: 0');
await rootBtn.click();
expect(await rootBtn.getText()).toEqual('Click Count: 1');
const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
const ng1Btn = $('ng1 button');
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
await ng1Btn.click();
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
});
it('should be able to automatically infer ng1/ng2/ngUpgrade', async () => {
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
await browser.get('/ng1');
expect(await $$('h4').first().getText()).toBe('Bindings');
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
await browser.get('/ng2');
expect(await $('h1').getText()).toBe('Test App for Angular 2');
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
});
});
describe('@angular/upgrade (not static)', () => {
it('should be able to click buttons and wait for $timeout', async () => {
await browser.get('/upgrade?no_static');
const rootBtn = $$('my-app button').first();
expect(await rootBtn.getText()).toEqual('Click Count: 0');
await rootBtn.click();
expect(await rootBtn.getText()).toEqual('Click Count: 1');
const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
const ng1Btn = $('ng1 button');
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
await ng1Btn.click();
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
});
});
});
describe('async angular1/2 hybrid using downgrade application', () => {
it('should be able to click buttons and wait for $timeout', async () => {
await browser.get('/upgrade?downgrade');
const rootBtn = $$('my-app button').first();
expect(await rootBtn.getText()).toEqual('Click Count: 0');
await rootBtn.click();
expect(await rootBtn.getText()).toEqual('Click Count: 1');
const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
});
});