You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or you can use another hermione helper - [only](#only), which is silent by default:
119
+
```js
120
+
hermione.only.in('chrome');
121
+
```
122
+
123
+
It will run tests only in one browser and skip rest silently.
124
+
108
125
### Flexible tests configuration
109
126
`Hermione` has possibility to configure running some set of tests in specific browsers. For example,
110
127
```js
@@ -138,32 +155,39 @@ selenium-standalone start
138
155
This feature allows you to ignore the specified suite or test in any browser with additional comment.
139
156
You can do it by using global `hermione.skip` helper. It supports the following methods:
140
157
141
-
-`.in` — adds matchers for browsers with additional comment
158
+
-`.in` — adds matchers for browsers with additional comment;
142
159
-`.notIn` — `.in` method with reverted value;
143
160
144
-
Each method takes following arguments:
145
-
- browser {String|RegExp|Array<String|RegExp>} — matcher for browser(s) to skip
161
+
Each of these methods takes following arguments:
162
+
- browser {String|RegExp|Array<String|RegExp>} — matcher for browser(s) to skip;
146
163
-[comment] {String} — comment for skipped test;
164
+
-[options] {Object} - additional options;
147
165
148
166
**Note that matchers will be compared with `browserId` specified in a config file, e.g. `chrome-desktop`.**
149
167
150
168
For example,
151
169
```js
152
-
describe('feature', () => {
170
+
describe('feature', function() {
153
171
hermione.skip.in('chrome', "It shouldn't work this way in Chrome");
154
-
it('should work this way', () =>runTestThisWay());
172
+
it('should work this way', function() {
173
+
returnrunTestThisWay();
174
+
});
155
175
156
-
it('should work that way', () =>runTestThatWay());
176
+
it('should work that way', function() {
177
+
returnrunTestThatWay();
178
+
});
157
179
158
180
hermione.skip.in(['chrome', 'firefox',/ie\d*/], 'Unstable test, see ticket TEST-487');
159
-
it('should done some tricky things', () =>runTrickyTest());
181
+
it('should done some tricky things', function() {
182
+
returnrunTrickyTest();
183
+
});
160
184
});
161
185
```
162
186
163
187
in this case behaviour `it should work this way` will be skipped only in `chrome` browser, but will be run in other browsers. `It should work that way` will not be ignored. So skip will be applied only to the nearest test. If you need to skip all tests within a suite you can apply `skip` helper to a `describe` - all tests within this suite will be skipped with the same comment.
164
188
```js
165
189
hermione.skip.in('chrome', 'skip comment');
166
-
describe('some feature', () => {
190
+
describe('some feature', function() {
167
191
it(...);
168
192
it(...);
169
193
});
@@ -173,24 +197,49 @@ Also you can use `.notIn` method to invert matching. For example,
173
197
```js
174
198
// ...
175
199
hermione.skip.notIn('chrome', 'some comment');
176
-
it('should work this way', () =>doSomething());
200
+
it('should work this way', function() {
201
+
returndoSomething();
202
+
});
177
203
// ...
178
204
```
179
205
180
206
in this case test will be skipped in all browsers except `chrome`.
181
207
182
-
Methods `in` and `notIn` are chainable. So you can skip test in several browsers with different comments. For example,
208
+
All of these methods are chainable. So you can skip test in several browsers with different comments. For example,
183
209
```js
184
210
// ...
185
211
hermione.skip
186
212
.in('chrome', 'some comment')
187
213
.notIn('ie9', 'another comment');
188
-
it('test1', () =>doSomething());
214
+
it('test1', function() {
215
+
returndoSomething();
216
+
});
189
217
// ...
190
218
```
191
219
192
220
If you need to skip test in all browsers without a comment you can use [mocha `.skip` method](http://mochajs.org/#inclusive-tests) instead of `hermione.skip.in(/.*/);`. The result will be the same.
193
221
222
+
## Only
223
+
This feature allows you to ignore the specified suite or test in any browser silently (without any messages in reports).
224
+
You can do it by using global `hermione.only` helper. It supports only one method:
225
+
226
+
-`.in` — `hermione.skip.notIn` method with silent flag
227
+
228
+
This method takes following arguments:
229
+
- browser {String|RegExp|Array<String|RegExp>} — matcher for browser(s) to skip;
230
+
231
+
For example:
232
+
```js
233
+
// ...
234
+
hermione.only.in('chrome');
235
+
it('should work this way', function() {
236
+
returndoSomething();
237
+
});
238
+
// ...
239
+
```
240
+
241
+
in this case test will be skipped in all browsers **silently** except `chrome`.
242
+
194
243
## WebdriverIO extensions
195
244
`Hermione` adds some usefull methods and properties to the `webdriverio` session after its initialization.
0 commit comments