Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

E2E tests not executing #929

Closed
jloveland opened this issue Sep 21, 2015 · 14 comments
Closed

E2E tests not executing #929

jloveland opened this issue Sep 21, 2015 · 14 comments
Assignees
Milestone

Comments

@jloveland
Copy link
Contributor

after running gulp protractor

Error: Angular could not be found on the page http://localhost:3000/authentication/signin : retries looking for angular exceeded

from the angular docs:

Caveats

Protractor does not work out-of-the-box with apps that bootstrap manually using angular.bootstrap. You must use the ng-app directive.

It looks like we manually bootstrap here
Do we need to add np-app somewhere?

@ilanbiala
Copy link
Member

@jloveland we should probably have an ng-app on either the HTML or body, though I usually prefer HTML. https://github.com/meanjs/mean/blob/master/modules/core/server/views/layout.server.view.html

@ilanbiala ilanbiala added this to the 0.4.2 milestone Sep 21, 2015
@ilanbiala ilanbiala self-assigned this Sep 21, 2015
@jloveland
Copy link
Contributor Author

That didn't work. Need someone to take a stab at this who has more Angular experience.

When was the last time someone tries running e2e tests with gulp protractor?

@ilanbiala
Copy link
Member

@jloveland have you tried running protractor through Grunt?

@jloveland
Copy link
Contributor Author

@ilanbiala I found that when running grunt protractor or gulp protractor you need to have the app running beforehand using grunt or gulp. Now that I can get the e2e tests running, I see that the following e2e test fails:

Signin Validation Should report missing credentials

I will fix this when I add e2e tests to #910

@ilanbiala
Copy link
Member

@jloveland is there any way to start the server before we start Karma? I thought there was.

@mleanos
Copy link
Member

mleanos commented Sep 24, 2015

I guess the grunt configuration is missing the protractor task... we can add it with this...

grunt.registerTask('test:e2e', ['env:test', 'lint', 'server', 'protractor']);

If this is added to the grunt file the tests should run... Although the User e2e is incorrect, due to the how we're handling client validation with ng-messages.
https://github.com/meanjs/mean/blob/master/modules/users/tests/e2e/users.e2e.tests.js#L8

The only additional steps for a developer using the e2e tests is to make sure selenium web driver is installed; I also installed protractor globally (not sure if it's needed though)
https://www.npmjs.com/package/grunt-protractor-runner#faq

One thing I noticed is that the protractor tests are pointing to port 3000. Is this correct? Shouldn't the tests be looking for the test environment port 3001?
https://github.com/meanjs/mean/blob/master/modules/articles/tests/e2e/articles.e2e.tests.js#L6

@jloveland
Copy link
Contributor Author

@mleanos you are correct, they should point to 3001 I am adding tests to #910 and can resolve this there.

@mleanos
Copy link
Member

mleanos commented Sep 24, 2015

@jloveland Are you adding a grunt task as well?

@jloveland
Copy link
Contributor Author

yes, I am adding both grunt and gulp

@mleanos
Copy link
Member

mleanos commented Sep 24, 2015

@jloveland I'm wondering if the intention of the e2e tests is for them to be ran against a production/staging database (environment). Looking at the articles e2e test, it looks like it is expecting the count of articles to be zero because when this test was written, we didn't allow non authenticated users to view the articles list. I think the e2e may need/expect actual data. It's a little confusing because the test is also expecting "Missing Credentials". WDYT?

@lirantal @ilanbiala @codydaig Should the e2e tests be running against an empty test database, or a production/staging database that has actual data? I'm thinking the latter.

@mleanos
Copy link
Member

mleanos commented Sep 24, 2015

This is a pretty good article that covers this subject...
http://blog.scottlogic.com/2014/08/06/angular-knockout-e2e-testing.html

What I gather from this article, is that we should be running it against our test environment, and writing our e2e tests with data population; just like we're doing in the server tests.

@jloveland
Copy link
Contributor Author

Yup, I am writing tests that use the test database. I have a function that will drop the test database and then my sign up tests create a user by filling out the sign up form. Then I can test sign in, etc.

@ilanbiala
Copy link
Member

@mleanos always test from scratch to avoid false logic in the code.

@mleanos
Copy link
Member

mleanos commented Sep 25, 2015

@ilanbiala Thank you. That sounds about right to me. I just got thrown off because the articles e2e test is a bit confusing.

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

Successfully merging a pull request may close this issue.

3 participants