-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathangular-selector-test.js
More file actions
42 lines (33 loc) · 1.42 KB
/
angular-selector-test.js
File metadata and controls
42 lines (33 loc) · 1.42 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
import { AngularSelector, waitForAngular } from '../src';
runTests('AngularSelector (Angular v15)', 'http://localhost:8080/test/data/angular-15/dist/index-aot.html');
function runTests (fixtureLabel, pageUrl) {
fixture(fixtureLabel)
.page(pageUrl)
.beforeEach(async () => {
await waitForAngular();
});
test('root', async t => {
const root = AngularSelector();
const rootAngular = await root.getAngular();
await t
.expect(root.exists).ok()
.expect(rootAngular.rootProp1).eql(1);
//eslint-disable-next-line
await t.expect(rootAngular.hasOwnProperty('__ngContext__')).notOk();
});
test('selector', async t => {
const list = AngularSelector('list');
const listAngular = await list.getAngular();
await t.expect(list.count).eql(2)
.expect(AngularSelector('list-item').count).eql(6)
.expect(listAngular.id).eql('list1');
});
test('composite selector', async t => {
const listItem = AngularSelector('list list-item');
const listItemAngular6 = await listItem.nth(5).getAngular();
const listItemAngular5Id = listItem.nth(4).getAngular(({ state }) => state.id);
await t.expect(listItem.count).eql(6)
.expect(listItemAngular6.id).eql('list2-item3')
.expect(listItemAngular5Id).eql('list2-item2');
});
}