Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running cypress on angular2 quickstart #195

Closed
shauvik opened this issue Jul 31, 2016 · 4 comments
Closed

Running cypress on angular2 quickstart #195

shauvik opened this issue Jul 31, 2016 · 4 comments

Comments

@shauvik
Copy link

shauvik commented Jul 31, 2016

I'm trying to write a simple cypress test against the angular2 quickstart but it doesn't seem to be working although the page loads correctly.

Here is the app: https://github.com/angular/quickstart

And this is the test:

cy.visit("http://localhost:3000/index.html", {timeout: 8000})
cy.get("h1").should("have.value", "My First Angular 2 App");

It fails with error:

CypressError: Timed out retrying: expected '<h1>' to have value 'My First Angular 2 App', but the value was ''
@brian-mann
Copy link
Member

Whether you're testing Angular 1, 2, or anything else, Cypress doesn't care about it. As long as HTML is generated by the framework and is inserted into the DOM it'll work like everything else. :-)

The problem is that <h1> do not have value. Only <input> and <option> and <textarea> have value.

You're looking for

cy.get("h1").should("contain", "My First Angular 2 App")

or more succinctly

cy.contains("My First Angular 2 App")

@jdhines
Copy link

jdhines commented Apr 16, 2018

In my Angular app, what I'm seeing is 30+ seconds waiting for the localhost page I'm cy.visit()ing to return, even though when I just open that URL outside the test, it loads in half a second.

@brian-mann
Copy link
Member

@jdhines can you provide a reproducible repo? What version of Cypress are you using? There were some issues with the proxy choking due to nonperformant regexp a few versions ago but have been fixed. Please open a new issue so we can investigate.

@jdhines
Copy link

jdhines commented Apr 17, 2018

Opened #1608

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants