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

Getting intermittent node error when going to URL getaddrinfo ENOTFOUND #1755

Closed
robert-smith135 opened this issue May 22, 2018 · 7 comments
Closed

Comments

@robert-smith135
Copy link

@robert-smith135 robert-smith135 commented May 22, 2018

Hi, we're running cypress to test the local news section of the BBC news site on out TEST environment https://www.test.bbc.co.uk/news/localnews/2653822-Cardiff/0. (This should be publicly accessible). We have a test that look at the radius buttons to see if they redirect correctly. However it looks like there is some flake (unless I'm doing something wrong) when clicking the button and running an assertion to see if the page has redirected. When running a click command on the button cypress sometimes throws a node networking error: getaddrinfo ENOTFOUND when the page is reloaded.

I'm running the tests in the CLI mode, and the cypress gives me the following screenshot on the failing test:

screen shot 2018-05-22 at 09 02 49

Current behavior:

The test below sometimes fails.

Desired behavior:

The below test works every time

Steps to reproduce:

Running the below test with the CLI using the cypress docker container https://github.com/cypress-io/cypress-docker-images/tree/master/browsers/chrome65-ff57 sometimes fails.

Im also using the "chromeWebSecurity": false option in cypress.config.

        it('has radius buttons that redirect as expected', () => {
            cy.server();
            cy.route('https://www.int.bbc.co.uk/news/localnewsdata/2653822/0/50/50').as('getLocalNewsData');
            cy.route('https://www.int.bbc.co.uk/news/localnewsdata/promoted-content/2653822/0').as('getPromotedContentData');
            cy.visit(path + "/2653822-cardiff/0?component-env=int");

            cy.wait('@getLocalNewsData');
            cy.wait('@getPromotedContentData');

            cy.get('.local-news-radius__link').should('have.length', 5);
            cy.get('.local-news-radius__link').eq(4).click();

            cy.url().should('eq', path + '/2653822-cardiff/30');
            cy.get('.local-news-radius__link>a').eq(4).should('be.visible').and('have.class', 'selected');

            cy.get('.local-news-radius__link').eq(3).click();
            cy.url().should('eq', path + '/2653822-cardiff/20');
            cy.get('.local-news-radius__link>a').eq(3).should('be.visible').and('have.class', 'selected');

            cy.get('.local-news-radius__link').eq(2).click();
            cy.url().should('eq', path + '/2653822-cardiff/10');
            cy.get('.local-news-radius__link>a').eq(2).should('be.visible').and('have.class', 'selected');

            cy.get('.local-news-radius__link').eq(1).click();
            cy.url().should('eq', path + '/2653822-cardiff/5');
            cy.get('.local-news-radius__link>a').eq(1).should('be.visible').and('have.class', 'selected');

            cy.get('.local-news-radius__link').eq(0).click();
            cy.url().should('eq', path + '/2653822-cardiff/0');
            cy.get('.local-news-radius__link>a').eq(0).should('be.visible').and('have.class', 'selected');
        });

Versions

Cypress: 2.1.0
Browser: Election
Operating System: Debian

@robert-smith135 robert-smith135 changed the title Getting node error when going to URL getaddrinfo ENOTFOUND Getting intermittent node error when going to URL getaddrinfo ENOTFOUND May 22, 2018
@Bkucera
Copy link
Member

@Bkucera Bkucera commented May 22, 2018

Hi, I tried to reproduce your failure, but it seems I'm failing even earlier than you. I got redirected to a data: url... see here:
image

Could you provide a fully reproducible example, using https://github.com/cypress-io/cypress-test-tiny ? For example, just a single spec file that fails.

@robert-smith135
Copy link
Author

@robert-smith135 robert-smith135 commented May 23, 2018

Apologies, I should have mentioned that that page runs a script that redirects the page to an international version if you access it from a location outside the United Kingdom. I get around this by blacklisting the host that the script is requested from, so it never runs.

We run the tests inside a container. We're using Docker version 18.03.1-ce-mac65 (24312). I've created a sample repo here with the problem test.

https://github.com/robert-smith135/test

When cloned run these commands:

  • npm install
  • docker build -t test:latest .
  • docker run --rm -v pwd:/usr/local/bbc -t cypress-test:latest bash -lc "cypress run -s cypress/integration/topicPage.spec.js"

Because this problem seems to be intermittent I wrote a simple bash script that keeps track of passes and failures that you can run by:

sh runonloop.sh

@Bkucera Bkucera removed their assignment Dec 18, 2018
@saikrishna321
Copy link

@saikrishna321 saikrishna321 commented May 9, 2019

@jennifer-shehane I'm seeing the same error with latest Cypress and the same tests work fine on my test env and fail on another env. Not sure how to debug on the issue

@flotwig
Copy link
Member

@flotwig flotwig commented Jun 13, 2019

We removed this 500 error in 3.3.0, opting instead to propagate the network error directly to the browser. However, we should also retry on ENOTFOUND errors, which will be done in #4424

Closing since it's working as it should now and there is another issue to improve the experience.

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Jun 19, 2019

The code for this is done in #4459, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@yafaQA
Copy link

@yafaQA yafaQA commented Jun 24, 2019

Hi @jennifer-shehane, any updates on when this fix would be released? Thanks

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented Jun 27, 2019

Released in 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants