mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-12 09:21:11 +00:00
Move Selenium test from mediawiki/core
Bug: T187859 Change-Id: Ib153f1d55e4471c4dc1e16ad3c9ae0ea9f73acf5
This commit is contained in:
parent
2cd16d6012
commit
68292ad0a8
11
tests/selenium/.eslintrc.json
Normal file
11
tests/selenium/.eslintrc.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json",
|
||||
"env": {
|
||||
"es6": true,
|
||||
"mocha": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"browser": false
|
||||
}
|
||||
}
|
33
tests/selenium/README.md
Normal file
33
tests/selenium/README.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Selenium tests
|
||||
|
||||
Please see tests/selenium/README.md file in mediawiki/core repository (usually at mediawiki/vagrant/mediawiki).
|
||||
|
||||
## Usage
|
||||
|
||||
Set up MediaWiki-Vagrant:
|
||||
|
||||
cd mediawiki/vagrant
|
||||
vagrant up
|
||||
vagrant provision
|
||||
cd mediawiki
|
||||
npm install
|
||||
|
||||
Run both mediawiki/core and skin tests from mediawiki/core folder:
|
||||
|
||||
npm run selenium
|
||||
|
||||
To run only skin tests, first in one terminal tab (or window) start Chromedriver:
|
||||
|
||||
chromedriver --url-base=wd/hub --port=4444
|
||||
|
||||
Then, in another terminal tab (or window) go to mediawiki/core folder:
|
||||
|
||||
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec skins/SKIN-NAME/tests/selenium/specs/*.js
|
||||
|
||||
Run only one skin test file from mediawiki/core folder:
|
||||
|
||||
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec skins/SKIN-NAME/tests/selenium/specs/FILE-NAME.js
|
||||
|
||||
To run only one skin test from mediawiki/core folder (name contains string 'TEST-NAME'):
|
||||
|
||||
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec skins/SKIN-NAME/tests/selenium/specs/FILE-NAME.js --mochaOpts.grep preferences TEST-NAME
|
7
tests/selenium/pageobjects/usermessage.page.js
Normal file
7
tests/selenium/pageobjects/usermessage.page.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
const Page = require( '../../../../../tests/selenium/pageobjects/page' );
|
||||
|
||||
class UserMessagePage extends Page {
|
||||
get usermessage() { return browser.element( 'div.usermessage' ); }
|
||||
}
|
||||
module.exports = new UserMessagePage();
|
45
tests/selenium/specs/user.js
Normal file
45
tests/selenium/specs/user.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
const assert = require( 'assert' ),
|
||||
CreateAccountPage = require( '../../../../../tests/selenium/pageobjects/createaccount.page' ),
|
||||
EditPage = require( '../../../../../tests/selenium/pageobjects/edit.page' ),
|
||||
UserLoginPage = require( '../../../../../tests/selenium/pageobjects/userlogin.page' ),
|
||||
UserMessagePage = require( '../pageobjects/usermessage.page' );
|
||||
|
||||
describe( 'User', function () {
|
||||
|
||||
var password,
|
||||
username;
|
||||
|
||||
before( function () {
|
||||
// disable VisualEditor welcome dialog
|
||||
UserLoginPage.open();
|
||||
browser.localStorage( 'POST', { key: 've-beta-welcome-dialog', value: '1' } );
|
||||
} );
|
||||
|
||||
beforeEach( function () {
|
||||
browser.deleteCookie();
|
||||
username = `User-${Math.random().toString()}`;
|
||||
password = Math.random().toString();
|
||||
} );
|
||||
|
||||
it( 'should be able to view new message banner', function () {
|
||||
|
||||
// create user
|
||||
browser.call( function () {
|
||||
return CreateAccountPage.apiCreateAccount( username, password );
|
||||
} );
|
||||
|
||||
// create talk page with content
|
||||
browser.call( function () {
|
||||
return EditPage.apiEdit( 'User_talk:' + username, Math.random().toString() );
|
||||
} );
|
||||
|
||||
// log in
|
||||
UserLoginPage.login( username, password );
|
||||
|
||||
// check
|
||||
assert.equal( UserMessagePage.usermessage.getText(), 'You have a new message (last change).' );
|
||||
|
||||
} );
|
||||
|
||||
} );
|
Loading…
Reference in a new issue