jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/402377 )

Change subject: Selenium test for PDF download button is visible.
......................................................................


Selenium test for PDF download button is visible.

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

Approvals:
  Zfilipin: Looks good to me, approved
  jenkins-bot: Verified



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..b2d0bdd
--- /dev/null
+++ b/tests/selenium/.eslintrc.json
@@ -0,0 +1,11 @@
+{
+       "extends": "../../.eslintrc.json",
+       "env": {
+               "es6": true,
+               "mocha": true,
+               "node": true
+       },
+       "globals": {
+               "browser": false
+       }
+}
diff --git a/tests/selenium/README.md b/tests/selenium/README.md
new file mode 100644
index 0000000..a877942
--- /dev/null
+++ b/tests/selenium/README.md
@@ -0,0 +1,28 @@
+# Selenium tests
+
+Please see tests/selenium/README.md file in mediawiki/core repository.
+
+## Usage
+
+Set up MediaWiki-Vagrant:
+
+    cd mediawiki/vagrant
+    vagrant up
+    vagrant roles enable offline
+    vagrant provision
+
+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/electronpdfservice.js
diff --git a/tests/selenium/pageobjects/main.page.js 
b/tests/selenium/pageobjects/main.page.js
new file mode 100644
index 0000000..0c894fa
--- /dev/null
+++ b/tests/selenium/pageobjects/main.page.js
@@ -0,0 +1,13 @@
+'use strict';
+const Page = require( '../../../../../tests/selenium/pageobjects/page' );
+
+class MainPage extends Page {
+
+       get pdflink() { return browser.element( '[id^=coll-download-as-r]' ); }
+
+       open() {
+               super.open( 'Main_Page' );
+       }
+
+}
+module.exports = new MainPage();
diff --git a/tests/selenium/pageobjects/specialelectronpdf.page.js 
b/tests/selenium/pageobjects/specialelectronpdf.page.js
new file mode 100644
index 0000000..89f8ad7
--- /dev/null
+++ b/tests/selenium/pageobjects/specialelectronpdf.page.js
@@ -0,0 +1,9 @@
+'use strict';
+const Page = require( '../../../../../tests/selenium/pageobjects/page' );
+
+class SpecialElectronPdfPage extends Page {
+
+       get downloadButton() { return browser.element( 
'.mw-electronPdfService-selection-form .oo-ui-buttonElement-button' ); }
+
+}
+module.exports = new SpecialElectronPdfPage();
diff --git a/tests/selenium/specs/electronpdfservice.js 
b/tests/selenium/specs/electronpdfservice.js
new file mode 100644
index 0000000..fbfde1d
--- /dev/null
+++ b/tests/selenium/specs/electronpdfservice.js
@@ -0,0 +1,18 @@
+'use strict';
+
+var assert = require( 'assert' ),
+       MainPage = require( '../pageobjects/main.page' ),
+       SpecialElectronPdfPage = require( 
'../pageobjects/specialelectronpdf.page' );
+
+describe( 'ElectronPdfService', function () {
+
+       it( 'pdf download button is visible', function () {
+
+               MainPage.open();
+               MainPage.pdflink.click();
+
+               assert( SpecialElectronPdfPage.downloadButton.isVisible() );
+
+       } );
+
+} );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I17b04e365b3df2aba9ee14f26b75896288158a69
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/ElectronPdfService
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to