I'm running some playwright tests in a pipeline but I'm having problems trying to fail the build when a test fails.
In my pipeline I call a make file that calls a shell script that installs playwright, does some setup, and then runs the command yarn playwright test the script I call always returns an exit code 0 but Playwright returns an exit code 1 if a test fails.
Is it possible for me to get the exit code of Playwright so I can then pass it back up and handle it in my pipeline?
Update:
The line in my makefile that calls the sh script is:
uiTests: node-install node-audit
$(DOCKER_RUN_NODE) bash /app/scripts/playwright.sh
My Playwright.sh script:
#!/usr/bin/env bash
apt-get update
apt-get install -y gnupg2 gnupg1 wget
docker pull mcr.microsoft.com/playwright/python:v1.27.0-focal
yarn install
yarn playwright install
yarn playwright install-deps
yarn run local & yarn run uiTests
rm -rf node_modules
This pulls the dependencies then starts the local instance of the site and runs the tests
yarn run uiTests runs this command "BASE_URL='http://localhost:3000' yarn playwright test"
Related
I have a project with serenity and selenium where the chromedriver inside of the java's project folder, so only when I run for the first time it I have to run the command: "chmod +x chromedriver" inside of that folder, then for the rest of the executions it's not necessary to run the command again
For jenkins I recently install it, by according to this https://www.jenkins.io/download/lts/macos/, running "brew install jenkins-lts" and I created a pipeline job, but when I run it, I suppose that jenkins it's pulling the project from github to his local workspace but when it's time to run the test, it gave this message:
"The driver is not executable: /src/test/resources/driver/chromedriver"
So how can I run the chmod command if for each project that i have the chromedriver is inside of his folder respectivally
I have a local gitlab ce server and gitlab-ci runner, all running on docker container. And I just want to test out if the gitlab-ci is working with minimal code in .gitlab-ci.yml; However, it ended up with the ci does not run at all, and git version wasn't posting as well, and showing error codes
Running with gitlab-runner 14.2.0 (58ba2b95)
on GitLab-cicd-practice GPdsWyY7
Preparing the "shell" executor 00:00
Using Shell executor...
Preparing environment 00:00
Running on gitlab...
Getting source from Git repository 00:01
Fetching changes...
bash: line 113: git: command not found
ERROR: Job failed: exit status 1
Code for .gitlab-ci.yml
build:
stage: build
before_script:
- git --version
script: echo hello
test:
script: echo
stage: test
needs: [build]
Looking at this, the runner is running using shell, therefore the problem is that git is not installed on the machine that's running the gitlab-runner.
To fix this just install git on the machine so that the gitlab-runner can use it.
If you're on linux you should be able to install it with apt or yum
apt install git
or
yum install git
My CI file currently has two installation commands that run sequentially. However, as the former does not require the latter to be able to execute, I would like to run these commands at the same time. How do I run these commands in parallel without parallelizing my entire build pipeline?
install:
- docker pull <image>
- npm install
You can simply use bash syntax;
install: docker pull <image> & npm install
I'm setting up an automator run shell script to go to a specific folder on users machines and then yarn run dev but when it gets to the yarn part it can't find yarn.
-line 1: yarn: command not found
If I use terminal then yarn will run fine.
I have yarn installed -g which is in my NVM modules.
Here is my script in automator.
cd ~/Documents/myProject
yarn run dev
Also tired this setup:
Like this:
export PATH=$PATH:/Users/me/.nvm/versions/node/v10.16.3/bin
cd ~/Documents/myProject
yarn run dev
The first line tells bash where to look for programs, such as yarn and node.
I have Meteor project and I want to run my tests with Chimp at Codeship.
I have a problem that Meteor project must be started before running Chimp. After starting Meteor, it blocks terminal showing that server si ready at localhost:3000
Usually at localhost I just run (and wait to start) Meteor. Then in another bash tab I run chimp.
At Codeship bash I cannot do such a thing. I tried some linux commands sleep, &, nohup but I cannot put it together.
Setup commands
# Install node
nvm install 4.0
nvm install 0.10
node -v
# Install chimp
npm install -g chimp
# Install meteor
curl -o meteor_install_script.sh https://install.meteor.com/
chmod +x meteor_install_script.sh
sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g" meteor_install_script.sh
./meteor_install_script.sh
export PATH=$PATH:~/.meteor/
meteor --version
Test commands
nohup bash -c "meteor --settings=settingsRemote.json 2>&1 &" && sleep 3m; cat nohup.out
chimp --ddp=http://localhost:3000 --mocha --browser=firefox --path=tests
With above settings I got this output on meteor command. Chimp is never run.
[[[[[ ~/src/bitbucket.org/jirikrepl/nedatluj-meteor ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
------------------------------------------------------------------------------
This command didn't output anything for 10 minutes, thus we stopped it.
Please make sure your steps regularly print to standard out or standard error.
If the error is on our end please inform us so we can help you to fix this.
------------------------------------------------------------------------------
Ok here is the solution. I edited code above, so it now works.