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

Change subject: Selenium smoke test
......................................................................


Selenium smoke test

Bug: T175179
Change-Id: Ide184939aa95f42cfc65a2ec80f1ae5e3ad899be
---
A tests/selenium/.jshintrc
A tests/selenium/README.md
A tests/selenium/pageobjects/random.page.js
A tests/selenium/specs/smoke_test.js
4 files changed, 90 insertions(+), 0 deletions(-)

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



diff --git a/tests/selenium/.jshintrc b/tests/selenium/.jshintrc
new file mode 100644
index 0000000..f200c8d
--- /dev/null
+++ b/tests/selenium/.jshintrc
@@ -0,0 +1,8 @@
+{
+  "esversion" : 6,
+  "node": true,
+  "mocha": true,
+  "globals": {
+    "browser": false
+  }
+}
diff --git a/tests/selenium/README.md b/tests/selenium/README.md
new file mode 100644
index 0000000..3480b63
--- /dev/null
+++ b/tests/selenium/README.md
@@ -0,0 +1,15 @@
+# Selenium tests
+
+Please see tests/selenium/README.md file in mediawiki/core repository.
+
+Tests here are running daily in selenium-CirrusSearch-jessie Jenkins job. For 
documentation see 
https://www.mediawiki.org/wiki/Selenium/Node.js/selenium-EXTENSION-jessie_Jenkins_job
+
+## Usage
+
+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:
+
+    MW_SERVER=https://en.wikipedia.beta.wmflabs.org:443 MW_SCRIPT_PATH=/w 
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec 
extensions/CirrusSearch/tests/selenium/specs/*.js
diff --git a/tests/selenium/pageobjects/random.page.js 
b/tests/selenium/pageobjects/random.page.js
new file mode 100644
index 0000000..7e411d0
--- /dev/null
+++ b/tests/selenium/pageobjects/random.page.js
@@ -0,0 +1,9 @@
+'use strict';
+const Page = require( '../../../../../tests/selenium/pageobjects/page' );
+
+class RandomPage extends Page {
+       open() {
+               super.open( 'Special:RandomPage' );
+       }
+}
+module.exports = new RandomPage();
diff --git a/tests/selenium/specs/smoke_test.js 
b/tests/selenium/specs/smoke_test.js
new file mode 100644
index 0000000..f6bc2e5
--- /dev/null
+++ b/tests/selenium/specs/smoke_test.js
@@ -0,0 +1,58 @@
+'use strict';
+const assert = require( 'assert' ),
+       ArticlePage = require( 
'../../integration/features/support/pages/article_page' ),
+       RandomPage = require( '../pageobjects/random.page' );
+
+/**
+ * Smoke test for CirrusSearch
+ * meant to be run with enwiki on the beta cluster
+ * prerequisites:
+ *  - the África page is expected to exist
+ */
+describe( 'Smoke test for search', function () {
+
+       /**
+        * Given I am at a random page
+        * When I type main p into the search box
+        * Then suggestions should appear
+        * And Main Page is the first suggestion
+        */
+       it( 'Search suggestions', function () {
+               RandomPage.open();
+               ArticlePage.search_query_top_right = 'main p';
+               assert.ok( ArticlePage.has_search_suggestions() );
+               let expectedSuggestion = 'Main Page';
+               assert.equal( ArticlePage.get_search_suggestion_at(1), 
expectedSuggestion,
+                       `${expectedSuggestion} is the first suggestion` );
+       } );
+
+       /**
+        * Given I am at a random page
+        * When I type ma into the search box
+        * And I click the search button
+        * Then I am on a page titled Search results
+        */
+       it( 'Fill in search term and click search', function() {
+               RandomPage.open();
+               ArticlePage.search_query_top_right = 'ma';
+               ArticlePage.click_search_top_right();
+               let expectedPage = 'Search results';
+               assert.equal( ArticlePage.articleTitle, expectedPage,
+                       `I am on a page named ${expectedPage}` );
+       } );
+
+       /**
+        * Given I am at a random page
+        * When I search for África
+        * Then I am on a page titled África
+        */
+       it ( 'Search with accent yields result page with accent', function() {
+               RandomPage.open();
+               ArticlePage.search_query_top_right = 'África';
+               ArticlePage.click_search_top_right();
+               let expectedPage = 'África';
+               assert.equal( ArticlePage.articleTitle, expectedPage,
+                       `I am on a page named ${expectedPage}` );
+       } );
+
+} );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide184939aa95f42cfc65a2ec80f1ae5e3ad899be
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to