Giter VIP home page Giter VIP logo

Comments (7)

sivaram-vu avatar sivaram-vu commented on June 21, 2024

I have the same issue. Could you please suggest.

from protractor-flake.

NickTomlin avatar NickTomlin commented on June 21, 2024

Could I get either of you to create a small repository that reproduces the issue? I personally don't use angular-cli so that would make the problem/use case easier to understand.

Thanks!

from protractor-flake.

sivaram-vu avatar sivaram-vu commented on June 21, 2024

Hi Nick,

To run the e2e tests as part of the build, We need to configure it in angular.json file.

Below is a sample build configuration to launch protractor.

"testapp-e2e": { "root": "e2e/testapp", "sourceRoot": "e2e/testapp", "projectType": "application", "architect": { "e2e": { "builder": "**@angular-devkit/build-angular:protractor**", "options": { "protractorConfig": "**./protractor.conf.js**", "devServerTarget": "testapp:serve" } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "e2e/tsconfig.e2e.json" ], "exclude": [ "**/node_modules/**" ] } } } },

As per the above code, There is a builder for protractor which takes protractor conf file as input.
Could you please create a custom builder to launch protractor-flake as part of the build process.

Thanks

from protractor-flake.

NickTomlin avatar NickTomlin commented on June 21, 2024

Unfortunately I still don't understand the use case and I don't have time right now to create a custom builder. I'd welcome a pull request for one though since it sounds like it would be helpful for others in the community. Thanks!

from protractor-flake.

rglynn-dev avatar rglynn-dev commented on June 21, 2024

@sivaram-vu

"[11:03:12] E/configParser - Error code: 105
[11:03:13] E/configParser - Error message: failed loading configuration file C:\Users\ilia.danilov\WebStormProjects\dashboard_frontend\protractor-flake --parser standard --max-attempts=3 -- .\protractor.conf.js
[11:03:13] E/configParser - Error: Cannot find module 'C:\Users\ilia.danilov\WebStormProjects\dashboard_frontend\protractor-flake --parser standard --max-attempts=3 -- .\protractor.conf.js'"

Is your protractor.conf.js really in dashboard_frontend\protractor.conf.js? By default it should be in dashboard_frontend\e2e\protractor.conf.js. If that is the case you want:
protractor-flake --parser standard --max-attempts=3 -- e2e\protractor.conf.js
Just a small thought on that.

As far as getting the build configuration to work with Angular, I too have been searching of a way to achieve this. Having found nothing online about this I have opted to bypass Angular since this is mainly protractor's domain anyway.

Note: this is something of a workaround, I am surprised that Angular/Protractor do not provide some simple way of doing this.

My solution is to run an npm script that uses protractor-flake to run the e2e test suite. Because of the way I have my deployment pipeline setup I cannot simply run protractor-flake, I must first use ng serve (or similar e.g. build -> http-server), because I want to test on localhost. The issue is ng serve && protractor-flake <args> will not work because ng serve does not complete and will block the second command. To get around this I can daemonise (run in the background) ng serve. I used foreverjs to do this (other packages could be used).

My current working script (in package.json "scripts") is as follows:
"e2e-retry": "forever start node_modules/@angular/cli/bin/ng serve && webdriver-manager update && protractor-flake --parser standard --max-attempts=3 -- e2e/protractor.conf.js && forever stopall"
This can be run using npm run e2e-retry.

You may run into a scenario where your tests fail because ng serve takes a while to build, this can be solved by using the onPrepare() method in protractor.conf.js, similarly to how you might deal with a login page (see protractor docs)

from protractor-flake.

Helen109 avatar Helen109 commented on June 21, 2024

@sivaram-vu

"[11:03:12] E/configParser - Error code: 105
[11:03:13] E/configParser - Error message: failed loading configuration file C:\Users\ilia.danilov\WebStormProjects\dashboard_frontend\protractor-flake --parser standard --max-attempts=3 -- .\protractor.conf.js
[11:03:13] E/configParser - Error: Cannot find module 'C:\Users\ilia.danilov\WebStormProjects\dashboard_frontend\protractor-flake --parser standard --max-attempts=3 -- .\protractor.conf.js'"

Is your protractor.conf.js really in dashboard_frontend\protractor.conf.js? By default it should be in dashboard_frontend\e2e\protractor.conf.js. If that is the case you want:
protractor-flake --parser standard --max-attempts=3 -- e2e\protractor.conf.js
Just a small thought on that.

As far as getting the build configuration to work with Angular, I too have been searching of a way to achieve this. Having found nothing online about this I have opted to bypass Angular since this is mainly protractor's domain anyway.

Note: this is something of a workaround, I am surprised that Angular/Protractor do not provide some simple way of doing this.

My solution is to run an npm script that uses protractor-flake to run the e2e test suite. Because of the way I have my deployment pipeline setup I cannot simply run protractor-flake, I must first use ng serve (or similar e.g. build -> http-server), because I want to test on localhost. The issue is ng serve && protractor-flake <args> will not work because ng serve does not complete and will block the second command. To get around this I can daemonise (run in the background) ng serve. I used foreverjs to do this (other packages could be used).

My current working script (in package.json "scripts") is as follows:
"e2e-retry": "forever start node_modules/@angular/cli/bin/ng serve && webdriver-manager update && protractor-flake --parser standard --max-attempts=3 -- e2e/protractor.conf.js && forever stopall"
This can be run using npm run e2e-retry.

You may run into a scenario where your tests fail because ng serve takes a while to build, this can be solved by using the onPrepare() method in protractor.conf.js, similarly to how you might deal with a login page (see protractor docs)

I use your command "forever start node_modules/@angular/cli/bin/ng serve && webdriver-manager update && protractor-flake --parser standard --max-attempts=3 -- e2e/protractor.conf.js && forever stopall" ro run test.But always hit error "This site can't be reached"when open localhost. Do you have any suggestion?

from protractor-flake.

rglynn-dev avatar rglynn-dev commented on June 21, 2024

@Helen109

I can't say I have had this problem myself. Would be good to see your console output when this is happening, is everything working successfully? It may be that ng serve is failing but because it is being run by forever you can't see the error being thrown. You might want to check that you can just get your app to be served from a forever process before also attempting to test. i.e. just check that forever start node_modules/@angular/cli/bin/ng serve works and you can access localhost.

from protractor-flake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.