Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Protractor tests and configuration should be updated #478

Closed
lordgreg opened this issue Feb 7, 2017 · 6 comments
Closed

Protractor tests and configuration should be updated #478

lordgreg opened this issue Feb 7, 2017 · 6 comments

Comments

@lordgreg
Copy link
Contributor

lordgreg commented Feb 7, 2017

Hi..

I was recently told to dive deeper into the whole e2e testing process. One of the big things I was told to do, or to make it work is to run the e2e tests on devices. I succeeded but with issues because of which, I think we should change some parts of configuration and generating of protractor files.

1. Before explaining the issue

Looking at protractor.conf.js, we find out the baseUrl is set to http://localhost:3000. and within the tests, switching states we are using browser.get('/#/someRoute'). Merging this two things together, we get http://localhost:3000/#/someRoute. It works.

2. Now, we want to take a huge leap into the App Testing on Device/Simulator/Emulator. There, we find out few things:

  • There's no server available on port 3000,
  • There's no option to user http base,
  • All files are accessible using file:/// base

That being said, lets assume we first update the baseUrl, which is now: file:///android_asset/www/index.html (Android in this example). We can get the path using location.origin + location.pathname.

When now using existing calls using browser.get('/#/someRoute'), we are getting url which looks like this: file:///android_asset/www/index.html/#/someRoute, which results in network error (or simply said, file not found).

3. So, what should we do?

To make protractor tests universal, meaning independent of platform on which we are running tests, we have to change two things,

first, update protractor.conf.js baseUrl from http://localhost:3000 to http://localhost:3000/,
second, change all occurrences of browser.get() in protractor tests which start with /#/someRoute into #/someRoute.

This way, we avoid the collision of paths for different platforms. There's many other things but this one is the single one found to be working properly. This does not concern changing any other part of app, only protractor and, in case of device testing, protractor+appium.


I'd love to hear your comment about this @gruppjo & @MathiasTim

@gruppjo
Copy link
Contributor

gruppjo commented Feb 8, 2017

From my point of view, there's absolutely no reason not to do that. Small unobtrusive change. I'll get right on it unless you'd rather like to create a PR @lordgreg?

@gruppjo
Copy link
Contributor

gruppjo commented Feb 8, 2017

A couple of months ago I tried to have the default protractor tests run in our travis setup but didn't succeed. Maybe this is worth looking into again. Since that way we could ensure that the default protractor tests work with every build, without having to manually run them (this is what I am mostly doing right now).
More info here: travis-ci/travis-ci#272

@lordgreg
Copy link
Contributor Author

lordgreg commented Feb 8, 2017

@gruppjo I don't care :) If you have time you do it, otherwise I'll push things in next week 🙊

@gruppjo
Copy link
Contributor

gruppjo commented Feb 15, 2017

@lordgreg. Implementing this now.

@lordgreg
Copy link
Contributor Author

👍

@gruppjo gruppjo closed this as completed Feb 15, 2017
gruppjo added a commit that referenced this issue Feb 17, 2017
#478 reporters update for karma and protractor conf
@gruppjo
Copy link
Contributor

gruppjo commented Feb 17, 2017

PR: protractor and karma conf update for better reporting: #489

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants