mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 14:06:52 +00:00
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:
parent
d5ac4f4900
commit
0593278d05
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,6 +16,7 @@ composer.lock
|
|||
vendor
|
||||
screenshots/*.png
|
||||
.eslintcache
|
||||
tests/selenium/log
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
|
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal 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
5530
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -7,9 +7,17 @@
|
|||
"test": "grunt test",
|
||||
"doc": "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": {
|
||||
"@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",
|
||||
"grunt": "1.4.0",
|
||||
"grunt-banana-checker": "0.9.0",
|
||||
|
@ -24,6 +32,8 @@
|
|||
"mocha": "5.2.0",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
6
tests/selenium/.eslintrc.json
Normal file
6
tests/selenium/.eslintrc.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"wikimedia/selenium"
|
||||
]
|
||||
}
|
21
tests/selenium/README.md
Normal file
21
tests/selenium/README.md
Normal 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]
|
13
tests/selenium/pageobjects/edit.page.js
Normal file
13
tests/selenium/pageobjects/edit.page.js
Normal 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();
|
20
tests/selenium/specs/load.js
Normal file
20
tests/selenium/specs/load.js
Normal 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() );
|
||||
|
||||
} );
|
||||
|
||||
} );
|
11
tests/selenium/wdio.conf.js
Normal file
11
tests/selenium/wdio.conf.js
Normal 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',
|
||||
};
|
Loading…
Reference in a new issue