This repository was archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathspec.js
More file actions
52 lines (43 loc) · 1.36 KB
/
spec.js
File metadata and controls
52 lines (43 loc) · 1.36 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
var env = {
// 'app' === name of service started in ../docker-compose.yml
url: 'http://app:8080'
}
describe('slow calculator', () => {
beforeEach(() => {
browser.get(env.url + '/ng1/calculator');
});
it('should add numbers', () => {
element(by.model('first')).sendKeys(4);
element(by.model('second')).sendKeys(5);
element(by.id('gobutton')).click();
expect(element(by.binding('latest')).getText()).toEqual('9');
});
describe('memory', () => {
var first, second, goButton;
beforeEach(function() {
first = element(by.model('first'));
second = element(by.model('second'));
goButton = element(by.id('gobutton'));
});
it('should start out with an empty memory', () => {
var memory =
element.all(by.repeater('result in memory'));
expect(memory.count()).toEqual(0);
});
it('should fill the memory with past results', () => {
first.sendKeys(1);
second.sendKeys(1);
goButton.click();
first.sendKeys(10);
second.sendKeys(20);
goButton.click();
var memory = element.all(by.repeater('result in memory').
column('result.value'));
memory.then((arr) => {
expect(arr.length).toEqual(2);
expect(arr[0].getText()).toEqual('30'); // 10 + 20 = 30
expect(arr[1].getText()).toEqual('2'); // 1 + 1 = 2
});
});
});
});