feat(dev): add Cypress and Puppeteer to GitPod (#40862)

This commit is contained in:
Shaun Hamilton
2021-02-05 05:44:02 +00:00
committed by GitHub
parent 98de8fe54c
commit 850a1a2271
3 changed files with 105 additions and 50 deletions

View File

@ -17,6 +17,7 @@ tasks:
export COOKIE_DOMAIN=gitpod.io
export HOME_LOCATION=$(gp url 8000)
export API_LOCATION=$(gp url 3000)
export CYPRESS_BASE_URL=$(gp url 8000)
' >> ~/.bashrc;
exit;
@ -27,7 +28,7 @@ tasks:
(mongod --dbpath /workspace/data &)
- name: server
before: export COOKIE_DOMAIN=gitpod.io && export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000)
before: export COOKIE_DOMAIN=gitpod.io && export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) && export CYPRESS_BASE_URL=$(gp url 8000)
# init is not executed for prebuilt workspaces and restarts,
# so we should put all the heavy initialization here
init: >
@ -43,7 +44,7 @@ tasks:
npm run develop:server
- name: client
before: export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000)
before: export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) && export CYPRESS_BASE_URL=$(gp url 8000)
init: >
cd ./client &&
gp sync-await npm-ci &&

53
cypress-install.sh Normal file
View File

@ -0,0 +1,53 @@
InstallCypress() {
sudo apt-get update && sudo apt-get install -y \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb
}
InstallPuppeteer() {
sudo apt-get install -y \
ca-certificates \
fonts-liberation \
libappindicator3-1 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
lsb-release \
wget \
xdg-utils
}
InstallCypress
InstallPuppeteer

View File

@ -19,6 +19,7 @@
"precypress": "node ./cypress-install.js",
"cypress": "cypress",
"cypress:install": "cypress install && echo 'for use with ./cypress-install.js'",
"cypress:install-build-tools": "sh ./cypress-install.sh",
"cypress:dev:run": "npm run cypress -- run",
"cypress:dev:watch": "npm run cypress -- open",
"cypress:prd:run": "npm run cypress -- run",