WMDE-Fisch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402377 )

Change subject: Add basic nodejs selenium browser test
......................................................................

Add basic nodejs selenium browser test

Bug: T180246
Change-Id: I17b04e365b3df2aba9ee14f26b75896288158a69
---
M Gruntfile.js
A tests/selenium/.eslintrc.json
A tests/selenium/README.md
A tests/selenium/pageobjects/downloadscreen.page.js
A tests/selenium/pageobjects/main.page.js
A tests/selenium/specs/electronpdfservice.js
6 files changed, 73 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ElectronPdfService 
refs/changes/77/402377/1

diff --git a/Gruntfile.js b/Gruntfile.js
index 38250a7..341ca40 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,7 +10,8 @@
        grunt.initConfig( {
                eslint: {
                        all: [
-                               'modules/**/*.js'
+                               'modules/**/*.js',
+                               'tests/selenium/**/*.js'
                        ]
                },
                stylelint: {
diff --git a/tests/selenium/.eslintrc.json b/tests/selenium/.eslintrc.json
new file mode 100644
index 0000000..d64ada9
--- /dev/null
+++ b/tests/selenium/.eslintrc.json
@@ -0,0 +1,14 @@
+{
+       "extends": "../../.eslintrc.json",
+       "env": {
+               "es6": true,
+               "mocha": true,
+               "node": true
+       },
+       "parserOptions": {
+               "ecmaVersion": 6
+       },
+       "globals": {
+               "browser": false
+       }
+}
diff --git a/tests/selenium/README.md b/tests/selenium/README.md
new file mode 100644
index 0000000..e8fb781
--- /dev/null
+++ b/tests/selenium/README.md
@@ -0,0 +1,21 @@
+# Selenium tests
+
+Please see tests/selenium/README.md file in mediawiki/core repository.
+
+## Usage
+
+Run both mediawiki/core and ElectronPdfService tests from mediawiki/core 
folder:
+
+    npm run selenium
+
+To run only ElectronPdfService tests in one terminal window or tab start 
Chromedriver:
+
+    chromedriver --url-base=/wd/hub --port=4444
+
+In another terminal tab or window go to mediawiki/core folder:
+
+    ./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec 
extensions/ElectronPdfService/tests/selenium/specs/*.js
+
+Run only one ElectronPdfService test file from mediawiki/core:
+
+    ./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec 
extensions/ElectronPdfService/tests/selenium/specs/echo.js
diff --git a/tests/selenium/pageobjects/downloadscreen.page.js 
b/tests/selenium/pageobjects/downloadscreen.page.js
new file mode 100644
index 0000000..e6ea12e
--- /dev/null
+++ b/tests/selenium/pageobjects/downloadscreen.page.js
@@ -0,0 +1,9 @@
+'use strict';
+const Page = require( '../../../../../tests/selenium/pageobjects/page' );
+
+class DownloadScreenPage extends Page {
+
+       get downloadButton() { return browser.element( 
'.mw-electronPdfService-selection-form .oo-ui-buttonElement-button' ); }
+
+}
+module.exports = new DownloadScreenPage();
diff --git a/tests/selenium/pageobjects/main.page.js 
b/tests/selenium/pageobjects/main.page.js
new file mode 100644
index 0000000..0747a16
--- /dev/null
+++ b/tests/selenium/pageobjects/main.page.js
@@ -0,0 +1,9 @@
+'use strict';
+const Page = require( '../../../../../tests/selenium/pageobjects/page' );
+
+class MainPage extends Page {
+
+       get pdflink() { return browser.element( '#electron-print_pdf a' ); }
+
+}
+module.exports = new MainPage();
diff --git a/tests/selenium/specs/electronpdfservice.js 
b/tests/selenium/specs/electronpdfservice.js
new file mode 100644
index 0000000..655d2ac
--- /dev/null
+++ b/tests/selenium/specs/electronpdfservice.js
@@ -0,0 +1,18 @@
+'use strict';
+
+var assert = require( 'assert' ),
+       MainPage = require( '../pageobjects/main.page' ),
+       DownloadScreenPage = require( '../pageobjects/downloadscreen.page' );
+
+describe( 'ElectronPdfService', function () {
+
+       it( 'pdf download button is visible', function () {
+
+               MainPage.open( '' );
+               MainPage.pdflink.click();
+
+               assert( DownloadScreenPage.downloadButton.isVisible() );
+
+       } );
+
+} );

-- 
To view, visit https://gerrit.wikimedia.org/r/402377
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17b04e365b3df2aba9ee14f26b75896288158a69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ElectronPdfService
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <christoph.jau...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to