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
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
chore(docs): new framework requirements in Protractor 6.0
Also converted the code in `lib/frameworks/README.md` to typescript. Also
exported the type of `Runner` so that framework-writers can use typescript.
Part of #3893
It is recommended that it also export a `protractorVersion` property:
20
+
21
+
```ts
22
+
/**
23
+
* The version of Protractor this framework was written for. Do not use syntax
24
+
* like "^6.0.0" - name a specific version of Protractor. This property is
25
+
* optional but recommended.
26
+
*
27
+
* @example"6.0.0"
28
+
* @type{string=}
29
+
*/
30
+
exportlet protractorVersion:string;
15
31
```
16
32
17
33
Requirements
18
34
------------
19
35
20
-
- `runner.emit` must be called with `testPass` and `testFail` messages. These
21
-
messages must be passed a `testInfo` object, with a `name` and `category`
22
-
property. The `category` property could be the name of the `describe` block
23
-
in jasmine/mocha, the `Feature` in cucumber, or the class name in something
24
-
like jUnit. The `name` property could be the name of an `it` block in
25
-
jasmine/mocha, the `Scenario` in cucumber, or the method name in something
26
-
like jUnit.
27
-
28
-
- `runner.runTestPreparer` must be called before any tests are run.
29
-
30
-
- `runner.getConfig().onComplete` must be called when tests are finished.
31
-
It might return a promise, in which case `exports.run`'s promise should not
32
-
resolve until after `onComplete`'s promise resolves.
33
-
34
-
- The returned promise must be resolved when tests are finished and it should return a results object. This object must have a `failedCount` property and optionally a `specResults`
35
-
object of the following structure:
36
-
```
37
-
specResults = [{
38
-
description: string,
39
-
assertions: [{
40
-
passed: boolean,
41
-
errorMsg: string,
42
-
stackTrace: string
43
-
}],
44
-
duration: integer
45
-
}]
46
-
```
36
+
-`runner.emit` must be called with `testPass` and `testFail` messages. These
37
+
messages must be passed a `testInfo` object with the following structure:
38
+
39
+
```ts
40
+
testInfo: {
41
+
category: string,
42
+
name: string
43
+
}
44
+
```
45
+
46
+
The `category` property could be the name of the `describe` block in
47
+
jasmine/mocha, the `Feature` in cucumber, or the class name in something like
48
+
jUnit.
49
+
The `name` property could be the name of an `it` block in jasmine/mocha, the
50
+
`Scenario` in cucumber, or the method name in something like jUnit.
51
+
52
+
-`runner.runTestPreparer` must be called after the framework has been
53
+
initialized but before any spec files are run. This function returns a
54
+
promise which should be waited on before executing tests.
55
+
56
+
-`runner.getConfig().onComplete` must be called when tests are finished.
57
+
It might return a promise, in which case `exports.run`'s promise should not
58
+
resolve until after `onComplete`'s promise resolves.
59
+
60
+
- The returned promise must be resolved when tests are finished and it should
61
+
return a results object. This object must have a `failedCount` property and
62
+
optionally a `specResults` object of the following structure:
63
+
64
+
```ts
65
+
specResults: [{
66
+
description: string,
67
+
assertions: [{
68
+
passed: boolean,
69
+
errorMsg: string,
70
+
stackTrace: string
71
+
}],
72
+
duration: integer
73
+
}]
74
+
```
75
+
76
+
### Future requirements
77
+
78
+
In Protractor 6.0, the following additional requirement will be added:
79
+
80
+
-`runner.afterEach` will have to be called after each test finishes. It will
81
+
return a promise, which should be waited for before moving onto the next test.
82
+
83
+
If your framework does not export a `protractorVersion` property which is at
84
+
least 6.0.0, and `testPass` or `testFail` are emitted before
85
+
`runner.afterEach` is called, Protractor will assume your framework is old and
86
+
does not support `runner.afterEach`. In this case, Protractor will call
87
+
`runner.afterEach` inside the listener for `testPass` or `testFail`.
88
+
Protractor will log warnings to the console if important asynchronous work
89
+
in `runner.afterEach` needed to finish before the next test started, since it
90
+
can't wait on a Promise from inside an event listener.
47
91
48
92
Custom Frameworks
49
93
-----------------
@@ -53,8 +97,8 @@ Protractor core please send a PR so it can evaluated for addition as an
53
97
official supported framework. In the meantime you can instruct Protractor
0 commit comments