Minor issues fixed while trying to write browser tests in plugins (#11214)

* [contributing.md] fix command for testing plugins

* [ui/chrome] add navLinkExists() method

* [mocha] expose describe.skip
This commit is contained in:
Spencer 2017-04-12 17:17:46 -07:00 committed by GitHub
parent 8c1c617161
commit 6b0aface7a
3 changed files with 8 additions and 2 deletions

View file

@ -245,10 +245,11 @@ npm run test:dev
This should work super if you're using the [Kibana plugin generator](https://github.com/elastic/generator-kibana-plugin). If you're not using the generator, well, you're on your own. We suggest you look at how the generator works.
To run the tests for just your particular plugin, assuming you plugin lives outside of the `plugins directory`, use the following command.
To run the tests for just your particular plugin run the following command from your plugin:
```bash
npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin
npm run test:server
npm run test:browser -- --dev # remove the --dev flag to run them once and close
```
### Cross-browser Compatibility

View file

@ -6,6 +6,10 @@ export default function (chrome, internals) {
return internals.nav;
};
chrome.navLinkExists = (id) => {
return !!internals.nav.find(link => link.id === id);
};
chrome.getNavLinkById = (id) => {
const navLink = internals.nav.find(link => link.id === id);
if (!navLink) {

View file

@ -93,6 +93,7 @@ export function setupTopLevelDescribeFilter(test) {
// to allow describe.only calls. we dont need interceptor as it will call describe internally
describeInterceptor.only = originalDescribe.only;
describeInterceptor.skip = originalDescribe.skip;
// ensure that window.describe isn't messed with by other code
Object.defineProperty(window, 'describe', {