wiki.techinc.nl/tests/selenium/pageobjects/preferences.page.js

19 lines
422 B
JavaScript
Raw Normal View History

const Page = require( 'wdio-mediawiki/Page' );
Selenium tests in Node.js using WebdriverIO Introduce the WebdriverIO browser testing framework driven by Node.js. The overall intents are: * have MediaWiki core to provide a platform to run tests that is shared between core and the extensions. * phase out ruby driven browser tests eventually. Code is namespaced in sub directory /tests/selenium The 'pages' sub directory provides helper representing a MediaWiki page such as Special:Login and human friendly helpers to interact with the elements. Add Grunt task webdriver:test. Provide a npm script to easily spawn/dispose chromedriver and run above grunt task. wdio.conf.js provides all the configuration. It defaults to point to a MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be overriden with environment settings as needed. glob patterns (specs) are made absolute paths from MediaWiki root path that let us run the tests either from the root path (eg the npm wrapper or from the tests/selenium directory when invoking wdio directly. wdio assumes they are relative to the current working directory, hence the normalization. wdio.conf.jenkins.js extends the configuration and is used solely for Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME is set. Specially we want junit reports to be generated. Provide a more specific eslint configuration. References: * MALU https://phabricator.wikimedia.org/source/malu/ * T151442 Research WebdriverIO * T151443 Research Nightwatch.js Bug: T139740 Signed-off-by: Antoine Musso <hashar@free.fr> Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2016-12-19 16:39:29 +00:00
class PreferencesPage extends Page {
Revert "Special:Preferences: Use OOjs UI" and follow-ups The number of issues with the new interface is unacceptable and we will not be able to fix them reasonably quickly. See subtasks of T180538 for the list of issues, raised both by the Wikimedia community and by WMF employees. I should have pushed back harder against the merging of this half-baked change with the promise that we'll fix it later. I convinced myself that the regressions were not so noticeable and that the issues that were pointed out will in fact be fixed by someone. Predictably, however, regressions were bad and the only person fixing the issues was me. I am not going to work nights to make this page decent again within a reasonable timeframe; I'm not sure if I'd even be able to since many issues are problems with the design rather than the implementation. No one else seems to be working on improving it, therefore I am reverting the change. On the bright side, this work has resulted in a number of improvements to HTMLForm and Preferences code, which are not being reverted here: <https://gerrit.wikimedia.org/r/#/q/topic:T117781>. If anyone reattempts this, I recommend gating the new interface behind a configuration variable and URL parameter, like we did with $wgOOUIEditPage in the past, and testing thoroughly in production before enabling it for everyone. * Revert "Special:Preferences: Use OOjs UI" This reverts commit 486e566cfef612de6773df435a74d5fc37e27174. * Revert "Preferences: Show preview of edit fonts in edit font selector" This reverts commit 6634ff729dc7f6d0f541639dbdf3c4d9f786ddf6. * Revert "Follow-Up Iae63b6994: Add missing editfont dependency" This reverts commit ce42fdf151c39f91cf4077673219fa6228a54d7f. * Revert "Preferences: Improve visual appearance by “unboxing” sections" This reverts commit c9415bb0059f4dae4abc5e39a8af844328333120. * Revert "Remove box-shadow from preference panels for ooui-apex" This reverts commit a934b82ca27971e8f0553a7ab7c8ee30fccf3283. * Revert "Preferences: Don't show the watchlist token; just link to ResetTokens" This reverts commit e8c9102fc7b66460c33f643b0dea7190cb89ac83. * Revert "mw.special.preferences: Make the "Basic information" section more compact" This reverts commit d48b7260f30c1ec57046a1f8e4c82057aed45e5f. * Revert "mw.special.preferences: Widen the dropdown of the "Time zone" field" This reverts commit afd5f1417efdd463d86186257c4ec77dd4a442ce. Bug: T117781 Bug: T180538 Change-Id: I44b5daea1828f71881b5bd35218f5ecb7ab7f36e
2017-12-02 21:15:35 +00:00
get realName() { return browser.element( '#mw-input-wprealname' ); }
get save() { return browser.element( '#prefcontrol' ); }
Selenium tests in Node.js using WebdriverIO Introduce the WebdriverIO browser testing framework driven by Node.js. The overall intents are: * have MediaWiki core to provide a platform to run tests that is shared between core and the extensions. * phase out ruby driven browser tests eventually. Code is namespaced in sub directory /tests/selenium The 'pages' sub directory provides helper representing a MediaWiki page such as Special:Login and human friendly helpers to interact with the elements. Add Grunt task webdriver:test. Provide a npm script to easily spawn/dispose chromedriver and run above grunt task. wdio.conf.js provides all the configuration. It defaults to point to a MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be overriden with environment settings as needed. glob patterns (specs) are made absolute paths from MediaWiki root path that let us run the tests either from the root path (eg the npm wrapper or from the tests/selenium directory when invoking wdio directly. wdio assumes they are relative to the current working directory, hence the normalization. wdio.conf.jenkins.js extends the configuration and is used solely for Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME is set. Specially we want junit reports to be generated. Provide a more specific eslint configuration. References: * MALU https://phabricator.wikimedia.org/source/malu/ * T151442 Research WebdriverIO * T151443 Research Nightwatch.js Bug: T139740 Signed-off-by: Antoine Musso <hashar@free.fr> Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2016-12-19 16:39:29 +00:00
open() {
super.openTitle( 'Special:Preferences' );
Selenium tests in Node.js using WebdriverIO Introduce the WebdriverIO browser testing framework driven by Node.js. The overall intents are: * have MediaWiki core to provide a platform to run tests that is shared between core and the extensions. * phase out ruby driven browser tests eventually. Code is namespaced in sub directory /tests/selenium The 'pages' sub directory provides helper representing a MediaWiki page such as Special:Login and human friendly helpers to interact with the elements. Add Grunt task webdriver:test. Provide a npm script to easily spawn/dispose chromedriver and run above grunt task. wdio.conf.js provides all the configuration. It defaults to point to a MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be overriden with environment settings as needed. glob patterns (specs) are made absolute paths from MediaWiki root path that let us run the tests either from the root path (eg the npm wrapper or from the tests/selenium directory when invoking wdio directly. wdio assumes they are relative to the current working directory, hence the normalization. wdio.conf.jenkins.js extends the configuration and is used solely for Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME is set. Specially we want junit reports to be generated. Provide a more specific eslint configuration. References: * MALU https://phabricator.wikimedia.org/source/malu/ * T151442 Research WebdriverIO * T151443 Research Nightwatch.js Bug: T139740 Signed-off-by: Antoine Musso <hashar@free.fr> Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2016-12-19 16:39:29 +00:00
}
changeRealName( realName ) {
this.open();
this.realName.setValue( realName );
this.save.click();
}
}
selenium: Minor clean-up in preparation for packaging This is functionally a no-op, purely refactoring (mostly style). * Consistently require packages at the top of a file. (e.g. MWBot in edit.page.js). * Remove unused .call(this) from mwbot interaction closures, which didn't use 'this'. * Use Node.js regular Promise chaining with then(), instead of complex bluebird.coroutine generator function yields, which are intended to emulate async-await, but the syntax is quite error-prone for inexperienced developers and hard to debug. Once we require Node 7+ for the selenium tests, we can use async-await here natively, but until then, might as well use regular then() syntax, which we already use elsewhere in the tests, and is also what MWBot documentation uses. * Also applied some minor whitespace changes for consistency among these files and other MediaWiki JS. E.g. no empty line before the first statement of a function. Add a new line between different methods, and between the end of a class and the export statement. * Remove 'use strict' from test files. The patterns that would expose the bad non-strict behaviour are mostly already forbidden by ESLint, and the run-time optimisation to disable non-strict can't be noticed in tests (more useful in prod where e.g. the same process would run a function 1 million times). Main reason here is to keep things simple for new-comers and reduce boilerplate, given that these tests will mainly be worked on by browser-JS developers, not Node.js devs, and we don't currently use strict mode in our front-end code, either. * Remove unused bluebird dependency. Bug: T193088 Change-Id: I59f9211299e8e884c28c7733bcee3b7b28542610
2018-05-02 03:48:36 +00:00
Selenium tests in Node.js using WebdriverIO Introduce the WebdriverIO browser testing framework driven by Node.js. The overall intents are: * have MediaWiki core to provide a platform to run tests that is shared between core and the extensions. * phase out ruby driven browser tests eventually. Code is namespaced in sub directory /tests/selenium The 'pages' sub directory provides helper representing a MediaWiki page such as Special:Login and human friendly helpers to interact with the elements. Add Grunt task webdriver:test. Provide a npm script to easily spawn/dispose chromedriver and run above grunt task. wdio.conf.js provides all the configuration. It defaults to point to a MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be overriden with environment settings as needed. glob patterns (specs) are made absolute paths from MediaWiki root path that let us run the tests either from the root path (eg the npm wrapper or from the tests/selenium directory when invoking wdio directly. wdio assumes they are relative to the current working directory, hence the normalization. wdio.conf.jenkins.js extends the configuration and is used solely for Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME is set. Specially we want junit reports to be generated. Provide a more specific eslint configuration. References: * MALU https://phabricator.wikimedia.org/source/malu/ * T151442 Research WebdriverIO * T151443 Research Nightwatch.js Bug: T139740 Signed-off-by: Antoine Musso <hashar@free.fr> Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2016-12-19 16:39:29 +00:00
module.exports = new PreferencesPage();