RestorePage = require( '../pageobjects/restore.page' ),
EditPage = require( '../pageobjects/edit.page' ),
HistoryPage = require( '../pageobjects/history.page' ),
- UserLoginPage = require( '../pageobjects/userlogin.page' );
+ UserLoginPage = require( '../pageobjects/userlogin.page' ),
+ Util = require( 'wdio-mediawiki/Util' );
describe( 'Page', function () {
var content,
name;
- function getTestString( suffix = 'defaultsuffix' ) {
- return Math.random().toString() + '-Iñtërnâtiônàlizætiøn☃-' + suffix;
- }
-
before( function () {
// disable VisualEditor welcome dialog
UserLoginPage.open();
beforeEach( function () {
browser.deleteCookie();
- content = getTestString( 'beforeEach-content' );
- name = getTestString( 'beforeEach-name' );
+ content = Util.getTestString( 'beforeEach-content-' );
+ name = Util.getTestString( 'BeforeEach-name-' );
} );
it( 'should be creatable', function () {
} );
it( 'should be re-creatable', function () {
- let initialContent = getTestString( 'initialContent' );
+ let initialContent = Util.getTestString( 'initialContent-' );
// create
browser.call( function () {
} );
// edit
- let editContent = getTestString( 'editContent' );
+ let editContent = Util.getTestString( 'editContent-' );
EditPage.edit( name, editContent );
// check
const assert = require( 'assert' ),
Api = require( 'wdio-mediawiki/Api' ),
- RecentChangesPage = require( '../pageobjects/recentchanges.page' );
+ RecentChangesPage = require( '../pageobjects/recentchanges.page' ),
+ Util = require( 'wdio-mediawiki/Util' );
describe( 'Special:RecentChanges', function () {
let content,
name;
- function getTestString() {
- return Math.random().toString() + '-öäü-♠♣♥♦';
- }
-
beforeEach( function () {
browser.deleteCookie();
- content = getTestString();
- name = getTestString();
+ content = Util.getTestString();
+ name = Util.getTestString();
} );
it( 'shows page creation', function () {
CreateAccountPage = require( '../pageobjects/createaccount.page' ),
PreferencesPage = require( '../pageobjects/preferences.page' ),
UserLoginPage = require( 'wdio-mediawiki/LoginPage' ),
- Api = require( 'wdio-mediawiki/Api' );
+ Api = require( 'wdio-mediawiki/Api' ),
+ Util = require( 'wdio-mediawiki/Util' );
describe( 'User', function () {
var password,
beforeEach( function () {
browser.deleteCookie();
- username = `User-${Math.random().toString()}`;
- password = Math.random().toString();
+ username = Util.getTestString( 'User-' );
+ password = Util.getTestString();
} );
it( 'should be able to create account', function () {
} );
it( 'should be able to change preferences', function () {
- var realName = Math.random().toString();
+ var realName = Util.getTestString();
// create
browser.call( function () {
--- /dev/null
+module.exports = {
+ getTestString( prefix = '' ) {
+ return prefix + Math.random().toString() + '-Iñtërnâtiônàlizætiøn☃';
+ }
+};