How to run Protractor in Bamboo CI - javascript

I am trying to run my protractor test case in Bamboo CI but it throws an installation error.
I am able to install node modules using npm task but somehow I am not able to install and run protractor in my bamboo plan. Is there a different way of doing it or I am doing something wrong.
Please find attach the snapshot from my bamboo plan :
Npm install
Protractor Task
And my error log is as follow
/tmp/RDMPDEV-MAP-JOB1-91-ScriptBuildTask-6009702493071779000.sh: line 1: protractor: command not found
Please advice

You did not mention commands for protractor and web-driver installation. Do following:
Write below commands into Command* text filed under npm configurations section. Either put all commands separate by a comma or add one more configuration section if you could see any such option. or check in advanced options
Commands:
install -g protractor
webdriver-manager update
Write 'webdriver-manger start' as first line in script body and then write 'protractor conf.js'
You should mention all test spec in conf.js file and run conf.js file from script body.
Script body looks like:
1. webdriver-manager start
2. protractor conf.js

You can also trigger protractor tests in bamboo via angular cli command e2e.
Definition of e2e in package.json
"e2e": "ng e2e --no-serve --base-href"
Please refer below screenshot showing this configuration in bamboo.
Remember to add commandline parameter to e2e command in bamboo as required like --base-href

Related

why "meteor npm install" is not working on gitpod workspace?

