量角器中所有可用的钩子

Nin*_*nja 1 protractor

是否有任何链接提供有关量角器中所有可用挂钩的信息。例如,在 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)

我正在量角器中寻找类似的钩子。

Dub*_*Dev 6

我不能确保这些是 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)