Not able to run conf.js with Protractor Azure Pipeline - javascript

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.

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.

npm run build cannot access in localhost

I want to test my react/ node.js web app with a production build. I already run npm run build at the app directory and created build folder.
I was unable to run the application using localhost:8080 (server port).
Are there any ways to double check if the application is actually running in that port or access production-ready application?
PS. I used serve to host the application but it posts error 404: The requested path could not be found
Thank you for your help.
Every SPA application has its own package.json file. Inside you have to see the script section:
Normally after you run nm run build you have a compiled version of your code.
At this point, you have a see the dist folder.
After this, you can either run npm run start and you have to see
(this option is not suitable for SSR frameworks like NUXT or NEXT)
or if you don't have that option install an npm package that renders your compiled code by doing the following:
npm install -g serve
serve -s build
and you have to see

How to run Protractor in Bamboo CI

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

Install node.js on AWS OpsWorks php app server

I have set up a PHP App Server Layer in my AWS OpsWorks stack which works fine. Now I need to have it install node.js as well in order to compile and minify stylus and coffeescript, run browserify and also compress pngs, all through Grunt on each deploy.
The steps/requirements are:
Install node.js
Install grunt-cli globally
Run npm install
Set write permissions for node on public/assets/
Run grunt deploy "install" hook preconfigured in package.json
Ideally uninstall node, npm and all node modules as they are no longer needed
I have tried setting the official cookbook as custom chef repo and including all the recipes from the node.js app server default recipes, but they fail as the app is not a node.js app.
Does anyone have any experience with this?

How to I configure TeamCity build with Mocha?

I have a project that I am setting up through teamcity for CI.
The project itself is a nodejs application and it includes test written in mocha, which we cover through jscoverage. In the build configuration I'm setting up I have 3 build steps
which occur on checkin.
call jscoverage.exe against the folders in my project that I'm
covering.
call mocha to run the test against the jscovered files from step 1
and output to the html-cov reporter
move the generated coverage.html report into a public web directory
to browse later.
The build currently fails on step 2:
mocha" is not present in directory C:\NodeJS\MeasuresAPI
I've made sure to include mocha and all my node packages in the system environment paths and I am able to access them in the command prompt, but TeamCity doesnt appear to see them.
for the jscoverage.exe, I had to include the full path. With mocha, I tried including the path to my node global installation where mocha installed to but it gives me an error:
"..\node_modules\mocha\bin\mocha" (in directory "C:\NodeJS\MeasuresAPI"): CreateProcess error=193, %1 is not a valid Win32 application
Anyone had any experience with Teamcity and Mocha and how to get them to play nice?
or any ideas for continuous integration with a nodejs, mocha stack?
Yes , this happened to me too, when I was setting up TeamCity to run mocha on Windows Server. The solution was to call mocha by specifying path to the mocha.cmd bat file. For example , if you have folder C:\mocha and you have executed
npm install mocha
in that directory , than path to the bat file will be
C:\mocha\node_modules.bin\mocha.cmd
And you can tell Teamcity to execute mocha command by giving it next instruction :
C:\mocha\node_modules.bin\mocha --ui tdd --reporter html-cov test\measureDBTests.js > coverage.html

Categories