kb-dk / primo-explore-rex

A Primo customization package by Royal Danish Library.
https://rex.kb.dk
MIT License
13 stars 3 forks source link

How to run end-to-end tests against local devenv? #6

Open ericgriffis opened 6 years ago

ericgriffis commented 6 years ago

I'm at NYU Libraries and we're implementing Primo NUI customizations, influenced greatly by your wonderful work on this repo. We've attempted end-to-end testing in a variety of frameworks but have been unsuccessful so far. I was able to run your e2e tests against your production primo, but I can't seem to run them against a local devenv, which it appears you all have done (due to the localhost in the config). When I attempt to run it against a local devenv, it doesn't load the page at all – it remains stuck on the loading symbol. That's true whether I use your customization views, ours, or none at all on my local devenv.

How were you able to run the Protractor e2e tests against a local devenv? Did you have to configure the devenv or tests in any special way? Any advice on this and automated testing of Primo NUI in general would be greatly appreciated.

muratseyhan commented 6 years ago

Sorry for getting back so late. I am no longer working at Royal Danish Library, but I know that we ran them against our local environment too. If you still have the issue, could you check out the browser console and describe what you see? Otherwise, it would be great to know how you handled the issue.

ericgriffis commented 6 years ago

Thanks for the reply @muratseyhan – The browser console isn't showing any errors when we run via Protractor, but Protractor is giving the error "Angular could not be found on the page … : angular never provided resumeBootstrap." I've read that this may be caused by BrowserSync, but I can't find a way to disable BrowserSync in the devenv and I've opened up an issue with them in that regard.

Is this an issue you encountered? Were you running the primo UI locally using the devenv or in some custom way?

muratseyhan commented 6 years ago

Just to make sure, you are running the app locally while trying this, right?

We were using the devenv. IIRC, the only configuration we had on the devenv was the PROXY_SERVER in gulp/config.js. I will try to reproduce this when I will have the chance.

ericgriffis commented 6 years ago

@muratseyhan Yes I was running the app locally (via the devenv). I also tried pointing to another proxy server over http and I got the same result. I can't point to a proxy server over https, however, because the devenv is running locally in http. Did you setup the devenv to run over https locally perhaps?

muratseyhan commented 6 years ago

Hi @ericgriffis!

I finally had the chance to try this out. I was able to run the tests on a local server on Ubuntu 17.10. Some of the tests failed, but that's probably expected. They ran on protractor 5.3.0. I had to degrade to node v6.9.2 and install JDK to get protractor run.

Also, it seemed to work the same both with HTTP and HTTPS proxy URLs.

$ npm -v
3.10.9

$ node -v
v6.9.2

$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

I did a quick search on the error you receive, and it seemed to me like the error you received might be specific to some versions of protractor. Could you give it another try with the versions I used?