feat(build): enforce mobile layout during e2e tests

This is important as we run our benchmarks on
mobile devices as web driver tests fails if buttons
are not visible / overlaid by other content.
This commit is contained in:
Tobias Bosch 2015-02-27 09:07:16 -08:00
parent 7e6f536cf5
commit 3b40052dc7
8 changed files with 53 additions and 41 deletions

View File

@ -13,8 +13,8 @@ describe('ng2 naive infinite scroll benchmark', function () {
url: URL,
id: 'ng2.naive_infinite_scroll',
work: function() {
element(by.deepCss('#reset-btn')).click();
element(by.deepCss('#run-btn')).click();
$('#reset-btn').click();
$('#run-btn').click();
browser.wait(() => {
return $('#done').getText().then(
function() { return true; },

View File

@ -53,10 +53,8 @@ describe('ng2 naive infinite scroll benchmark', function () {
});
})
browser.executeScript(
'document.querySelector("scroll-app /deep/ #reset-btn").click()');
browser.executeScript(
'document.querySelector("scroll-app /deep/ #run-btn").click()');
$("#reset-btn").click();
$("#run-btn").click();
browser.wait(() => {
return $('#done').getText().then(
function() { return true; },

View File

@ -23,11 +23,10 @@ export class App {
for (var i = 0; i < appSize; i++) {
ListWrapper.push(this.scrollAreas, i);
}
// TODO(tbosch): change to bindAction when it works in pub serve
DOM.on(DOM.query('scroll-app /deep/ #run-btn'), 'click', (_) => {
bindAction('#run-btn', () => {
this.runBenchmark();
});
DOM.on(DOM.query('scroll-app /deep/ #reset-btn'), 'click', (_) => {
bindAction('#reset-btn', () => {
this._getScrollDiv().scrollTop = 0;
var existingMarker = this._locateFinishedMarker();
if (isPresent(existingMarker)) {
@ -90,10 +89,6 @@ export function setupReflectorForApp() {
<div>
<div style="display: flex">
<scroll-area id="testArea"></scroll-area>
<div style="padding-left: 20px">
<button id="run-btn">Run</button>
<button id="reset-btn">Reset</button>
</div>
</div>
<div template="if scrollAreas.length > 0">
<p>Following tables are only here to add weight to the UI:</p>

View File

@ -9,6 +9,10 @@
Iteration count: <input type="text" name="iterationCount" value="1"></input><br>
Scroll increment: <input type="text" name="scrollIncrement" value="1"></input><br>
</form>
<div>
<button id="run-btn">Run</button>
<button id="reset-btn">Reset</button>
</div>
<scroll-app></scroll-app>
$SCRIPTS$

View File

@ -13,8 +13,8 @@ describe('ng-dart1.x naive infinite scroll benchmark', function () {
url: URL,
id: 'ng1-dart1.x.naive_infinite_scroll',
work: function() {
element(by.deepCss('#reset-btn')).click();
element(by.deepCss('#run-btn')).click();
$('#reset-btn').click();
$('#run-btn').click();
var s = 1000;
if (appSize > 4) {
s = s + appSize * 100;

View File

@ -11,10 +11,6 @@ import 'package:angular2/src/test_lib/benchmark_util.dart';
<div>
<div style="display: flex">
<scroll-area scroll-top="scrollTop"></scroll-area>
<div style="padding-left: 20px">
<button id='run-btn'>Run</button>
<button id='reset-btn'>Reset</button>
</div>
</div>
<div ng-if="scrollAreas.length > 0">
<p>Following tables are only here to add weight to the UI:</p>
@ -39,10 +35,10 @@ class App implements ShadowRootAware {
@override
void onShadowRoot(ShadowRoot shadowRoot) {
bindAction('scroll-app /deep/ #run-btn', () {
bindAction('#run-btn', () {
runBenchmark();
});
bindAction('scroll-app /deep/ #reset-btn', () {
bindAction('#reset-btn', () {
scrollTop = 0;
});
}

View File

@ -9,6 +9,10 @@
Iteration count: <input type="text" name="iterationCount" value="1"></input><br>
Scroll increment: <input type="text" name="scrollIncrement" value="1"></input><br>
</form>
<div>
<button id="run-btn">Run</button>
<button id="reset-btn">Reset</button>
</div>
<scroll-app></scroll-app>
$SCRIPTS$

View File

@ -33,17 +33,32 @@ var argv = require('yargs')
var browsers = argv['browsers'].split(',');
var CHROME_OPTIONS = {
'args': ['--js-flags=--expose-gc'],
'perfLoggingPrefs': {
'traceCategories': 'blink.console,disabled-by-default-devtools.timeline'
}
};
var CHROME_MOBILE_EMULATION = {
// Can't use 'deviceName':'Google Nexus 7 2'
// as this would yield wrong orientation,
// so we specify facts explicitly
'deviceMetrics': {
'width': 600,
'height': 960,
'pixelRatio': 2
}
};
var BROWSER_CAPS = {
Dartium: {
name: 'Dartium',
browserName: 'chrome',
chromeOptions: {
'binary': process.env.DARTIUM,
'args': ['--js-flags=--expose-gc'],
'perfLoggingPrefs': {
'traceCategories': 'blink.console,disabled-by-default-devtools.timeline'
}
},
chromeOptions: mergeInto(CHROME_OPTIONS, {
'mobileEmulation': CHROME_MOBILE_EMULATION,
'binary': process.env.DARTIUM
}),
loggingPrefs: {
performance: 'ALL',
browser: 'ALL'
@ -51,12 +66,9 @@ var BROWSER_CAPS = {
},
ChromeDesktop: {
browserName: 'chrome',
chromeOptions: {
'args': ['--js-flags=--expose-gc'],
'perfLoggingPrefs': {
'traceCategories': 'blink.console,disabled-by-default-devtools.timeline'
}
},
chromeOptions: mergeInto(CHROME_OPTIONS, {
'mobileEmulation': CHROME_MOBILE_EMULATION
}),
loggingPrefs: {
performance: 'ALL',
browser: 'ALL'
@ -64,13 +76,9 @@ var BROWSER_CAPS = {
},
ChromeAndroid: {
browserName: 'chrome',
chromeOptions: {
androidPackage: 'com.android.chrome',
'args': ['--js-flags=--expose-gc'],
'perfLoggingPrefs': {
'traceCategories': 'blink.console,disabled-by-default-devtools.timeline'
}
},
chromeOptions: mergeInto(CHROME_OPTIONS, {
'androidPackage': 'com.android.chrome',
}),
loggingPrefs: {
performance: 'ALL',
browser: 'ALL'
@ -201,3 +209,10 @@ exports.createBenchpressRunner = function(options) {
global.benchpressRunner = new benchpress.Runner(bindings);
}
function mergeInto(src, target) {
for (var prop in src) {
target[prop] = src[prop];
}
return target;
}