diff --git a/.editorconfig b/.editorconfig
index 9d8fb08..27ca0f7 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,5 +8,5 @@ trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
-[{package.json,.eslintrc.json,.travis.yml}]
+[*.{json,yml}]
indent_size = 2
diff --git a/.gitignore b/.gitignore
index 9c2ad06..6697282 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/shower.js
/shower.min.js
/tests/unit/tests.js
+/tests_output
diff --git a/Gulpfile.js b/Gulpfile.js
index f528a74..51ad688 100644
--- a/Gulpfile.js
+++ b/Gulpfile.js
@@ -8,7 +8,6 @@ const lintspaces = require('gulp-lintspaces');
const mocha = require('gulp-mocha-phantomjs');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
-const webdriver = require('gulp-webdriver');
const pkg = require('./package.json');
const now = new Date().getFullYear();
@@ -24,10 +23,9 @@ gulp.task('lint:ec', () => {
const sources = [
'.editorconfig',
'.gitignore',
- '*.{json,yml,md}',
+ '{.,}*.{json,yml,md}',
'lib/**',
'tests/**',
- 'wdio.conf.js',
];
const options = {
@@ -38,7 +36,7 @@ gulp.task('lint:ec', () => {
],
};
- return gulp.src(sources, { dot: true })
+ return gulp.src(sources)
.pipe(lintspaces(options))
.pipe(lintspaces.reporter());
});
@@ -81,11 +79,6 @@ gulp.task('minify', [ 'concat:lib' ], () => {
.pipe(gulp.dest('.'));
});
-gulp.task('webdriver', () => {
- return gulp.src('wdio.conf.js')
- .pipe(webdriver());
-});
-
gulp.task('mocha', () => {
return gulp.src('tests/unit/index.html')
.pipe(mocha());
@@ -107,17 +100,8 @@ gulp.task('build', [
'minify',
]);
-gulp.task('test', [
+gulp.task('unit', [
'lint',
- 'test:unit',
- 'test:func',
-]);
-
-gulp.task('test:func', [
- 'webdriver',
-]);
-
-gulp.task('test:unit', [
'concat:test',
'mocha',
]);
diff --git a/lib/shower/shower.Container.js b/lib/shower/shower.Container.js
index 036c581..8244c94 100644
--- a/lib/shower/shower.Container.js
+++ b/lib/shower/shower.Container.js
@@ -201,11 +201,13 @@ shower.modules.define('shower.Container', [
return;
}
+ var slideNumber;
+
switch (e.which) {
case 13: // Enter
e.preventDefault();
if (!this.isSlideMode() && e.metaKey) {
- var slideNumber = e.shiftKey ? 0 : this._shower.player.getCurrentSlideIndex();
+ slideNumber = e.shiftKey ? 0 : this._shower.player.getCurrentSlideIndex();
this._shower.player.go(slideNumber);
this.enterSlideMode();
} else {
@@ -225,7 +227,7 @@ shower.modules.define('shower.Container', [
case 116: // F5 Shift
if (!this.isSlideMode() && e.shiftKey) {
e.preventDefault();
- var slideNumber = this._shower.player.getCurrentSlideIndex();
+ slideNumber = this._shower.player.getCurrentSlideIndex();
this._shower.player.go(slideNumber);
this.enterSlideMode();
}
@@ -242,4 +244,4 @@ shower.modules.define('shower.Container', [
});
provide(Container);
-});
\ No newline at end of file
+});
diff --git a/nightwatch.json b/nightwatch.json
new file mode 100644
index 0000000..0f6fc26
--- /dev/null
+++ b/nightwatch.json
@@ -0,0 +1,23 @@
+{
+ "src_folders" : ["tests/functional"],
+ "globals_path": "tests/chromedriver.js",
+ "selenium": {
+ "start_process": false
+ },
+
+ "test_settings": {
+ "default": {
+ "selenium_port": 9515,
+ "selenium_host": "localhost",
+ "default_path_prefix": "",
+
+ "desiredCapabilities": {
+ "browserName": "chrome",
+ "chromeOptions": {
+ "args": ["--no-sandbox"]
+ },
+ "acceptSslCerts": true
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
index c979d09..2cb9879 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"devDependencies": {
"chai": "^3.5.0",
"chai-dom": "^1.4.3",
+ "chromedriver": "^2.27.2",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
@@ -57,6 +58,7 @@
"gulp-uglify": "^2.0.0",
"gulp-webdriver": "^2.0.3",
"mocha": "^3.0.2",
+ "nightwatch": "^0.9.12",
"selenium-standalone": "^5.6.3",
"shower-next": "0.0.6",
"shower-progress": "0.0.9",
@@ -73,7 +75,7 @@
"prepublish": "gulp build",
"build": "gulp build",
"lint": "gulp lint",
- "test": "gulp test",
+ "test": "gulp unit && nightwatch",
"report": "allure report generate -o allure-report allure-results && allure report open -o allure-report"
}
}
diff --git a/tests/chromedriver.js b/tests/chromedriver.js
new file mode 100644
index 0000000..976fde6
--- /dev/null
+++ b/tests/chromedriver.js
@@ -0,0 +1,12 @@
+'use strict';
+const chromedriver = require('chromedriver');
+
+module.exports = {
+ before: done => {
+ chromedriver.start();
+ done();
+ },
+ after: () => {
+ chromedriver.stop();
+ },
+};
diff --git a/tests/functional/a11y/test.js b/tests/functional/a11y/test.js
index 952d9ca..0967b3e 100644
--- a/tests/functional/a11y/test.js
+++ b/tests/functional/a11y/test.js
@@ -1,21 +1,16 @@
-describe('a11y', () => {
+'use strict';
+module.exports = {
+ '@tags': ['a11y'],
- beforeEach(() => {
- browser.url('about:blank');
- });
+ 'doesn’t add `application` role in list mode': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.assert.elementNotPresent('.shower[role=application]');
+ browser.end();
+ },
- afterEach(() => {
- browser.sessionStorage('DELETE');
- });
-
- it('doesn’t add `application` role in list mode', () => {
- browser.url('/a11y/list.html');
- browser.isExisting('.shower[role=application]').should.equal(false);
- });
-
- it('adds `application` role in full mode', () => {
- browser.url('/a11y/full.html');
- browser.isExisting('.shower[role=application]').should.equal(true);
- });
-
-});
+ 'adds `application` role in full screen mode': browser => {
+ browser.url(`file:///${__dirname}/full.html`);
+ browser.assert.elementPresent('.shower[role=application]');
+ browser.end();
+ },
+};
diff --git a/tests/functional/core/full.html b/tests/functional/core/full.html
index 5616928..d8e0592 100644
--- a/tests/functional/core/full.html
+++ b/tests/functional/core/full.html
@@ -5,7 +5,7 @@
-
+
diff --git a/tests/functional/core/list.html b/tests/functional/core/list.html
index 6306b6e..07c5654 100644
--- a/tests/functional/core/list.html
+++ b/tests/functional/core/list.html
@@ -5,7 +5,7 @@
-
+
diff --git a/tests/functional/core/none.html b/tests/functional/core/none.html
index 991236f..7967224 100644
--- a/tests/functional/core/none.html
+++ b/tests/functional/core/none.html
@@ -5,7 +5,7 @@
-
+
diff --git a/tests/functional/core/test.js b/tests/functional/core/test.js
index f96ac4c..573c163 100644
--- a/tests/functional/core/test.js
+++ b/tests/functional/core/test.js
@@ -1,125 +1,152 @@
-describe('core', () => {
-
- beforeEach(() => {
- browser.url('about:blank');
- });
-
- afterEach(() => {
- browser.sessionStorage('DELETE');
- });
-
- // Initialisation
-
- it('uses `list` mode in lack of any', () => {
- browser.url('/core/none.html');
- browser.isExisting('.shower.list').should.equal(true);
- });
-
- it('stays in `list` mode if `list` is present', () => {
- browser.url('/core/list.html');
- browser.isExisting('.shower.list').should.equal(true);
- });
-
- it('stays in `full` mode if `full` is present', () => {
- browser.url('/core/full.html');
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- it('keeps `full` mode after reload', () => {
- browser.url('/core/full.html');
+'use strict';
+module.exports = {
+ '@tags': ['core'],
+
+ // Init
+
+ 'uses `list` mode in lack of any': browser => {
+ browser.url(`file:///${__dirname}/none.html`);
+ browser.assert.elementPresent('.shower.list');
+ browser.end();
+ },
+
+ 'stays in `list` mode if `list` is present': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.assert.elementPresent('.shower.list');
+ browser.end();
+ },
+
+ 'stays in `full` mode if `full` is present': browser => {
+ browser.url(`file:///${__dirname}/full.html`);
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
+
+ 'keeps `full` mode after reload': browser => {
+ browser.url(`file:///${__dirname}/full.html`);
browser.refresh();
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- it('adds ID to all slides if it’s not alredy set', () => {
- browser.url('/core/list.html');
- browser.isExisting('[id="1"]').should.equal(true);
- browser.isExisting('[id="2"]').should.equal(false);
- browser.isExisting('[id="ID"]').should.equal(true);
- browser.isExisting('[id="3"]').should.equal(true);
- });
-
- it('doesn’t set any slide states on initialisation', () => {
- browser.url('/core/list.html');
- browser.isExisting('.active').should.equal(false);
- browser.isExisting('.visited').should.equal(false);
- });
-
- it('sets `active` state to a current slide only and no `visited` ones', () => {
- browser.url('/core/list.html#ID');
- browser.isExisting('[id="1"]:not(.active):not(.visited)').should.equal(true);
- browser.isExisting('[id="ID"].active:not(.visited)').should.equal(true);
- browser.isExisting('[id="3"]:not(.active):not(.visited)').should.equal(true);
- });
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
+
+ 'adds IDs to all slides unless alredy set': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.assert.elementPresent('[id="1"]');
+ browser.assert.elementNotPresent('[id="2"]');
+ browser.assert.elementPresent('#id');
+ browser.assert.elementPresent('[id="3"]');
+ browser.end();
+ },
+
+ 'doesn’t set any slide states on init': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.assert.elementNotPresent('.active');
+ browser.assert.elementNotPresent('.visited');
+ browser.end();
+ },
+
+ 'sets `active` state to a current slide only (not `visited`)': browser => {
+ browser.url(`file:///${__dirname}/list.html#id`);
+ browser.assert.cssClassNotPresent('[id="1"]', 'active');
+ browser.assert.cssClassNotPresent('[id="1"]', 'visited');
+ browser.assert.cssClassPresent('#id', 'active');
+ browser.assert.cssClassNotPresent('#id', 'visited');
+ browser.assert.cssClassNotPresent('[id="3"]', 'active');
+ browser.assert.cssClassNotPresent('[id="3"]', 'visited');
+ browser.end();
+ },
// URL
- it('activates a slide if its ID is present in URL', () => {
- browser.url('/core/list.html#ID');
- browser.isExisting('[id="ID"].active').should.equal(true);
- });
+ 'activates a slide if its ID is present in URL': browser => {
+ browser.url(`file:///${__dirname}/list.html#id`);
+ browser.assert.cssClassPresent('#id', 'active');
+ browser.end();
+ },
- it('changes non-existing ID to ID of the first slide in URL', () => {
- browser.url('/core/list.html#404');
- browser.getUrl().should.match(/#1/, 'URL in Full mode')
- });
+ 'changes non-existing ID to ID of the first slide in URL': browser => {
+ browser.url(`file:///${__dirname}/list.html#404`);
+ browser.assert.urlContains('#1'); // 'URL in Full mode'
+ browser.end();
+ },
- it('activates the first slide if ID in URL doesn’t exist', () => {
- browser.url('/core/list.html#404');
- browser.isExisting('[id="1"].active').should.equal(true);
- });
+ 'activates the first slide if ID in URL doesn’t exist': browser => {
+ browser.url(`file:///${__dirname}/list.html#404`);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
// Action
- it('goes to Full mode when a slide is clicked', () => {
- browser.url('/core/list.html');
- browser.click('[id="1"]');
- browser.isExisting('.shower.full').should.equal(true);
- });
+ 'goes to `full` mode when a slide is clicked': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.click('[id="3"]');
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
// Traverse
- it('changes slide states while moving forward', () => {
- browser.url('/core/list.html#1');
- browser.keys('\uE014'); // Right
- browser.keys('\uE014'); // Right
- browser.isExisting('[id="1"].visited:not(.active)').should.equal(true);
- browser.isExisting('[id="ID"].visited:not(.active)').should.equal(true);
- browser.isExisting('[id="3"].active').should.equal(true);
- });
-
- it('changes slide states while moving backward', () => {
- browser.url('/core/list.html#3');
- browser.keys('\uE012'); // Left
- browser.keys('\uE012'); // Left
- browser.isExisting('[id="1"].active').should.equal(true);
- browser.isExisting('[id="ID"].visited:not(.active)').should.equal(true);
- browser.isExisting('[id="3"].visited:not(.active)').should.equal(true);
- });
-
- it('changes slide states while moving forward and backward', () => {
- browser.url('/core/list.html#1');
- browser.keys('\uE014'); // Right
- browser.keys('\uE014'); // Right
- browser.keys('\uE012'); // Left
- browser.keys('\uE012'); // Left
- browser.isExisting('[id="1"].visited.active').should.equal(true);
- browser.isExisting('[id="ID"].visited:not(.active)').should.equal(true);
- browser.isExisting('[id="3"].visited:not(.active)').should.equal(true);
- });
+ 'changes slides states when moving forward': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+
+ browser.assert.cssClassNotPresent('[id="1"]', 'active');
+ browser.assert.cssClassPresent('[id="1"]', 'visited');
+ browser.assert.cssClassNotPresent('#id', 'active');
+ browser.assert.cssClassPresent('#id', 'visited');
+ browser.assert.cssClassPresent('[id="3"]', 'active');
+ browser.assert.cssClassNotPresent('[id="3"]', 'visited');
+ browser.end();
+ },
+
+ 'changes slides states when moving backward': browser => {
+ browser.url(`file:///${__dirname}/list.html#3`);
+ browser.keys(browser.Keys.ARROW_LEFT);
+ browser.keys(browser.Keys.ARROW_LEFT);
+
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.assert.cssClassNotPresent('[id="1"]', 'visited');
+ browser.assert.cssClassNotPresent('#id', 'active');
+ browser.assert.cssClassPresent('#id', 'visited');
+ browser.assert.cssClassNotPresent('[id="3"]', 'active');
+ browser.assert.cssClassPresent('[id="3"]', 'visited');
+ browser.end();
+ },
+
+ 'changes slides states when moving forward and backward': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.keys(browser.Keys.ARROW_LEFT);
+ browser.keys(browser.Keys.ARROW_LEFT);
+
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.assert.cssClassPresent('[id="1"]', 'visited');
+ browser.assert.cssClassNotPresent('#id', 'active');
+ browser.assert.cssClassPresent('#id', 'visited');
+ browser.assert.cssClassNotPresent('[id="3"]', 'active');
+ browser.assert.cssClassPresent('[id="3"]', 'visited');
+ browser.end();
+ },
// History
- it('goes to previous and next slides while moving back and forward in history', () => {
- browser.url('/core/list.html#1');
- browser.keys('\uE014'); // Right
- browser.keys('\uE014'); // Right
+ 'goes to previous and next slides when moving back and forward in history': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.keys(browser.Keys.ARROW_RIGHT);
browser.back();
browser.back();
browser.forward();
- browser.isExisting('[id="1"].visited').should.equal(true);
- browser.isExisting('[id="ID"].visited.active').should.equal(true);
- browser.isExisting('[id="3"].visited').should.equal(true);
- });
-});
+ browser.assert.cssClassNotPresent('[id="1"]', 'active');
+ browser.assert.cssClassPresent('[id="1"]', 'visited');
+ browser.assert.cssClassPresent('#id', 'active');
+ browser.assert.cssClassPresent('#id', 'visited');
+ browser.assert.cssClassNotPresent('[id="3"]', 'active');
+ browser.assert.cssClassPresent('[id="3"]', 'visited');
+ browser.end();
+ },
+};
diff --git a/tests/functional/keys/full.html b/tests/functional/keys/full.html
new file mode 100644
index 0000000..9c4eec8
--- /dev/null
+++ b/tests/functional/keys/full.html
@@ -0,0 +1,16 @@
+
+Full
+
+
+
+
+
+
+
+
diff --git a/tests/functional/keys/test.js b/tests/functional/keys/test.js
index 6b7f0e8..08353f2 100644
--- a/tests/functional/keys/test.js
+++ b/tests/functional/keys/test.js
@@ -1,182 +1,195 @@
-describe('core', () => {
-
- beforeEach(() => {
- browser.url('about:blank');
- });
-
- afterEach(() => {
- browser.sessionStorage('DELETE');
- });
+'use strict';
+module.exports = {
+ '@tags': ['keys'],
// Forward
- it('activates the first slide in `list` mode if Right Arrow key is pressed', () => {
- browser.url('/keys/list.html');
- browser.keys('\uE014'); // Right
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('moves forward when Right Arrow key is pressed', () => {
- browser.url('/keys/list.html#1');
- browser.keys('\uE014'); // Right
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('moves forward when Down Arrow key is pressed', () => {
- browser.url('/keys/list.html#1');
- browser.keys('\uE015'); // Down
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('moves forward when Page Down key is pressed', () => {
- browser.url('/keys/list.html#1');
- browser.keys('\uE00F'); // Page Down
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('moves forward when J key is pressed', () => {
- browser.url('/keys/list.html#1');
+ 'activates the first slide in `list` mode if Right Arrow key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when Right Arrow key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ARROW_RIGHT);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when Down Arrow key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ARROW_DOWN);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when Page Down key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.PAGEDOWN);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when J key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
browser.keys('J');
- browser.isExisting('[id="2"].active').should.equal(true);
- });
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
- it('moves forward when L key is pressed', () => {
- browser.url('/keys/list.html#1');
+ 'moves forward when L key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
browser.keys('L');
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('moves forward when Enter key is pressed', () => {
- browser.url('/keys/list.html#1');
- browser.keys('Enter'); //
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('moves forward when Space key is pressed in Full mode', () => {
- browser.url('/keys/list.html');
- browser.click('[id="1"]');
- browser.keys('Space');
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- it('doesn’t move forward when Space key is pressed in List mode', () => {
- browser.url('/keys/list.html#1');
- browser.keys('Space');
- browser.isExisting('[id="1"].active').should.equal(true);
- });
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when N key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys('N');
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when Enter key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.ENTER);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves forward when Space key is pressed in `full` mode': browser => {
+ browser.url(`file:///${__dirname}/full.html#1`);
+ browser.keys(browser.Keys.SPACE);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'doesn’t move forward when Space key is pressed in `list` mode': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.SPACE);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
// Backward
- it('moves backward when Left Arrow key is pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys('\uE012'); // Left
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('moves backward when Up Arrow key is pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys('\uE013'); // Up
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('moves backward when Page Up key is pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys('\uE00E'); // Page Up
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('moves backward when K key is pressed', () => {
- browser.url('/keys/list.html#2');
+ 'moves backward when Left Arrow key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys(browser.Keys.ARROW_LEFT);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when Up Arrow key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys(browser.Keys.ARROW_UP);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when Page Up key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys(browser.Keys.PAGEUP);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when K key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
browser.keys('K');
- browser.isExisting('[id="1"].active').should.equal(true);
- });
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
- it('moves backward when H key is pressed', () => {
- browser.url('/keys/list.html#2');
+ 'moves backward when H key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
browser.keys('H');
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('moves backward when Shift Enter keys are pressed in List mode', () => {
- browser.url('/keys/list.html#2');
- browser.keys(['Shift', 'Enter']);
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- xit('moves backward when Shift Enter keys are pressed in Full mode', () => {
- browser.url('/keys/list.html');
- browser.click('[id="2"]');
- browser.keys(['Shift', 'Enter']);
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('doesn’t move backward when Shift Space keys are pressed in List mode', () => {
- browser.url('/keys/list.html#2')
- browser.keys(['Shift', 'Space']);
- browser.isExisting('[id="2"].active').should.equal(true);
- });
-
- xit('moves backward when Shift Space keys are pressed in Full mode', () => {
- browser.url('/keys/list.html');
- browser.click('[id="2"]');
- browser.keys(['Shift', 'Space']);
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('goes to first slide when Home key is pressed', () => {
- browser.url('/keys/list.html#3');
- browser.keys('Home');
- browser.isExisting('[id="1"].active').should.equal(true);
- });
-
- it('goes to last slide when End key is pressed', () => {
- browser.url('/keys/list.html#1');
- browser.keys('End');
- browser.isExisting('[id="3"].active').should.equal(true);
- });
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when P key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys('P');
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when Shift Enter keys are pressed in `list` mode': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys([browser.Keys.SHIFT, browser.Keys.ENTER]);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when Shift Enter keys are pressed in `full` mode': browser => {
+ browser.url(`file:///${__dirname}/full.html#2`);
+ browser.keys([browser.Keys.SHIFT, browser.Keys.ENTER]);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'doesn’t move backward when Shift Space keys are pressed in `list` mode': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys([browser.Keys.SHIFT, browser.Keys.SPACE]);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.end();
+ },
+
+ 'moves backward when Shift Space keys are pressed in `full` mode': browser => {
+ browser.url(`file:///${__dirname}/full.html#2`);
+ browser.keys([browser.Keys.SHIFT, browser.Keys.SPACE]);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'goes to first slide when Home key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#3`);
+ browser.keys(browser.Keys.HOME);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.end();
+ },
+
+ 'goes to last slide when End key is pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#1`);
+ browser.keys(browser.Keys.END);
+ browser.assert.cssClassPresent('[id="3"]', 'active');
+ browser.end();
+ },
// Start End
- it('starts presenation from the first slide when F5 key is pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys('F5');
- browser.isExisting('[id="1"].active').should.equal(true);
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- it('starts presenation from the current slide when Shift F5 keys are pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys(['Shift', 'F5']);
- browser.isExisting('[id="2"].active').should.equal(true);
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- xit('starts presenation from the first slide when Cmd Shift Enter keys are pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys(['Meta', 'Shift', 'Enter']);
- browser.isExisting('[id="1"].active').should.equal(true);
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- xit('starts presenation from the current slide when Cmd Enter keys are pressed', () => {
- browser.url('/keys/list.html#2');
- browser.keys(['Meta', 'Enter']);
- browser.isExisting('[id="2"].active').should.equal(true);
- browser.isExisting('.shower.full').should.equal(true);
- });
-
- it('stops presenation when F5 key is pressed', () => {
- browser.url('/keys/list.html');
- browser.click('[id="1"]');
- browser.keys('F5');
- browser.isExisting('.shower.list').should.equal(true);
- });
-
- it('stops presenation when Esc key is pressed', () => {
- browser.url('/keys/list.html');
- browser.click('[id="1"]');
- browser.keys('Escape');
- browser.isExisting('.shower.list').should.equal(true);
- });
-
-});
+ 'starts presenation from the current slide when Shift F5 keys are pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys([browser.Keys.SHIFT, browser.Keys.F5]);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
+
+ 'starts presenation from the first slide when Cmd Shift Enter keys are pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys([browser.Keys.META, browser.Keys.SHIFT, browser.Keys.ENTER]);
+ browser.assert.cssClassPresent('[id="1"]', 'active');
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
+
+ 'starts presenation from the current slide when Cmd Enter keys are pressed': browser => {
+ browser.url(`file:///${__dirname}/list.html#2`);
+ browser.keys([browser.Keys.META, browser.Keys.ENTER]);
+ browser.assert.cssClassPresent('[id="2"]', 'active');
+ browser.assert.elementPresent('.shower.full');
+ browser.end();
+ },
+
+ 'stops presenation when Esc key is pressed': browser => {
+ browser.url(`file:///${__dirname}/full.html#1`);
+ browser.keys(browser.Keys.ESCAPE);
+ browser.assert.elementPresent('.shower.list');
+ browser.end();
+ },
+};
diff --git a/tests/functional/title/list.html b/tests/functional/title/list.html
index 7a0f6a2..5a0e0f1 100644
--- a/tests/functional/title/list.html
+++ b/tests/functional/title/list.html
@@ -10,9 +10,9 @@ 1
diff --git a/tests/functional/title/test.js b/tests/functional/title/test.js
index 81a6902..11cb769 100644
--- a/tests/functional/title/test.js
+++ b/tests/functional/title/test.js
@@ -1,34 +1,31 @@
-describe('title', () => {
+'use strict';
+module.exports = {
+ '@tags': ['title'],
- beforeEach(() => {
- browser.url('about:blank');
- });
+ beforeEach: browser => {
+ browser.url(`file:///${__dirname}/list.html`);
+ },
- afterEach(() => {
- browser.sessionStorage('DELETE');
- });
+ 'stays unchanged in `list` mode': browser => {
+ browser.assert.title('Title');
+ browser.end();
+ },
- it('stays unchanged in `list` mode', () => {
- browser.url('/title/list.html');
- browser.getTitle().should.equal('Title');
- });
-
- it('gets prepended with current slide title in `full` mode', () => {
- browser.url('/title/list.html');
+ 'gets prepended with current slide title in `full` mode': browser => {
browser.click('[id="1"]');
- browser.getTitle().should.equal('1 — Title')
- });
-
- it('doesn’t change in lack of slide title', () => {
- browser.url('/title/list.html');
- browser.click('[id="2"]');
- browser.getTitle().should.equal('Title');
- });
+ browser.assert.title('1 — Title');
+ browser.end();
+ },
- it('gets stripped from HTML tags while prepending', () => {
- browser.url('/title/list.html');
+ 'gets stripped from HTML tags while prepending': browser => {
browser.click('[id="3"]');
- browser.getTitle().should.equal('3 — Title');
- });
+ browser.assert.title('3 — Title');
+ browser.end();
+ },
-});
+ 'doesn’t change if slide title is missing': browser => {
+ browser.click('[id="2"]');
+ browser.assert.title('Title');
+ browser.end();
+ },
+};
diff --git a/wdio.conf.js b/wdio.conf.js
deleted file mode 100644
index 10582b5..0000000
--- a/wdio.conf.js
+++ /dev/null
@@ -1,50 +0,0 @@
-require('chai').should();
-var selenium = require('selenium-standalone');
-var seleniumServer;
-
-exports.config = {
- specs: [
- // TODO: use wildcard when all tests will be migrated
- './tests/functional/*/test.js'
- ],
-
- capabilities: [{
- browserName: 'chrome'
- }],
-
- // Level of logging verbosity: silent | verbose | command | data | result | error
- logLevel: 'silent',
-
- baseUrl: 'file://' + __dirname + '/tests/functional',
-
- // Default timeout for all waitFor* commands.
- waitforTimeout: 10000,
-
- // Default request retries count
- connectionRetryCount: 3,
-
- framework: 'mocha',
-
- // reporters: ['dot', 'allure'],
-
- mochaOpts: {
- ui: 'bdd'
- },
-
- onPrepare: function (config, capabilities) {
- //TODO: use selenium-standalone service when it will be available
- return new Promise(function(resolve, reject) {
- selenium.start(function(err, process) {
- if(err) {
- return reject(err);
- }
- seleniumServer = process;
- resolve(process);
- });
- });
- },
-
- onComplete: function(exitCode) {
- seleniumServer.kill();
- }
-}