Problem: The protractor tests are sanely difficult to debug
Solution: Having properly configured IDE with debug support (e.g. Intellij/Webstorm) can save many hours of pain. Just set a new run configuration according to the protractor's manual, and now you can debug your tests straight from IDE. The only small caveat: debugging doesn't work with enabled sharding capabilities.
Problem: Something weird is going on and something doesn't work.
Solution: Interactive debugging with element explorer where can type any protractor command. Launch the element explorer with the following code
webdriver-manager start
cd node_modules/protractor/bin
./elementexplorer.js
Additionally, you can use elementor extension which works as a visualization tool (chrome extension) for element explorer.
Problem: Run tests in CI
Solution: In case of CI, we can run our e2e tests on all major browsers and different OS's. For that purpose, we can use Sauce Labs with credentials specified directly in protractor config file.
export.config = {
...
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
capabilities['tunnel-identifier']: process.env.BUILD_NUMBER,
...
}
If sauceKey and sauceUser are specified, seleniumServerJar will be ignored. The tests will run remotely via Sauce Labs.