From 6e9d56efa6a817787a12e930263ea99884c7f1ca Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 9 Apr 2019 12:43:39 -0700 Subject: [PATCH] Restore category step for CI Per T199939#5096023 use job runner to execute the job runner as part of the test to ensure the API can return categories for a page. Bug: T219920 Change-Id: I467f6635fd0d80a01428f6b06a8c750430d63d6d --- package.json | 2 +- .../step_definitions/create_page_api_steps.js | 13 ++++++++++--- tests/selenium/specs/category.js | 10 +--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 5bc83d3..ab1aed7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "svgo": "0.7.2", "wdio-cucumber-framework": "1.1.1", "wdio-mocha-framework": "0.5.13", - "wdio-mediawiki": "0.2.0", + "wdio-mediawiki": "0.3.0", "wdio-spec-reporter": "0.1.4", "webdriverio": "4.13.1" } diff --git a/tests/selenium/features/step_definitions/create_page_api_steps.js b/tests/selenium/features/step_definitions/create_page_api_steps.js index 7c45d9f..2202863 100644 --- a/tests/selenium/features/step_definitions/create_page_api_steps.js +++ b/tests/selenium/features/step_definitions/create_page_api_steps.js @@ -1,4 +1,5 @@ const { api, ArticlePage } = require( '../support/world' ); +const RunJobs = require( 'wdio-mediawiki/RunJobs' ); const Api = require( 'wdio-mediawiki/Api' ); const Page = require( 'wdio-mediawiki/Page' ); const { @@ -33,9 +34,15 @@ const iAmInAWikiThatHasCategories = ( title ) => { // A pause is necessary to let the categories register with database before trying to use // them in an article waitForPropagation( 5000 ); - Api.edit( title, wikitext ); - // categories are handled by a JobRunner so need extra time to appear via API calls! - waitForPropagation( 5000 ); + browser.call( () => { + return Api.edit( title, wikitext ); + } ); + browser.call( () => { + // The category overlay uses the category API + // which will only return results if the job queue has completed. + // Run before continuing! + return RunJobs.run(); + } ); }; const iAmOnAPageThatHasTheFollowingEdits = function ( table ) { diff --git a/tests/selenium/specs/category.js b/tests/selenium/specs/category.js index 64faf25..152195b 100644 --- a/tests/selenium/specs/category.js +++ b/tests/selenium/specs/category.js @@ -33,14 +33,6 @@ describe( 'Categories', function () { // Then I should see the categories overlay iShouldSeeTheCategoriesOverlay(); - // FIXME: This check is partially skipped as there is no way to lower $wgJobRunRate - // See: T199939#5095838 - try { - iShouldSeeAListOfCategories(); - } catch ( e ) { - // pass. - // eslint-disable-next-line no-console - console.warn( 'Unable to check the list of the categories. Is wgJobRunRate set correctly?' ); - } + iShouldSeeAListOfCategories(); } ); } );