How to run protractor using browserify? - angularjs

Can anyone tell me how to run protractor using browserify? I have prepared bundle.js file. But I don't know how to execute command 'protractor protractor-config.js' in browser console. It is undefined in browser console.

As far as I know, you aren't going to be able to do this. Protractor is a Node.js application, to say nothing of its requirement for Selenium. It uses Node to execute, not the browser.

Related

AngularJS -Karma testing Jasmine- describe is not defined

Just trying to start Angular Testing with Karma. I did install and create my karma.config. On CMD when I start my karma, it runs without any problems and opens both of my browsers (Chrome Canary and Firefox)
However it doesn't show Tests on browser. And I don't get any error from karma or anything written on my console.
My File structure and file part of karma.conf.js:
And in my .spec.js file when I write a basic test just to see if it is running properly, in WebStorm it gets underlined. Here is a screenshot for this:
None of the other similar topics on StackOverflow helped me. I am stuck with this error.
What can be the reason for that?
It looks and sounds like WebStorm is trying to run your tests in a Node.js environment as opposed to a Karma environment.
Try making a Karma run configuration for your karma.conf.js file.
More details about making a run configuration can be found here: https://www.jetbrains.com/help/webstorm/2016.3/running-unit-tests-on-karma.html#runConfigurationKarma

Protractor Chrome angular could not be found on the page

I have had E2E tests set up to run in Chrome for a while, however they no longer work. I'm not sure when they stopped working as they've been neglected. The project uses grunt-protractor-runner (2.1.2) which uses protractor 2.5.1
I get the following error:
Uncaught exception: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
Below is screenshot of the output:
It actually opens up Chrome , however doesn't navigate anywhere. The omnibox says "data:," and nothing else:
One thing I'm wondering, is that chrome got somewhat locked down - and the omni box doesn't work as a google browser now - but I don't see why that would affect it as it should hit a URL directly.
Can anyone advise please?
Typically this error happens in one of two ways:
There is a race condition where protractor wants to start the tests before the page is fully loaded. In this case, make sure that your onPrepare function in your protractor conf returns a promise that gets resolved once all preparations work.
The test does not navigate to the app's url. In this case, make sure that you run `browser.get();
There is an error trying to start your app. This one's a little harder to fix. You can try running the protractor element explorer and see if there's an error in the browser console.
Ive seen this problem a few times myself. The last time I fixed it was by updating to the latest version of chrome driver and the latest version of protractor. Certain earlier combinations of chrome driver and protractor can cause this problem.
Grunt protractor runner can be used with latest versions of protractor according to its documentation. I suggest having a little read of how to update to the latest versions?

Elementor. How to make it use protractor.conf?

I started adding e2e tests into our project and it seems a few things changed since the last time I used Protractor. For example elementExplorer still useful, but Elementor is way more cooler.
In its the readme is says to launch it by running e.g.: webmanager start and then elementor http://localhost:3000.
But this way it ignores protractor.conf. And since I have a binary path for Chrome browser in that file, along with a logic for clearing cookies and logging into the app in onPrepare function, protractor has to know where the file is. But I can't find a way.
Starting protractor as usual via protractor protractor.conf.coffee and then elementor localhost:3000 not working either. It says "Unable to start a WebDriver session"
Yes, you should launch it by running webdriver-manager start, I use this to run the scripts: protractor script_file_conf.js since I save my scripts as javascript code in my repository. Remember that the conf file should have a reference to the script file.

What is the use of node.js in protractor?

I'm very new to AngularJS. I am trying to automate an angularJS app.
installed node.js
installed protractor (npm install -g protractor)
updated webdriver manager tool (webdriver-manager update)
started the driver (webdriver-manager start)
I create a simple conf.js and spec.js files. Everything works fine and set to go.
when we execute spec.js, protractor talk to selenium webdriver which then launches the browser and does the other stuff like interacting with angularJS app. Am I correct?
So, what is the role of node.js here in protractor?
I might be wrong, if so please do correct me and explain how protractor works.
Thanks in advance :)
Node.js is an open source runtime environment to develop applications in JavaScript.
WebDriverJS has been written in Node.js and Protractor has been written on top of WebDriverJS.
Node.js will be executing the javascript code you've written in your spec and po files with its JavaScript Engine (Google V8), or as you've so colourfully described: "does the other stuff like interacting with angularJS app".
Read more here and here
Protractor is a Node.js application... hence the Node requirement. Protractor is written in Javascript, so it requires a Javascript engine, which Node provides (Google V8), thus allowing it to run on a server.
Node.js is package file we are using in protractor automation tool to run the angular.js based application.It contains selenium and other browser drivers to run our applications in different environments.

Bamboo with selenium webdriver

Tools: Java, Selenium WebDriver, Maven, Git, Bamboo
I'm not sure how I can run my test-cases under Bamboo which are written by java and build by maven and stored into Git repository. Bamboo can't open a real browser (IE, Firefox, chrome..)
It's worked when I tried to use HTMLUnitdriver (headless browser) instead of a real browser, BUT the problem with HTMLUnitdriver it is not functioning well (actually, it can't run most of the test scenarios even the other browsers do flawlessly).
I've Google it but could not found any good information on how to do it.
I'll really appreciate any help.
You should not run any test on Bamboo server. CI server is not meant to run any tests on. It should only controls how the tests will be executed instead. There are multiple ways to handle this. Selenium Grid is highly recommended. See another thread here on same topic
Use BrowserStack to execute test scripts and download reports/results as part of build as an artefact.
Or specify an agent that has the browser you need to test on.
https://www.browserstack.com/automate

Resources