Port remaining @login tests to Node.js

Bug: T219920
Change-Id: I9f651d73cae8d6494ffa585ac3cbd791686b926a
This commit is contained in:
jdlrobson 2019-04-08 16:45:11 -07:00 committed by Jdlrobson
parent c16c20a394
commit 544b0e70c9
23 changed files with 567 additions and 16 deletions

View File

@ -16,9 +16,4 @@ Feature: Menus open correct page for anonymous users
And I should see a link to "Settings" in the main navigation menu
And I should see a link to "Contributions" in the main navigation menu
And I should see a link to "Watchlist" in the main navigation menu
@extension-geodata
Scenario: Nearby link in menu
Given at least one article with geodata exists
When I click on the main navigation button
Then I should see a link to "Nearby" in the main navigation menu
And I should see a link to "Nearby" in the main navigation menu

View File

@ -71,6 +71,12 @@ const iShouldSeeAToastNotification = () => {
ArticlePage.notification_element.waitForVisible();
};
const iShouldSeeAToastNotificationWithMessage = ( msg ) => {
iShouldSeeAToastNotification();
const notificationBody = ArticlePage.notification_element.element( '.mw-notification-content' );
assert.strictEqual( notificationBody.getText().indexOf( msg ) > -1, true );
};
const iClickTheBrowserBackButton = () => {
browser.back();
};
@ -86,17 +92,24 @@ const iSeeAnOverlay = () => {
};
const iDoNotSeeAnOverlay = () => {
waitForPropagation( 5000 );
browser.waitUntil( () => !ArticlePageWithOverlay.overlay_element.isVisible() );
assert.strictEqual( ArticlePageWithOverlay.overlay_element.isVisible(), false );
};
const iAmUsingMobileScreenResolution = () => {
browser.setViewportSize( { width: 320, height: 480 }, true );
};
module.exports = {
waitForPropagation,
iAmUsingMobileScreenResolution,
iSeeAnOverlay, iDoNotSeeAnOverlay,
iClickTheOverlayCloseButton,
iClickTheBrowserBackButton,
createPage, createPages,
pageExists, iAmOnAPageThatDoesNotExist, iShouldSeeAToastNotification,
iShouldSeeAToastNotificationWithMessage,
iAmLoggedIntoTheMobileWebsite,
iAmUsingTheMobileSite,
iAmLoggedIn, iAmOnPage, iAmInBetaMode

View File

@ -1,5 +1,6 @@
const { api, ArticlePage } = require( '../support/world' );
const Api = require( 'wdio-mediawiki/Api' );
const Page = require( 'wdio-mediawiki/Page' );
const {
iAmOnPage,
waitForPropagation,
@ -65,9 +66,48 @@ const iGoToAPageThatHasLanguages = () => {
} );
};
const watch = ( title ) => {
// Ideally this would use the API but mwbot / Selenium's API can't do this right now
// So we run the non-js workflow.
const page = new Page();
page.openTitle( title, { action: 'watch' } );
browser.element( '#mw-content-text button[type="submit"]' ).click();
waitForPropagation( 10000 );
};
const iAmViewingAWatchedPage = () => {
const title = `I am on the "Selenium mobile watched page test ${new Date().getTime()}`;
createPage( title, 'watch test' ).then( () => {
watch( title );
// navigate away from page
iAmOnPage( 'Main Page' );
waitForPropagation( 5000 );
// and back to page
iAmOnPage( title );
waitForPropagation( 5000 );
} );
};
const iAmViewingAnUnwatchedPage = () => {
// new pages are watchable but unwatched by default
const title = 'I am on the "Selenium mobile unwatched test ' + new Date();
iAmOnPage( title );
};
const iAmOnAPageWithNoTalkTopics = () => {
const title = `Selenium talk test ${new Date()}`;
createPage( title, 'Selenium' );
iAmOnPage( title );
};
module.exports = {
waitForPropagation,
iAmOnAPageThatHasTheFollowingEdits,
iAmOnAPageWithNoTalkTopics,
iAmViewingAWatchedPage,
iAmViewingAnUnwatchedPage,
iAmInAWikiThatHasCategories,
iGoToAPageThatHasLanguages
};

View File

