I am developing simple website (html, css) and I want to write few tests against it in Protractor.
Is it possible to check that kind of website with Protractor? I have html file on my computer only. Should I run this website locally on server? I don't think I can run test on file directly.
Yes, its possible to open a stand-alone local html file without hosting it on a local server.You have to add this browser.resetUrl = "file:///"
in your onPrepare()
function and then a browser.get("file:///C:/Users/demo/test.html")
would work
There are some good examples @this question - Opening a file with protractor
A common way to do it is to approach it in multiple steps:
Usually, this multi-step process is handled by a task runner like grunt
or gulp
. We use grunt
, grunt-contrib-connect
to serve from a directory, grunt-protractor-runner
to run protractor from grunt.
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.