selenium: The first test

The first test just opens the page for editing and checks if it opened.

Bug: T284165
Change-Id: Ifffaf3e5ab14811605d96fcdcfdc1f773880e52c
This commit is contained in:
Željko Filipin 2017-03-28 15:59:35 +02:00 committed by Esther Akinloose
parent d5ac4f4900
commit 0593278d05
9 changed files with 4392 additions and 1239 deletions

1
.gitignore vendored
View file

@ -16,6 +16,7 @@ composer.lock
vendor vendor
screenshots/*.png screenshots/*.png
.eslintcache .eslintcache
tests/selenium/log
# OS # OS
.DS_Store .DS_Store

15
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "run select spec",
"type": "node",
"request": "launch",
"args": ["modules/ve-mw/tests/selenium/wdio.conf.js", "--spec", "${file}"],
"cwd": "${workspaceFolder}",
"autoAttachChildProcesses": true,
"program": "${workspaceRoot}/node_modules/@wdio/cli/bin/wdio.js",
"console": "integratedTerminal"
}
]
}

5530
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,9 +7,17 @@
"test": "grunt test", "test": "grunt test",
"doc": "jsduck", "doc": "jsduck",
"postdoc": "grunt copy:jsduck", "postdoc": "grunt copy:jsduck",
"screenshots-all": "grunt screenshots-all" "screenshots-all": "grunt screenshots-all",
"selenium-daily": "npm run selenium-test",
"selenium-test": "wdio tests/selenium/wdio.conf.js"
}, },
"devDependencies": { "devDependencies": {
"@wdio/cli": "7.4.6",
"@wdio/dot-reporter": "7.4.2",
"@wdio/junit-reporter": "7.4.2",
"@wdio/local-runner": "7.4.6",
"@wdio/mocha-framework": "7.4.6",
"@wdio/sync": "7.4.6",
"eslint-config-wikimedia": "0.20.0", "eslint-config-wikimedia": "0.20.0",
"grunt": "1.4.0", "grunt": "1.4.0",
"grunt-banana-checker": "0.9.0", "grunt-banana-checker": "0.9.0",
@ -24,6 +32,8 @@
"mocha": "5.2.0", "mocha": "5.2.0",
"selenium-webdriver": "3.6.0", "selenium-webdriver": "3.6.0",
"stringify-object": "3.2.2", "stringify-object": "3.2.2",
"stylelint-config-wikimedia": "0.11.1" "stylelint-config-wikimedia": "0.11.1",
"wdio-mediawiki": "1.1.1",
"webdriverio": "7.4.6"
} }
} }

View file

@ -0,0 +1,6 @@
{
"root": true,
"extends": [
"wikimedia/selenium"
]
}

21
tests/selenium/README.md Normal file
View file

@ -0,0 +1,21 @@
# Selenium tests
For more information see https://www.mediawiki.org/wiki/Selenium
## Setup
See https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/VisualEditor
## Run all tests
npm run selenium-test
## Run specific tests
Filter by file name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME]
Filter by file name and test name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME] --mochaOpts.grep [TEST-NAME]

View file

@ -0,0 +1,13 @@
'use strict';
const Page = require( 'wdio-mediawiki/Page' );
class EditPage extends Page {
get notices() { return $( '.ve-ui-mwNoticesPopupTool-items' ); }
openForEditing( title ) {
super.openTitle( title, { veaction: 'edit', vehidebetadialog: 1, hidewelcomedialog: 1 } );
}
}
module.exports = new EditPage();

View file

@ -0,0 +1,20 @@
'use strict';
const assert = require( 'assert' );
const EditPage = require( '../pageobjects/edit.page' );
const Util = require( 'wdio-mediawiki/Util' );
const LoginPage = require( 'wdio-mediawiki/LoginPage' );
describe( 'VisualEditor', function () {
it( 'should load when an url is opened', function () {
LoginPage.loginAdmin();
const name = Util.getTestString();
EditPage.openForEditing( name );
EditPage.notices.waitForDisplayed();
assert( EditPage.notices.isDisplayed() );
} );
} );

View file

@ -0,0 +1,11 @@
'use strict';
const { config } = require( 'wdio-mediawiki/wdio-defaults.conf.js' );
exports.config = { ...config
// Override, or add to, the setting from wdio-mediawiki.
// Learn more at https://webdriver.io/docs/configurationfile/
//
// Example:
// logLevel: 'info',
};