简体   繁体   中英

Can I run Jasmine + Protractor tests in a browser?

I am preparing a suite of E2E tests using protractor and Jasmine. Currently I'm running these from the command line using Node. In the past I've used Jasmine tests with the SpecRunner.html setup, which shows the results in the browser as they are run, allows you to select individual tests or sub-suites of tests to run, etc.

Has anyone set up Jasmine + Protractor tests in that way - output going into one browser window, while tests run in another browser window?

Alternatively, is there a Jasmine reporter that will provide a similar output format even if I still have to run the tests from the command line?

For jasmine2, look into jasmine2-screenshot-reporter package.

For jasmine1:

I've used protractor-html-screenshot-reporter package that generates nice test reports including screenshots:

  • initialize a baseDirectory inside the onPrepare function:

     onPrepare: function() { // Add a screenshot reporter and store screenshots to `/tmp/screnshots`: jasmine.getEnv().addReporter(new HtmlReporter({ baseDirectory: '/tmp/screenshots' })); } 
  • and observe a nicely HTML formatted test results:

在此输入图像描述

Hope this is what you were asking about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM