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
Copy file name to clipboardExpand all lines: README.md
+39-4Lines changed: 39 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,7 +203,17 @@ If the sub-task contains a property `commands`, this property is supposed to poi
203
203
}
204
204
```
205
205
206
-
You can use sub-tasks and commands to create test scenarios and execute them separately, or all of them.
206
+
If the sub-task contains a property `scenarios`, this property is supposed to point to a JavaScript module path or to an array of JavaScript module paths, which would export the array of commands. Relative paths will be resolved to the current (process) directory. It allows to keep the Gruntfile legible and supply the test instructions from other files:
207
+
208
+
```js
209
+
'html-dom-snapshot': {
210
+
all: {
211
+
scenarios:'scenarios/*.js'
212
+
}
213
+
}
214
+
```
215
+
216
+
You can use sub-tasks, `commands` and `scenarios` to structure your code and execute the tests separately, or all of them in one browser window.
207
217
208
218
### Instructions
209
219
@@ -481,7 +491,7 @@ The module for the address book implementation would look like this:
481
491
482
492
```js
483
493
module.exports= {
484
-
options: {...},
494
+
options: {...},// optional task-specific options
485
495
commands: [
486
496
{
487
497
url:'https://localhost/addressbook'
@@ -492,6 +502,29 @@ module.exports = {
492
502
}
493
503
```
494
504
505
+
The same tests will be run in a single browser window, if the Gruntfile contains just a single sub-task and the tests are specified by scenario files:
506
+
507
+
```js
508
+
'html-dom-snapshot': {
509
+
all: {
510
+
scenarios:'test/scenarios/*.js'
511
+
}
512
+
}
513
+
```
514
+
515
+
The directory "test/scenarios" would contain files "addressbook.js", "calendar.js", "inbox.js" and "tasks.js", which would specify only the array of commands; not the entire sub-task objects. For example, the address book implementation:
0 commit comments