Skip to content

Commit

Permalink
wdio5 service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amitzur committed Jun 15, 2020
1 parent 10c42f6 commit feb1573
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 573 deletions.
4 changes: 1 addition & 3 deletions packages/eyes-webdriverio-5-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
},
"scripts": {
"lint": "eslint . --ext .js --no-eslintrc --config ../../.eslintrc",
"test": "yarn test:classic && yarn test:vg",
"test:classic": "wdio tests/wdio.conf.js",
"test:vg": "wdio tests/wdio.conf.vg.js",
"test": "wdio tests/wdio.conf.js",
"preversion": "bongo preversion && yarn test",
"version": "bongo version",
"postversion": "bongo postversion --skip-release-notification"
Expand Down
10 changes: 10 additions & 0 deletions packages/eyes-webdriverio-5-service/tests/basic.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* global browser */
'use strict'
const {Target} = require('@applitools/eyes-webdriverio')

describe('EyesServiceTest', () => {
it('checkWindow', () => {
browser.url('https://applitools.github.io/demo/TestPages/FramesTestPage/index.html')
browser.eyesCheck('', Target.window())
})
})
9 changes: 0 additions & 9 deletions packages/eyes-webdriverio-5-service/tests/vg.spec.js

This file was deleted.

25 changes: 25 additions & 0 deletions packages/eyes-webdriverio-5-service/tests/wdio.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require('path')
const {EyesService} = require('@applitools/eyes-webdriverio')

exports.config = {
runner: 'local',
specs: [path.join(__dirname, '*.spec.js')],
capabilities: [
{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['headless'],
},
},
],
logLevel: 'error',
services: [[EyesService]],
port: 4444,
path: '/wd/hub',
framework: 'mocha',
reporters: ['dot'],
mochaOpts: {
ui: 'bdd',
timeout: 120000,
},
}
277 changes: 0 additions & 277 deletions packages/eyes-webdriverio-5-service/tests/wdio.conf.vg.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/eyes-webdriverio-5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"test": "yarn test:unit && yarn test:it && yarn test:e2e",
"test:e2e": "mocha --no-timeouts \"test/+(TestClassicApi*.js|TestFluentApi*.js|TestVisualGrid*.js)\"",
"test:it": "mocha --no-timeouts \"test/it/*.js\"",
"test:service": "wdio \"test/service/wdio.conf.js\"",
"test:service": "wdio \"test/service/wdio.conf.js\" && wdio \"test/service/no-config/wdio.no-config.conf.js\" && wdio \"test/service/vg/wdio.vg.conf.js\"",
"test:unit": "mocha \"test/unit/**/*.js\"",
"coverage:generate": "coverage-tests create-tests",
"coverage:sandbox": "coverage-tests create-tests && yarn test:coverage && coverage-tests process-report",
Expand Down
17 changes: 6 additions & 11 deletions packages/eyes-webdriverio-5/src/EyesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const DEFAULT_VIEWPORT = {

class EyesService {
constructor(config) {
this._eyesConfig = getServiceConfig(config)
this._eyesConfig = getServiceConfig(config) || {}
const runner = this._eyesConfig.useVisualGrid
? new VisualGridRunner(this._eyesConfig.concurrency)
: undefined
Expand All @@ -37,12 +37,9 @@ class EyesService {
* @param {Array.<Object>} capabilities list of capabilities details
* @param {Array.<String>} specs List of spec file paths that are to be run
*/
// eslint-disable-next-line
beforeSession(config, capabilities, specs) {
if (this._eyesConfig) {
this._eyes.setConfiguration(this._eyesConfig)
this._appName = this._eyes.getConfiguration().getAppName()
}
beforeSession(config, _capabilities, _specs) {
this._eyes.setConfiguration(this._eyesConfig)
this._appName = this._eyes.getConfiguration().getAppName()
if (config.enableEyesLogs) {
this._eyes.setLogHandler(new ConsoleLogHandler(true))
}
Expand All @@ -55,8 +52,7 @@ class EyesService {
* @param {Array.<Object>} capabilities list of capabilities details
* @param {Array.<String>} specs List of spec file paths that are to be run
*/
// eslint-disable-next-line
before(capabilities, specs) {
before(_capabilities, _specs) {
global.browser.addCommand(
'eyesCheck',
async (title, checkSettings = Target.window().fully()) => {
Expand Down Expand Up @@ -130,8 +126,7 @@ class EyesService {
*
* @param {Object} test test details
*/
// eslint-disable-next-line
afterTest(test) {
afterTest(_test) {
// the next line is required because if we set an element in one test, then the following test
// will say that the element is not attached to the page (because different browsers are used)
this._eyes._scrollRootElement = undefined
Expand Down
Loading

0 comments on commit feb1573

Please sign in to comment.