Skip to content

Target e2e suite #807

Closed
Closed

Description

@hboylan

Hey all, I've found that it'd be nice to target a particular test suite with angular-cli.

Something like ng e2e auth instead of editing the angular-cli.json:

"e2e": {
    "protractor": {
      "config": "--suite auth config/protractor.conf.js"
    }
  }

Looks like it'd be pretty easy to pass the proper arguments to the e2e task

Activity

  1. added
    P5The team acknowledges the request but does not plan to address it, it remains open for discussion
    on Jun 4, 2016
  2. chompy18 commented on Nov 2, 2016

    @chompy18

    Hi,

    Any ideas when this will be implemented?
    I have multiple scenarios that should run different suites and this fits the bill perfectly!

    👍

  3. filipesilva commented on Nov 4, 2016

    @filipesilva
    Contributor

    I don't have an update on when this will be available, but if someone is interested in doing a PR I'll review it.

    As a workaround, right now you should be able to do npm run e2e -- --suite auth as well.

  4. hboylan commented on Nov 6, 2016

    @hboylan
    Author

    I'd really like to knock out this easy little feature (or any angular-cli development), but I'm having trouble with the typings in the angular-cli project.

    My recent fork appears to be missing something because I get a lot of errors like:

    • Cannot find module 'fs'
    • Cannot find name 'require'
    • Parameter 'file' implicitly has an 'any' type
  5. filipesilva commented on Nov 16, 2016

    @filipesilva
    Contributor

    @hboylan where do you get those errors? If it's in your editor, it might mean that it doesn't support Typescript 2.0. You should be able to ignore them though, it won't affect much.

  6. victornoel commented on Mar 2, 2017

    @victornoel

    @filipesilva the -- workaround to pass extra parameters to protractor doesn't seem to work anymore, I guess because we switched from using the package.json scripts to using directly protractor as a library…

    Any idea for another workaround or maybe introduce another way to pass extra parameters to protractors?

  7. filipesilva commented on Mar 2, 2017

    @filipesilva
    Contributor

    @victornoel there isn't a way to pass arbitrary parameters but as far as this issue is concerned now there is a way to pass suites:

    ng e2e --specs ./e2e/app.e2e-spec.ts --specs ./e2e/another.e2e-spec.ts
    
  8. victornoel commented on Mar 2, 2017

    @victornoel

    @filipesilva actually specs are not suites :) they are different concepts in protractor!
    A suite is a set of specs configured in the protractor configuration.
    So technically, this issue is not solved.

    Unfortunately for me, my need was to pass an exclude option to protractor, which isn't solved via specs nor suites (I should create another issue for this).

  9. filipesilva commented on Mar 2, 2017

    @filipesilva
    Contributor

    You're absolutely right, and I was confusing the two.

  10. filipesilva commented on Mar 2, 2017

    @filipesilva
    Contributor

    Can you tell me more about your usecase? Is it that you need to exclude specs/suites sometimes only?

  11. victornoel commented on Mar 2, 2017

    @victornoel

    @filipesilva here it is:

    • I have a frontend with angular, a backend with java and some other networked resources exploited by the backend.
    • my e2e tests are for the frontend and I run them with mocks to simulate the backend: in that case, all tests can be run as long as my mocks return what is expected.
    • I also want to run the e2e tests with the real backend deployed but without the networked resources (a limitation of our CI and processing resources too): in that case, some of these tests should be disabled, i.e. those pertaining to frontend functionality that relies on the existence of the other networked resources.

    I see two ways of solving this need:

    • (current way): in the tests that do need the external resources, I add a keyword in the name and exclude all files containing this keyword when I run the e2e tests with the real backend
    • I could define two suites, one for the e2e tests with backend (so without some of the tests) and one for the mocked frontend
  12. 6 remaining items

  13. jaredmartinez commented on Oct 3, 2017

    @jaredmartinez

    Any update on this? Using the protractor --suite flag would be helpful in our development

  14. nikoumba commented on Oct 14, 2017

    @nikoumba

    Another workaround:
    add to package.json :

    "scripts": {
    .....
    "ptor": "protractor"
    }
    

    define your suites in protractor.conf.js:

    suites: {
        registration: './e2e/app.registration.e2e-spec.ts',
        posting:'./e2e/app.new-post.e2e-spec.ts', './e2e/app.update-post.e2e-spec.ts' ....
         ....
      },
    

    run the desired suite with the double npm option:

    npm run ptor -- --suite=posting
    
  15. aniruddhadas9 commented on Nov 3, 2017

    @aniruddhadas9
    Contributor

    npm run e2e -- --suite auth --> this is not working for me. I am using angular cli 1.4.9 and have the below protractor config

      suites: {
        smoke: [
          './e2e/**/smoke/**/*.e2e-spec.ts'
        ],
        regression: [
          './e2e/**/*.e2e-spec.ts'
        ]
      },
      ...
    }```
    
  16. nikoumba commented on Nov 8, 2017

    @nikoumba

    @aniruddhadas9 you cannot use it with e2e. Add an extra protractor script command to package.json

    "scripts": {
    "ptor": "protractor"
    }
    

    and run it with npm run ptor -- --suite=smoke

  17. aniruddhadas9 commented on Nov 10, 2017

    @aniruddhadas9
    Contributor

    I wanted to run it using angular cli command like ng e2e --suite=smoke. But cli does not pass that flag to protractor. I have also created a pull request in cli to pass the parameter to the protractor pull request

  18. abeymg commented on Jan 30, 2018

    @abeymg

    Which version of the cli is this feature (#8354) going to be available in ?

  19. aniruddhadas9 commented on Jan 31, 2018

    @aniruddhadas9
    Contributor

    Its already available in 1.7.0-beta release you can try 1.7.0-beta.3

  20. removed
    P5The team acknowledges the request but does not plan to address it, it remains open for discussion
    on Feb 1, 2018
  21. clydin commented on Feb 1, 2018

    @clydin
    Member

    Closing as this will be available in 1.7.0.

  22. Maximus1285 commented on Feb 7, 2018

    @Maximus1285

    @filipesilva if I use ng e2e -- --suite auth how do I pass the parameter auth to protractor.conf.js

  23. angular-automatic-lock-bot commented on Sep 7, 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.

  24. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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