是否有任何链接提供有关量角器中所有可用挂钩的信息。例如,在 webdriverIO 中,我们有以下内容:
onPrepare: function (config, capabilities) {},
beforeSession: function (config, capabilities, specs) {},
before: function (capabilities, specs) {},
beforeSuite: function (suite) {},
beforeHook: function () {},
afterHook: function () {},
beforeTest: function (test) {},
beforeCommand: function (commandName, args) {},
afterCommand: function (commandName, args, result, error) {},
afterTest: function (test) {},
afterSuite: function (suite) {},
after: function (result, capabilities, specs) {},
afterSession: function (config, capabilities, specs) {},
onComplete: function (exitCode, config, capabilities, results) {},
onReload: function(oldSessionId, newSessionId) {},
Run Code Online (Sandbox Code Playgroud)
我正在量角器中寻找类似的钩子。
我不能确保这些是 100% 全面的,但这是我不久前生成的。Protractor 和 Jasmine 按照它们运行的顺序挂钩。
--- beforeLaunch
--- onPrepare
--- jasmineStarted (set in jasmine reporter)
--- beforeAll
--- suiteStarted (set in jasmine reporter)
--- specStarted (set in jasmine reporter)
--- beforeEach
+++ afterEach
+++ specDone (set in jasmine reporter)
+++ suiteDone (set in jasmine reporter)
+++ afterAll
+++ jasmineDone (set in jasmine reporter)
+++ onComplete
+++ afterLaunch
Run Code Online (Sandbox Code Playgroud)
如果我错过了更多的钩子,我也会很感激有人指出它们。
基于注释的附加代码
onComplete: function (passed) {
if (!passed) {
request({
uri: https: '//${browserstack.user}:${browserstack.key}@api.browserstack.com/automate/sessions/${ browser.sessionId }.json', method: 'PUT', form: { status: 'error' },
});
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3201 次 |
| 最近记录: |