@ -4,10 +4,14 @@ const { defineSupportCode } = require( 'cucumber' ),
} = require( './category_steps' ),
{ iAmInAWikiThatHasCategories,
iAmOnAPageThatHasTheFollowingEdits,
iAmOnAPageWithNoTalkTopics,
iAmViewingAWatchedPage, iAmViewingAnUnwatchedPage,
iGoToAPageThatHasLanguages } = require( './create_page_api_steps' ),
{
pageExists, iAmOnAPageThatDoesNotExist, iShouldSeeAToastNotification,
iShouldSeeAToastNotificationWithMessage, iAmUsingMobileScreenResolution,
iAmUsingTheMobileSite, iClickTheBrowserBackButton,
iClickTheOverlayCloseButton, iDoNotSeeAnOverlay,
iAmLoggedIntoTheMobileWebsite,
iAmOnPage, iAmInBetaMode
} = require( './common_steps' ),
@ -21,6 +25,32 @@ const { defineSupportCode } = require( 'cucumber' ),
iTypeIntoTheEditor, iClickContinue, iClickSubmit, iSayOkayInTheConfirmDialog,
theTextOfTheFirstHeadingShouldBe, thereShouldBeARedLinkWithText
} = require( './editor_steps' ),
{
theWatchstarShouldNotBeSelected, theWatchstarShouldBeSelected,
iClickTheWatchstar, iClickTheUnwatchStar } = require( './watch_steps' ),
{ iVisitMyUserPage, iShouldBeOnMyUserPage, thereShouldBeALinkToMyUploads,
thereShouldBeALinkToMyContributions, thereShouldBeALinkToMyTalkPage
} = require( './user_page_steps' ),
{
iClickTheSearchIcon,
iTypeIntoTheSearchBox,
iClickASearchWatchstar,
iSeeTheSearchOverlay
} = require( './search_steps' ),
{
iClickTheTalkButton,
iAddATopic,
iSeeTheTalkOverlay,
thereShouldBeASaveDiscussionButton,
noTopicIsPresent,
thereShouldBeAnAddDiscussionButton,
thereShouldBeNoTalkButton,
iShouldSeeTheTopicInTheListOfTopics
} = require( './talk_steps' ),
{ iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu,
iClickOnTheMainNavigationButton,
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer
} = require( './menu_steps' ),
{ iHaveNoNotifications, iClickOnTheNotificationIcon,
iShouldSeeTheNotificationsOverlay, iClickTheNotificationsOverlayCloseButton,
iShouldNotSeeTheNotificationsOverlay
@ -39,12 +69,15 @@ defineSupportCode( function ( { Then, When, Given } ) {
When( /^I click continue$/, iClickContinue );
When( /^I click submit$/, iClickSubmit );
When( /^I say OK in the confirm dialog$/, iSayOkayInTheConfirmDialog );
When( /^I click the wikitext editor overlay close button$/, iClickTheOverlayCloseButton );
Then( /^I do not see the wikitext editor overlay$/, iDoNotSeeTheWikitextEditorOverlay );
Then( /^the text of the first heading should be "(.+)"$/, theTextOfTheFirstHeadingShouldBe );
Then( /^there should be a red link with text "(.+)"$/, thereShouldBeARedLinkWithText );
Then( /^I should not see the wikitext editor overlay$/, iDoNotSeeAnOverlay );
// common steps
Given( /^I am using the mobile site$/, iAmUsingTheMobileSite );
When( /^I am viewing the site in mobile mode$/, iAmUsingMobileScreenResolution );
Given( /^I am in beta mode$/, iAmInBetaMode );
@ -52,9 +85,11 @@ defineSupportCode( function ( { Then, When, Given } ) {
Given( /^I am logged into the mobile website$/, iAmLoggedIntoTheMobileWebsite );
Then( /^I should see a toast notification$/, iShouldSeeAToastNotification );
Then( /^I should see a toast with message "(.+)"$/, iShouldSeeAToastNotificationWithMessage );
When( /I click the browser back button/, iClickTheBrowserBackButton );
// Page steps
Given( /^I am on a page with no talk topics$/, iAmOnAPageWithNoTalkTopics );
Given( /^I am in a wiki that has categories$/, () => {
iAmInAWikiThatHasCategories( 'Selenium categories test page' );
} );
@ -62,6 +97,8 @@ defineSupportCode( function ( { Then, When, Given } ) {
Given( /^I am on a page that does not exist$/, iAmOnAPageThatDoesNotExist );
Given( /^I go to a page that has languages$/, iGoToAPageThatHasLanguages );
Given( /^the page "(.+)" exists$/, pageExists );
Given( /^I am viewing a watched page$/, iAmViewingAWatchedPage );
Given( /^I am viewing an unwatched page$/, iAmViewingAnUnwatchedPage );
// history steps
When( /^I open the latest diff$/, iOpenTheLatestDiff );
@ -79,6 +116,43 @@ defineSupportCode( function ( { Then, When, Given } ) {
Then( /after 1 seconds I should not see the notifications overlay/, iShouldNotSeeTheNotificationsOverlay );
Then( /I should see the notifications overlay/, iShouldSeeTheNotificationsOverlay );
// talk
When( /^I click the talk button$/, iClickTheTalkButton );
When( /^I add a topic called "(.+)"$/, iAddATopic );
Then( /^I see the talk overlay$/, iSeeTheTalkOverlay );
Then( /^I should see the talk overlay$/, iSeeTheTalkOverlay );
Then( /^there should be a save discussion button$/, thereShouldBeASaveDiscussionButton );
Then( /^no topic is present$/, noTopicIsPresent );
Then( /^there should be an add discussion button$/, thereShouldBeAnAddDiscussionButton );
Then( /^there should be no talk button$/, thereShouldBeNoTalkButton );
Then( /^I should see the topic called "(.+)" in the list of topics$/, iShouldSeeTheTopicInTheListOfTopics );
// user page
Given( /^I visit my user page$/, iVisitMyUserPage );
When( /^I should be on my user page$/, iShouldBeOnMyUserPage );
Then( /^there should be a link to my uploads$/, thereShouldBeALinkToMyUploads );
Then( /^there should be a link to my contributions$/, thereShouldBeALinkToMyContributions );
Then( /^there should be a link to my talk page$/, thereShouldBeALinkToMyTalkPage );
// search
When( /^I click the search icon$/, iClickTheSearchIcon );
When( /^I type into search box "(.+)"$/, iTypeIntoTheSearchBox );
When( /^I click a search watch star$/, iClickASearchWatchstar );
Then( /^I see the search overlay$/, iSeeTheSearchOverlay );
// main menu
When( /^I click on the main navigation button$/, iClickOnTheMainNavigationButton );
When( /^I should see a link to the about page$/, iSeeALinkToAboutPage );
Then( /^I should see a link to my user page in the main navigation menu$/, iShouldSeeAUserPageLinkInMenu );
Then( /^I should see a link to "(.+)" in the main navigation menu$/, iShouldSeeALinkInMenu );
Then( /^I should see a link to the disclaimer$/, iShouldSeeALinkToDisclaimer );
// watchstar
When( /^I click the watch star$/, iClickTheWatchstar );
When( /^I click the unwatch star$/, iClickTheUnwatchStar );
Then( /^the watch star should not be selected$/, theWatchstarShouldNotBeSelected );
Then( /^the watch star should be selected$/, theWatchstarShouldBeSelected );
// Category steps
When( /^I click on the category button$/, iClickOnTheCategoryButton );

View File

@ -0,0 +1,29 @@
const assert = require( 'assert' );
const { ArticlePage } = require( '../support/world.js' );
const iSeeALinkToAboutPage = () => {
assert.strictEqual( ArticlePage.menu_element.element( '*=About' ).isVisible(), true );
};
const iClickOnTheMainNavigationButton = () => {
ArticlePage.menu_button_element.click();
};
const iShouldSeeAUserPageLinkInMenu = () => {
ArticlePage.menu_element.element( '.mw-ui-icon-minerva-profile' );
};
const iShouldSeeALinkInMenu = ( text ) => {
assert.strictEqual( ArticlePage.menu_element.element( `=${text}` ).isVisible(),
true, `Link to ${text} is visible.` );
};
const iShouldSeeALinkToDisclaimer = () => {
assert.strictEqual( ArticlePage.menu_element.element( '=Disclaimers' ).isVisible(), true );
};
module.exports = {
iClickOnTheMainNavigationButton,
iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu,
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer
};

View File

@ -0,0 +1,38 @@
const { iSeeAnOverlay } = require( './common_steps' );
const { ArticlePage } = require( '../support/world.js' );
const ArticlePageWithOverlay = require( '../support/pages/article_page_with_overlay' );
const iClickTheSearchIcon = () => {
ArticlePage.search_icon_element.click();
};
const iTypeIntoTheSearchBox = ( term ) => {
const input = ArticlePageWithOverlay.overlay_element
.element( 'input' );
input.waitForExist();
input.setValue( term );
};
const iSeeSearchResults = () => {
ArticlePageWithOverlay.overlay_element
.element( '.page-list' ).waitForExist( 5000 );
};
const iClickASearchWatchstar = () => {
iSeeSearchResults();
const watchThisArticle = ArticlePageWithOverlay.overlay_element
.element( '.watch-this-article' );
watchThisArticle.waitForExist( 5000 );
watchThisArticle.click();
};
const iSeeTheSearchOverlay = () => {
iSeeAnOverlay();
};
module.exports = {
iClickTheSearchIcon,
iTypeIntoTheSearchBox,
iClickASearchWatchstar,
iSeeTheSearchOverlay
};

View File

@ -0,0 +1,74 @@
const assert = require( 'assert' );
const { iSeeAnOverlay, waitForPropagation } = require( './common_steps' );
const ArticlePageWithEditorOverlay = require( '../support/pages/article_page_with_editor_overlay' );
const { ArticlePage } = require( '../support/world.js' );
const iClickTheTalkButton = () => {
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.talk' );
ArticlePage.talk_element.waitForVisible();
ArticlePage.talk_element.click();
};
const iAddATopic = ( subject ) => {
ArticlePageWithEditorOverlay.continue_element.waitForVisible();
ArticlePageWithEditorOverlay.continue_element.click();
ArticlePageWithEditorOverlay.editor_overlay_element.waitForExist();
const overlay = ArticlePageWithEditorOverlay.editor_overlay_element;
overlay.element( '.overlay input' ).waitForExist();
overlay.element( '.overlay input' ).setValue( subject );
overlay.element( '.overlay textarea' ).setValue( 'Topic body is a really long text.' );
browser.waitUntil( () =>
!ArticlePageWithEditorOverlay.submit_element.getAttribute( 'disabled' )
);
ArticlePageWithEditorOverlay.submit_element.click();
waitForPropagation( 5000 );
};
const iSeeTheTalkOverlay = () => {
iSeeAnOverlay();
};
const thereShouldBeASaveDiscussionButton = () => {
const submit = ArticlePageWithEditorOverlay.submit_element;
submit.waitForExist();
assert.strictEqual( submit.isVisible(), true );
};
const noTopicIsPresent = () => {
ArticlePageWithEditorOverlay.editor_overlay_element.waitForExist();
const overlay = ArticlePageWithEditorOverlay.editor_overlay_element;
overlay.element( '.content-header' ).waitForExist();
assert.strictEqual(
overlay.element( '.content-header' ).getText(),
'There are no conversations about this page.'
);
};
const thereShouldBeAnAddDiscussionButton = () => {
ArticlePageWithEditorOverlay.continue_element.waitForVisible();
};
const thereShouldBeNoTalkButton = () => {
assert.strictEqual( ArticlePage.talk_element.isVisible(), false );
};
const iShouldSeeTheTopicInTheListOfTopics = ( subject ) => {
ArticlePageWithEditorOverlay.editor_overlay_element.waitForExist();
ArticlePageWithEditorOverlay.editor_overlay_element.element( '.topic-title-list li' ).waitForExist();
const firstItem = ArticlePageWithEditorOverlay.editor_overlay_element.element( '.topic-title-list li' );
assert.strictEqual(
firstItem.getText().indexOf( subject ) > -1,
true
);
};
module.exports = {
iAddATopic,
iSeeTheTalkOverlay,
thereShouldBeASaveDiscussionButton,
noTopicIsPresent,
thereShouldBeAnAddDiscussionButton,
thereShouldBeNoTalkButton,
iShouldSeeTheTopicInTheListOfTopics,
iClickTheTalkButton
};

View File

@ -0,0 +1,28 @@
const assert = require( 'assert' );
const { ArticlePage } = require( '../support/world.js' );
const { iAmOnPage } = require( './common_steps' );
const { theTextOfTheFirstHeadingShouldBe } = require( './editor_steps' );
const username = browser.options.username.replace( /_/g, ' ' );
const iVisitMyUserPage = () => {
iAmOnPage( `User:${username}` );
};
const iShouldBeOnMyUserPage = () => {
theTextOfTheFirstHeadingShouldBe( username );
};
const thereShouldBeALinkToMyUploads = () => {
assert.strictEqual( ArticlePage.user_links_element.element( '=Uploads' ).isVisible(), true );
};
const thereShouldBeALinkToMyContributions = () => {
assert.strictEqual( ArticlePage.user_links_element.element( '=Contributions' ).isVisible(), true );
};
const thereShouldBeALinkToMyTalkPage = () => {
assert.strictEqual( ArticlePage.user_links_element.element( '=Talk' ).isVisible(), true );
};
module.exports = { iVisitMyUserPage, iShouldBeOnMyUserPage, thereShouldBeALinkToMyUploads,
thereShouldBeALinkToMyContributions, thereShouldBeALinkToMyTalkPage };

View File

@ -0,0 +1,30 @@
const assert = require( 'assert' );
const { ArticlePage } = require( '../support/world.js' );
const theWatchstarShouldNotBeSelected = () => {
ArticlePage.watch_element.waitForExist();
assert.strictEqual( ArticlePage.watched_element.isExisting(), false,
'the watched element should not be present' );
};
const theWatchstarShouldBeSelected = () => {
ArticlePage.watched_element.waitForExist();
const watchstar = ArticlePage.watched_element;
assert.strictEqual( watchstar.isVisible(), true );
};
const iClickTheWatchstar = () => {
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.watchstar' );
ArticlePage.watch_element.waitForExist();
ArticlePage.watch_element.click();
};
const iClickTheUnwatchStar = () => {
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.watchstar' );
ArticlePage.watch_element.waitForExist();
ArticlePage.watch_element.click();
};
module.exports = {
theWatchstarShouldNotBeSelected, theWatchstarShouldBeSelected,
iClickTheWatchstar, iClickTheUnwatchStar };

View File

@ -10,6 +10,13 @@ const MinervaPage = require( './minerva_page' );
class ArticlePage extends MinervaPage {
get watch_element() { return $( '#ca-watch' ); }
get talk_element() { return $( '.talk ' ); }
get watched_element() { return $( '.mw-ui-icon-mf-watched' ); }
get menu_button_element() { return $( '#mw-mf-main-menu-button' ); }
get search_icon_element() { return $( '#searchIcon' ); }
get menu_element() { return $( 'nav' ); }
get user_links_element() { return $( '.user-links' ); }
get notifications_button_element() { return $( '.user-button' ); }
get category_element() { return $( '.category-button' ); }
get edit_link_element() { return $( '#ca-edit' ); }

View File

@ -10,12 +10,12 @@
const MinervaPage = require( './minerva_page' );
class ArticlePageWithEditorOverlay extends MinervaPage {
get editor_overlay_element() { return $( '.editor-overlay' ); }
get editor_overlay_element() { return $( '.overlay' ); }
// overlay components
get editor_textarea_element() { return $( '.editor-overlay .wikitext-editor' ); }
get continue_element() { return $( '.editor-overlay .continue' ); }
get submit_element() { return $( '.editor-overlay .submit' ); }
get editor_textarea_element() { return $( '.overlay .wikitext-editor' ); }
get continue_element() { return $( '.overlay .continue' ); }
get submit_element() { return $( '.overlay .submit' ); }
}
module.exports = new ArticlePageWithEditorOverlay();

View File

@ -13,6 +13,7 @@ class ArticlePageWithOverlay extends MinervaPage {
get overlay_element() { return $( '.overlay' ); }
// overlay components
get overlay_content_element() { return $( '.overlay-content' ); }
get overlay_close_element() { return $( '.overlay .cancel' ); }
}

View File

@ -31,14 +31,13 @@ Feature: Talk
Scenario: Add topic button shows on talk pages for logged in users
Given the page "Talk:Selenium talk test" exists
And I am logged into the mobile website
And I am on the "Talk:Selenium UI test" page
And I am on the "Talk:Selenium talk test" page
When I click the talk button
Then there should be a save discussion button
Scenario: A newly created topic appears in the list of topics immediately
Given the page "Talk:Selenium talk test" exists
And I am logged into the mobile website
And the page "Selenium talk test" exists
Given I am logged into the mobile website
And I am on a page with no talk topics
When I click the talk button
And I see the talk overlay
And no topic is present

View File

@ -7,11 +7,11 @@ Feature: Manage Watchlist
Scenario: Add an article to the watchlist
Given I am viewing an unwatched page
When I click the watch star
Then I should see a toast with message "Added Selenium mobile watch test to your watchlist"
Then I should see a toast with message "Added"
And the watch star should be selected
Scenario: Remove an article from the watchlist
Given I am viewing a watched page
When I click the unwatch star
Then I should see a toast with message "Removed Selenium mobile watch test from your watchlist"
Then I should see a toast with message "Removed"
And the watch star should not be selected

View File

@ -0,0 +1,31 @@
const {
iAmOnAPageThatDoesNotExist, iClickTheBrowserBackButton,
iClickTheOverlayCloseButton, iDoNotSeeAnOverlay,
iAmLoggedIntoTheMobileWebsite
} = require( '../features/step_definitions/common_steps' ),
{
iClickTheEditButton, iSeeTheWikitextEditorOverlay
} = require( '../features/step_definitions/editor_steps' );
// @chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org @vagrant @login
describe( 'Wikitext Editor', () => {
beforeEach( () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnAPageThatDoesNotExist();
iClickTheEditButton();
iSeeTheWikitextEditorOverlay();
} );
// @smoke
it( 'Closing editor (overlay button)', () => {
iClickTheOverlayCloseButton();
iDoNotSeeAnOverlay();
} );
it( 'Closing editor (browser button)', () => {
iClickTheBrowserBackButton();
iDoNotSeeAnOverlay();
} );
} );

View File

@ -0,0 +1,34 @@
const {
iAmLoggedIntoTheMobileWebsite,
iAmOnPage
} = require( '../features/step_definitions/common_steps' ),
{ iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu,
iClickOnTheMainNavigationButton,
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer
} = require( '../features/step_definitions/menu_steps' );
// @chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org @vagrant @login
describe( 'Menus open correct page for anonymous users', () => {
beforeEach( () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnPage( 'Main Page' );
} );
it( 'Check links in menu', () => {
iClickOnTheMainNavigationButton();
iShouldSeeALinkToDisclaimer();
iShouldSeeAUserPageLinkInMenu();
iSeeALinkToAboutPage();
[ 'Log out', 'Home', 'Random', 'Settings', 'Contributions',
'Watchlist' ].forEach( ( label ) => {
iShouldSeeALinkInMenu( label );
} );
try {
iShouldSeeALinkInMenu( 'Nearby' );
} catch ( e ) {
// eslint-disable-next-line no-console
console.warn( 'Nearby item will only appear in main menu if $wgMFNearby is configured' );
}
} );
} );

View File

@ -0,0 +1,30 @@
const {
pageExists, iShouldSeeAToastNotification,
iAmUsingMobileScreenResolution,
iAmUsingTheMobileSite,
iAmLoggedIntoTheMobileWebsite,
iAmOnPage
} = require( '../features/step_definitions/common_steps' ),
{
iClickTheSearchIcon,
iTypeIntoTheSearchBox,
iClickASearchWatchstar,
iSeeTheSearchOverlay
} = require( '../features/step_definitions/search_steps' );
// @test2.m.wikipedia.org @vagrant @login
describe( 'Search', () => {
it( 'Clicking on a watchstar toggles the watchstar', () => {
iAmUsingTheMobileSite();
pageExists( 'Selenium search test' );
iAmLoggedIntoTheMobileWebsite();
iAmOnPage( 'Main Page' );
iAmUsingMobileScreenResolution();
iClickTheSearchIcon();
iSeeTheSearchOverlay();
iTypeIntoTheSearchBox( 'Selenium search tes' );
iClickASearchWatchstar();
iShouldSeeAToastNotification();
} );
} );

View File

@ -0,0 +1,76 @@
const { iAmOnAPageWithNoTalkTopics } = require( '../features/step_definitions/create_page_api_steps' ),
{
pageExists, iAmOnAPageThatDoesNotExist,
iAmUsingTheMobileSite,
iAmLoggedIntoTheMobileWebsite,
iAmOnPage
} = require( '../features/step_definitions/common_steps' ),
{
iClickTheTalkButton,
iAddATopic,
iSeeTheTalkOverlay,
thereShouldBeASaveDiscussionButton,
noTopicIsPresent,
thereShouldBeAnAddDiscussionButton,
thereShouldBeNoTalkButton,
iShouldSeeTheTopicInTheListOfTopics
} = require( '../features/step_definitions/talk_steps' );
// @chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org @vagrant
describe( 'Talk', () => {
beforeEach( () => {
iAmUsingTheMobileSite();
pageExists( 'Talk:Selenium talk test' );
pageExists( 'Selenium talk test' );
} );
it( 'Add discussion on talk page not possible as logged out user', () => {
iAmOnPage( 'Selenium talk test' );
thereShouldBeNoTalkButton();
} );
// @login
it( 'Talk on a page that does exist', () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnPage( 'Selenium talk test' );
iClickTheTalkButton();
iSeeTheTalkOverlay();
} );
// @login
it( 'Talk on a page that doesn\'t exist (bug 64268)', () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnAPageThatDoesNotExist();
iClickTheTalkButton();
iSeeTheTalkOverlay();
} );
// @smoke @login
it( 'Add discussion for talk page possible as logged in user', () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnPage( 'Selenium talk test' );
iClickTheTalkButton();
thereShouldBeAnAddDiscussionButton();
} );
// @smoke @login
it( 'Add topic button shows on talk pages for logged in users', () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnAPageThatDoesNotExist();
iAmOnPage( 'Talk:Selenium talk test' );
iClickTheTalkButton();
thereShouldBeASaveDiscussionButton();
} );
it( 'A newly created topic appears in the list of topics immediately', () => {
iAmLoggedIntoTheMobileWebsite();
iAmOnAPageWithNoTalkTopics();
iClickTheTalkButton();
iSeeTheTalkOverlay();
noTopicIsPresent();
iAddATopic( 'New topic' );
iShouldSeeTheTopicInTheListOfTopics( 'New topic' );
} );
} );

View File

@ -0,0 +1,21 @@
const { iAmLoggedIntoTheMobileWebsite } = require( '../features/step_definitions/common_steps' ),
{ iVisitMyUserPage, iShouldBeOnMyUserPage, thereShouldBeALinkToMyUploads,
thereShouldBeALinkToMyContributions, thereShouldBeALinkToMyTalkPage
} = require( '../features/step_definitions/user_page_steps' );
// @chrome @firefox @login @test2.m.wikipedia.org @vagrant
describe( 'User:<username>', () => {
beforeEach( () => {
iAmLoggedIntoTheMobileWebsite();
iVisitMyUserPage();
} );
// </username>@en.m.wikipedia.beta.wmflabs.org
it( 'Check components in user page', () => {
iShouldBeOnMyUserPage();
thereShouldBeALinkToMyTalkPage();
thereShouldBeALinkToMyContributions();
thereShouldBeALinkToMyUploads();
} );
} );

View File

@ -0,0 +1,31 @@
const { iAmViewingAWatchedPage,
iAmViewingAnUnwatchedPage } = require( '../features/step_definitions/create_page_api_steps' ),
{
iShouldSeeAToastNotificationWithMessage,
iAmLoggedIntoTheMobileWebsite
} = require( '../features/step_definitions/common_steps' ),
{
theWatchstarShouldNotBeSelected, theWatchstarShouldBeSelected,
iClickTheWatchstar, iClickTheUnwatchStar } = require( '../features/step_definitions/watch_steps' );
// @chrome @smoke @test2.m.wikipedia.org @login @vagrant
describe( 'Manage Watchlist', () => {
beforeEach( () => {
iAmLoggedIntoTheMobileWebsite();
} );
it( 'Remove an article from the watchlist', () => {
iAmViewingAWatchedPage();
iClickTheUnwatchStar();
iShouldSeeAToastNotificationWithMessage( 'Removed' );
theWatchstarShouldNotBeSelected();
} );
it( 'Add an article to the watchlist', () => {
iAmViewingAnUnwatchedPage();
iClickTheWatchstar();
iShouldSeeAToastNotificationWithMessage( 'Added' );
theWatchstarShouldBeSelected();
} );
} );