Skip to content

Commit d3e04a2

Browse files
committed
test(image-loader): fix failing tests
1 parent 391e4b1 commit d3e04a2

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

e2e/protractor.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ exports.config = {
99
capabilities: {
1010
browserName: 'chrome',
1111
chromeOptions: {
12-
args: ['--headless', '--no-sandbox', '--window-size=1024,768']
13-
}
12+
args: ['--headless', '--no-sandbox', '--window-size=1024,768'],
13+
},
1414
},
1515
directConnect: true,
1616
baseUrl: 'http://localhost:4200/',
1717
framework: 'jasmine',
1818
jasmineNodeOpts: {
1919
showColors: true,
2020
defaultTimeoutInterval: 30000,
21-
print: function() {}
21+
print: function() {},
2222
},
2323
onPrepare() {
2424
require('ts-node').register({
25-
project: require('path').join(__dirname, './tsconfig.e2e.json')
25+
project: require('path').join(__dirname, './tsconfig.e2e.json'),
2626
});
2727
jasmine
2828
.getEnv()
2929
.addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
30-
}
30+
},
3131
};

e2e/src/app.po.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ export class AppPage {
88
scrollTo(x: number = 0, y: number = 0) {
99
browser.executeScript(`return window.scrollTo(${x}, ${y});`);
1010
return browser.wait(() =>
11-
this.getScrollYPosition().then(posY => posY === y)
11+
this.getScrollYPosition().then(posY => posY === y),
1212
);
1313
}
1414

1515
scrollIntoView(selector: string) {
1616
return browser.executeScript(
17-
`return document.querySelector('${selector}').scrollIntoView()`
17+
`return document.querySelector('${selector}').scrollIntoView()`,
1818
);
1919
}
2020

@@ -34,21 +34,10 @@ export class AppPage {
3434
}
3535

3636
setWindowSize(x: number, y: number) {
37-
browser.driver
37+
return browser.driver
3838
.manage()
3939
.window()
4040
.setSize(x, y);
41-
return browser.wait(() =>
42-
this.getWindowSize().then(
43-
(size: any) => size.height === y && size.width === x
44-
)
45-
);
46-
}
47-
48-
getWindowSize() {
49-
return browser.executeScript(
50-
`return { height: window.outerHeight, width: window.outerWidth };`
51-
);
5241
}
5342

5443
getScrollYPosition() {
@@ -125,19 +114,19 @@ export class AppPage {
125114

126115
isImageTopLoaded() {
127116
return this.getImageTopLoaderCompClass().then((result: string) =>
128-
result.includes('sn-image-loaded')
117+
result.includes('sn-image-loaded'),
129118
);
130119
}
131120

132121
isImageBottomLoaded() {
133122
return this.getImageBottomLoaderCompClass().then((result: string) =>
134-
result.includes('sn-image-loaded')
123+
result.includes('sn-image-loaded'),
135124
);
136125
}
137126

138127
isVideoLoaded() {
139128
return this.getVideoElementClass().then((result: string) =>
140-
result.includes('sn-video-loaded')
129+
result.includes('sn-video-loaded'),
141130
);
142131
}
143132

e2e/src/image-loader.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ describe('ImageLoader Lib E2E Tests', function() {
134134
let expected = '0';
135135
expect(result).toEqual(expected);
136136

137+
page.scrollTo();
137138
page.setWindowSize(400, 580);
138139
page.scrollToImageBottomElement();
139140
result = page.getImageBottomLoadedCountElementText();

0 commit comments

Comments
 (0)