I am new to gitpod.io, I am trying to open a meteor project on gitpod.io and when I type "meteor npm install", it's showing "bash: meteor: command not found", however, if I try "npm install" it's working fine.
Please help me with the issue.
The reason is that meteor is not installed in the default workspace Docker image.
You can run curl https://install.meteor.com/ | sh in your workspace. You'll get a message like this:
Meteor 1.10.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
Couldn't write the launcher script. Please either:
(1) Run the following as root:
cp "/home/gitpod/.meteor/packages/meteor-tool/1.10.2/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
(2) Add "$HOME/.meteor" to your path, or
(3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
Since you don't have root rights, a script in /usr/local/bin/ cannot installed by this way. However, you can still use meteor like this:
$ ~/.meteor/meteor
An alternative would be to add your own Dockerfile as described in the docs: https://www.gitpod.io/docs/config-docker/
By this, you can install meteor with root rights.

Not able to run conf.js with Protractor Azure Pipeline

This is my YAML and I'm able to install npm, update and start the webdriver-manager, but I don't know how to run my conf.js file
This is my YAML:
[https://i.stack.imgur.com/9whzK.png][1]
And this is the run:
[https://i.stack.imgur.com/BsIbQ.png][2]
I'm new in Azure DevOps so please just guide me through how I'm supposed to run the test and the dependencies that I'm using on my script because It runs without a problem locally.
Not able to run conf.js with Protractor Azure Pipeline
To run the test with Protractor, you can use the command line task with node tool to run the test, like:
- task: CmdLine#1
displayName: 'Run node'
inputs:
filename: node
arguments: '$(System.DefaultWorkingDirectory)\Conf\Protractor.conf.js'
enabled: false
There is a great document about how to use Protractor End to End Tests Configure on CI/CD TFS/VSTS (Azure Devops) Publish HTML Results, you can check it for some more details.
For the dependencies, you could use Yarn or Azure Artifacts/TFS to download packages from the public npm registry, which is a type of private npm registry that you specify in the .npmrc file:
Check the document Dependency management for some more details.
Hope this helps.

Jest: `npm test` not displaying "Watch Usage" options in Windows Git Bash

I am new to React and attempting to use npm test.
From the docs, it is my understanding that every time npm test runs, it starts the watcher. The watcher is supposed to display a list of commands titled "Watch Usage". This includes commands such as a, f and q.
When I run npm test, watcher appears to work because it runs the tests and reruns them if I save a file.
However, it does not display the "Watch Usage" list and if I type any of the "Watch Usage" commands, nothing happens.
How can I enable the "Watch Usage" commands?
I was attempting to run this command in Git Bash. I have not found a solution to make it work in Git Bash.
However, you can instead run the command in cmd.exe and it will work properly.
The Jest VSCode extension can also be helpful.
There is a problem with running Jest inside Git Bash on Windows. The terminal codes for updating the screen are not correctly handled, and I've been unable to find a reason or fix for this searching Google.
If you run npm test from a DOS prompt, then it seems to work fine, but if you run npm test from a Git Bash prompt the progress feedback from Jest is missing.
You can enable colors by running npm run test -- --colors which gets Jest to output the color status for tests in Git Bash, but strangely the colors are working but the progress is still not shown.
The only successful work around that I've found is running Jest from inside winpty if you're using Git Bash.
winpty npm.cmd test
So what I do is add an alternative npm script to my package.json file for running on Git Bash inside Windows.
"wintest": "winpty npm.cmd run test",
Then you can just run that instead.
npm run wintest
It's not a perfect solution, but at least you can see the progress correctly.
You can activate watch mode, modify your package.json:
"scripts": {
"test": "jest --watch",
}
run npm test

After npm reads package.json, what runs Electron?

I'm just starting to learn about how JavaScript, HTML, and Electron all work, and I want to know what runs electron . in the "scripts" -> "start" of package.json, because I can't tell what does and that kind of wizardry makes me nervous.
According to the man pages for npm, what npm start does is that it reads the package.json, looks at the script under "scripts" -> "start" -> some_script, and then runs some_script. Sometimes, some_script is something like node foobar.js, which makes sense to me, since I can run that from the command line. NodeJS is executing foobar.js. However, in the case of the electron-api-demos, some_script is electron .
You can download and run electron-api-demos via
git clone https://github.com/electron/electron-api-demos
cd electron-api-demos/
npm install && npm start
In order to try to figure out what is running electron ., I've run it in the node shell, and I've tried running node main.js. I've even tried opening up the node shell and running
electron-api-demos#2.0.2 start $DIR/electron-api-demos
electron .
(which is exactly the output of npm start). None of them worked, because none of them started up the Electron application. At this point I'm very puzzled at how, exactly, the start script gets executed at all.
So I guess my question is: does there exist a command (that I can use on the command line) to start up this Electron application, without using npm? If not, what is npm calling to start up this Electron app?
I apologize if this question has been asked before, but I all the sources I found didn't seem to go into any further detail about what, exactly, is done when npm start is run and how it executes electron . . Thank you for your time!
Command line interfaces installed with npm are put in the node_modules/.bin/ directory. You can't just run them from the command line because that directory isn't in your PATH (unless you put it there, or you installed it globally).
So, if you want to run electron without npm start, you can run ./node_modules/.bin/electron .. Since this is a bit verbose, newer versions of npm provide the command npx to run things without the ./node_modules/.bin/ part, so npx electron . also works.
Since npm scripts often use the packages you've installed, they automatically add node_modules/.bin/ to the PATH before running your command. As a result, the start script can just reference electron directly.
npx can do some other cool things too – npm has a blog post about it.
When you run npm start , it by default run command corresponding "start" key of script property of package.json like
"script":{
"start": "ng serve",
"launch":"electron main.js" or "electron ." // main.js located in the same dir
"test": " ng test"
}
same when you run npm run launch it will trigger the command corresponding of the "launch" key of script property of package.json file. like run electron main.js command and your application will launched.
so if you want to run the your electron application directly like electron main.js then install the electron module globally using command npm install electron -g then simply run the electron main.js command and your application will start.

Trouble with installing Selenium(ChromeDriver, Javascript) on Windows 7

I'm having trouble installing Selenium and I'm completely lost
I followed this documentation by the letter and looked around the site and the web for a while now and came to a dead end. Like I said in the title I'm using Chrome and Javascript for this.
[Documentation]http://selenium.googlecode.com/git/docs/api/javascript/index.html
So true with the documentation, the first thing I did was installing the "selenium-webdriver" which I opened up cmd and typed "npm install selenium-webdriver". It responded with saying what directory it installed and the version it installed which was 2.42.1.
After this I installed the ChromeDriver 2.10 from their home download page. After this I unziped the file and moved chromedriver.exe to "node_modules\selenium-webdriver\ChromeDriver" and added it to my systems environmental variables.
So then the next step was to test it, so I copy pasted "npm test selenium-webdriver" into the cmd and got this following error. [Error]http://imgur.com/xIYE3oa I also tried running ChromeDriver after I kept running into this error and tried it again to get the same result. It doesn't tell me anything other then...
Starting ChromeDriver on port 9515
Only local connections are allowed.
Thank you in advance.
First, make sure that you have Mocha installed by running npm install mocha.
You will then want to edit the "scripts" section of the package.json file for selenium-webdriver to match the following:
"scripts": {
"test": "mocha -R list --recursive test"
},
After completing those two steps, you should be able to run your tests with the npm test selenium-webdriver command.

Categories