Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit ef06bde

Browse files
committed
fix(scenarios.js): change repeater and add sleep due to the debounce in the template
1 parent 725b19a commit ef06bde

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

e2e-tests/scenarios.js

+34-20
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,31 @@ describe('PhoneCat Application', function() {
1717
});
1818

1919
it('should filter the phone list as a user types into the search box', function() {
20-
var phoneList = element.all(by.repeater('phone in $ctrl.phones'));
20+
var phoneList = element.all(by.repeater('phone in filtered'));
2121
var query = element(by.model('$ctrl.query'));
2222

2323
expect(phoneList.count()).toBe(20);
2424

2525
query.sendKeys('nexus');
26-
expect(phoneList.count()).toBe(1);
27-
26+
27+
browser.sleep(1000).then(function(){
28+
expect(phoneList.count()).toBe(1);
29+
});
30+
2831
query.clear();
2932
query.sendKeys('motorola');
30-
expect(phoneList.count()).toBe(8);
33+
34+
browser.sleep(1000).then(function(){
35+
expect(phoneList.count()).toBe(8);
36+
});
37+
3138
});
3239

3340
it('should be possible to control phone order via the drop-down menu', function() {
3441
var queryField = element(by.model('$ctrl.query'));
3542
var orderSelect = element(by.model('$ctrl.orderProp'));
3643
var nameOption = orderSelect.element(by.css('option[value="name"]'));
37-
var phoneNameColumn = element.all(by.repeater('phone in $ctrl.phones').column('phone.name'));
44+
var phoneNameColumn = element.all(by.repeater('phone in filtered').column('phone.name'));
3845

3946
function getNames() {
4047
return phoneNameColumn.map(function(elem) {
@@ -43,26 +50,33 @@ describe('PhoneCat Application', function() {
4350
}
4451

4552
queryField.sendKeys('tablet'); // Let's narrow the dataset to make the assertions shorter
46-
47-
expect(getNames()).toEqual([
48-
'Motorola XOOM\u2122 with Wi-Fi',
49-
'MOTOROLA XOOM\u2122'
50-
]);
51-
52-
nameOption.click();
53-
54-
expect(getNames()).toEqual([
55-
'MOTOROLA XOOM\u2122',
56-
'Motorola XOOM\u2122 with Wi-Fi'
57-
]);
53+
54+
browser.sleep(1000).then(function(){
55+
56+
expect(getNames()).toEqual([
57+
'Motorola XOOM\u2122 with Wi-Fi',
58+
'MOTOROLA XOOM\u2122'
59+
]);
60+
61+
nameOption.click();
62+
63+
expect(getNames()).toEqual([
64+
'MOTOROLA XOOM\u2122',
65+
'Motorola XOOM\u2122 with Wi-Fi'
66+
]);
67+
68+
});
5869
});
5970

6071
it('should render phone specific links', function() {
6172
var query = element(by.model('$ctrl.query'));
6273
query.sendKeys('nexus');
63-
64-
element.all(by.css('.phones li a')).first().click();
65-
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
74+
75+
browser.sleep(1000).then(function(){
76+
element.all(by.css('.phones li a')).first().click();
77+
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
78+
});
79+
6680
});
6781

6882
});

0 commit comments

Comments
 (0)