angularjs - 使用带有 angularjs 的 selenium 服务器在 Protractor 中描述后做一些事情

标签 angularjs node.js selenium-webdriver jasmine protractor

我想在每个描述之后(而不是每个测试用例之后)和每个描述之前做一些事情,有什么办法可以做到这一点?我尝试过以下格式,但它给了我一个错误,即未定义之前和之后,是否可以在每个描述之前和之后执行某些任务:

describe('testcase', function () {
    before(function () {
        --------------
    })
    beforeEach(function () {
       -----------------
    })
    afterEach(function () {
        --------------
    })
    after(function () {
        -----------------
    })
    it('task1', function () {
             -----------

    })it('task2', function () {
                  ------------------
    })
})

最佳答案

据我了解,你想要 beforeAll and afterAll这是在 jasmine 2.1 中引入的:

The beforeAll function is called only once before all the specs in describe are run, and the afterAll function is called after all specs finish. These functions can be used to speed up test suites with expensive setup and teardown.

对于旧的 jasmine 版本,可以在 jasmine-beforeAll package 的帮助下完成相同的操作。 .

关于angularjs - 使用带有 angularjs 的 selenium 服务器在 Protractor 中描述后做一些事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27415507/

相关文章:

node.js - Node - Passport Auth - Authed Post Route 在表单提交时挂起

javascript - Angularjs $compile(html)($scope) - 错误 : Converting circular structure to JSON

javascript - 停止 AngularJS 中的 setTimeout 函数(提示 : use $timeout)

angularjs - 如何使注入(inject)的 html 中的 ng-click 起作用?

angularjs - 图像未加载到带有 ftp url 的 <img> 标记中

ruby 中的 Java 流等效?

node.js - 仅为一条路线 express 设置特定的 bodyParser

javascript - chaiHttp 忽略端口

python-2.7 - 未知错误 : call function result missing 'value' for Selenium Send Keys even after chromedriver upgrade

python - 带 Selenium 网络驱动程序的鼠标滚轮,在没有滚动条的元素上?