Skip to content

Commit

Permalink
feat(best): Converted IE runner into general webdriver runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinko committed May 23, 2018
1 parent 63d97c6 commit 6061f7d
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 32 deletions.
31 changes: 31 additions & 0 deletions examples/simple_benchmark/best.chrome.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
projectName: 'simple-benchmark-chrome',
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "chrome",
},
}
}
},
{
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "chrome",
},
}
}
}
],
};
31 changes: 31 additions & 0 deletions examples/simple_benchmark/best.firefox.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
projectName: 'simple-benchmark-firefox',
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "firefox",
},
}
}
},
{
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "firefox",
},
}
}
}
],
};
30 changes: 24 additions & 6 deletions examples/simple_benchmark/best.ie11.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,38 @@ module.exports = {
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-ie11",
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"host": 'localhost',
"port": '4444'
"webdriverOptions": {
"desiredCapabilities": {
"platform": "WINDOWS",
"browserName": "internet explorer",
"version": "11",
"ignoreZoomSetting": true,
"initialBrowserUrl": "about:blank",
"nativeEvents": false,
},
}
}
},
{
"runner": '@best/runner-remote',
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: '/best' },
"remoteRunner": "@best/runner-ie11"
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"platform": "WINDOWS",
"browserName": "internet explorer",
"version": "11",
"ignoreZoomSetting": true,
"initialBrowserUrl": "about:blank",
"nativeEvents": false,
}
}
}
}
],
Expand Down
38 changes: 38 additions & 0 deletions examples/simple_lwc_benchmark/best.chrome.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
projectName: 'lwc-examples-chrome',
plugins: [
'<rootDir>/custom-rollup-transformer/empty-example.js',
['rollup-plugin-lwc-compiler', {
rootDir: '<rootDir>/src/',
mode: 'compat', // We don't really need prod here since this is for test best itself
}]
],
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "chrome",
},
}
}
},
{
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "chrome",
},
}
}
}
],
};
38 changes: 38 additions & 0 deletions examples/simple_lwc_benchmark/best.firefox.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
projectName: 'lwc-examples-firefox',
plugins: [
'<rootDir>/custom-rollup-transformer/empty-example.js',
['rollup-plugin-lwc-compiler', {
rootDir: '<rootDir>/src/',
mode: 'compat', // We don't really need prod here since this is for test best itself
}]
],
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "firefox",
},
}
}
},
{
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"browserName": "firefox",
},
}
}
}
],
};
30 changes: 24 additions & 6 deletions examples/simple_lwc_benchmark/best.ie11.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,38 @@ module.exports = {
benchmarkOnClient: true,
"runnerConfig": [
{
"runner": "@best/runner-ie11",
"runner": "@best/runner-webdriver",
"name": "default",
"config": {
"host": 'localhost',
"port": '4444'
"webdriverOptions": {
"desiredCapabilities": {
"platform": "WINDOWS",
"browserName": "internet explorer",
"version": "11",
"ignoreZoomSetting": true,
"initialBrowserUrl": "about:blank",
"nativeEvents": false,
},
}
}
},
{
"runner": '@best/runner-remote',
"runner": "@best/runner-remote",
"name": "remote",
"config": {
"host": "http://localhost:5000",
"options": { path: '/best' },
"remoteRunner": "@best/runner-ie11"
"options": { path: "/best" },
"remoteRunner": "@best/runner-webdriver",
"webdriverOptions": {
"desiredCapabilities": {
"platform": "WINDOWS",
"browserName": "internet explorer",
"version": "11",
"ignoreZoomSetting": true,
"initialBrowserUrl": "about:blank",
"nativeEvents": false,
}
}
}
}
],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@best/runner-ie11",
"name": "@best/runner-webdriver",
"version": "0.5.1",
"description": "Best Runner for IE 11",
"description": "Best Runner using WebDriver",
"keywords": [
"Best",
"Runner",
"IE11",
"Internet Explorer 11",
"webdriver",
"LWC"
],
"main": "build/index.js",
"dependencies": {
"webdriverio": "4.12.0",
"@best/utils": "0.5.1"
"@best/utils": "0.5.1",
"deepmerge": "2.1.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { getSystemInfo } from '@best/utils';
import { remote as webdriverio } from 'webdriverio';
import merge from 'deepmerge';

const UPDATE_INTERVAL = 500;
const BROWSER_OPTIONS = {
const WEBDRIVERIO_OPTIONS = {
desiredCapabilities: {
platform: 'WINDOWS',
browserName: 'internet explorer',
version: '11',
ignoreZoomSetting: true,
initialBrowserUrl: 'about:blank',
nativeEvents: false,
timeouts: {"implicit": 0, "pageLoad": 300000, "script": 60000},
timeouts: { "implicit": 0, "pageLoad": 300000, "script": 120000 },
},
host: 'localhost',
port: 4444
host: "localhost",
port: "4444",
};

function normalizeRuntimeOptions(projectConfig) {
Expand All @@ -40,7 +35,7 @@ function initializeBenchmarkState(opts) {
};
}

async function normalizeEnvironment(browser, projectConfig, globalConfig) {
async function normalizeEnvironment(browser, projectConfig, globalConfig, webdriverOptions) {
const {
benchmarkOnClient,
benchmarkRunner,
Expand All @@ -53,7 +48,7 @@ async function normalizeEnvironment(browser, projectConfig, globalConfig) {
return {
hardware: { system, cpu, os },
runtime: { load },
browser: { version, options: BROWSER_OPTIONS },
browser: { version, options: webdriverOptions },
configuration: {
project: {
projectName,
Expand Down Expand Up @@ -117,12 +112,13 @@ async function runIterations(page, state, opts, messager) {
export async function run({ benchmarkName, benchmarkEntry }, projectConfig, globalConfig, messager) {
const opts = normalizeRuntimeOptions(projectConfig);
const state = initializeBenchmarkState(opts);
const { projectName } = projectConfig;
const { projectName, benchmarkRunnerConfig } = projectConfig;
const webdriverOptions = merge(WEBDRIVERIO_OPTIONS, benchmarkRunnerConfig.webdriverOptions);

let browser;
try {
browser = webdriverio(BROWSER_OPTIONS);
const environment = await normalizeEnvironment(browser, projectConfig, globalConfig);
browser = webdriverio(webdriverOptions);
const environment = await normalizeEnvironment(browser, projectConfig, globalConfig, webdriverOptions);

messager.onBenchmarkStart(benchmarkName, projectName);

Expand Down

0 comments on commit 6061f7d

Please sign in to comment.