Skip to content

Target e2e suite #807

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

Closed
hboylan opened this issue May 18, 2016 · 25 comments
Closed

Target e2e suite #807

hboylan opened this issue May 18, 2016 · 25 comments
Assignees

Comments

@hboylan
Copy link

hboylan commented May 18, 2016

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

@filipesilva filipesilva added effort1: easy (hours) P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Jun 4, 2016
@chompy18
Copy link

chompy18 commented Nov 2, 2016

Hi,

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

👍

@filipesilva
Copy link
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.

@hboylan
Copy link
Author

hboylan commented Nov 6, 2016

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

@filipesilva
Copy link
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.

@victornoel
Copy link

@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?

@filipesilva
Copy link
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

@victornoel
Copy link

@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).

@filipesilva
Copy link
Contributor

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

@filipesilva filipesilva reopened this Mar 2, 2017
@filipesilva
Copy link
Contributor

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

@victornoel
Copy link

@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

@filipesilva
Copy link
Contributor

Ok I understand better. Have you considered adding a different protractor config for now?

ng e2e --config mock.protractor.conf.js
ng e2e --config real.protractor.conf.js

I agree that it's not a replacement for a suite flag, but we haven't gotten around to extend the protractor flags further.

@victornoel
Copy link

I did not think of that, I will see if I can do something with that for now :) Thanks!

Do you want me to open an issue for the exclude flag @filipesilva?

@filipesilva
Copy link
Contributor

Yes please!

@johnRambo2k14
Copy link

Ditto! I want this!

@filipesilva filipesilva self-assigned this May 22, 2017
@LouieCasiasJr
Copy link

This would be great - I may be misreading, but it looks like there was already an update for this, marked as superseded though, but I don't think it actually was.

#3551

@jaredmartinez
Copy link

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

@SpiralOutDotEu
Copy link

SpiralOutDotEu commented Oct 14, 2017

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

@aniruddhadas9
Copy link
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'
    ]
  },
  ...
}```

@SpiralOutDotEu
Copy link

SpiralOutDotEu commented Nov 8, 2017

@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

@aniruddhadas9
Copy link
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

@abeymg
Copy link

abeymg commented Jan 30, 2018

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

@aniruddhadas9
Copy link
Contributor

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

@clydin clydin removed effort1: easy (hours) P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Feb 1, 2018
@clydin
Copy link
Member

clydin commented Feb 1, 2018

Closing as this will be available in 1.7.0.

@clydin clydin closed this as completed Feb 1, 2018
@Maximus1285
Copy link

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

vikerman pushed a commit to vikerman/angular-cli that referenced this issue Oct 6, 2018
resolves: 807
Override suite in the protractor config.
Can send in multiple suite by comma seperated values (ng e2e --suite=suite1.ts, suite2.ts).

Issue link
 github.com/angular/issues/807
 github.com/angular/pull/3551
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
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