Skip to content

Flakey-ness in e2e tests with ng serve #4478

Closed

Description

@gkalpak

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
All

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
1.0.0-beta.29

Mention any other details that might be useful.

In order to run e2e tests, one has to run ng serve and ng e2e in parallel. Now, because ng serve does some preprocessing before serving (webpack build), it seems that protractor may timeout before the Angular app is served. This leads to flakey-ness on CI.

We (think we) have run into this here (which is a cli-generated app), but this issue will probably affect all projects using the cli. I think @filipesilva was running into something similar recently. We have tried several things, from increasing timeouts to other hacks, but a more robust solution is necessary.

Something like this helper might be useful for users or maybe another way is more appropriate. But it sounds like something that would benefit most users and it would be nice if the cli provided an easy way out.

cc @IgorMinar

Activity

  1. filipesilva commented on Feb 7, 2017

    @filipesilva
    Contributor

    My usual solution to this is to not use ng serve for e2e tests in CI. Instead I use a simpler static server (like lite-server), which is guaranteed to start up fast.

    Something like this (in terms of npm scripts):

        "pree2e": "ng build",
        "e2e": "concurrently \"lite-server\" \"npm run protractor\" --kill-others --success first",
    

    I recognize the convenience of not having to manage processes to run e2e tests though. Maybe as part of #4256 a new flag could be introduced that would manage this on the CLI side.

    Hypothetically something like ng e2e --serve, defaulting to true.

  2. added 6 commits that reference this issue on Feb 8, 2017
    fa9f986
    6bb0a71
    e8b2066
    ab02a2e
    84fca65
    98d1714
  3. added a commit that references this issue on Feb 9, 2017
    8d2d93a
  4. added a commit that references this issue on Apr 12, 2017
    05e9e5c
  5. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Sep 6, 2019
  7. added a commit that references this issue on May 29, 2026
    7723301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions