feat(dev): add Cypress and Puppeteer to GitPod (#40862)
This commit is contained in:
101
.gitpod.yml
101
.gitpod.yml
@ -1,60 +1,61 @@
|
|||||||
image: gitpod/workspace-mongodb
|
image: gitpod/workspace-mongodb
|
||||||
ports:
|
ports:
|
||||||
- port: 27017 # mongodb
|
- port: 27017 # mongodb
|
||||||
onOpen: ignore
|
onOpen: ignore
|
||||||
- port: 8000 # client
|
- port: 8000 # client
|
||||||
onOpen: open-preview
|
onOpen: open-preview
|
||||||
- port: 9228 # node debug
|
- port: 9228 # node debug
|
||||||
onOpen: ignore
|
onOpen: ignore
|
||||||
- port: 3000 # api
|
- port: 3000 # api
|
||||||
onOpen: ignore
|
onOpen: ignore
|
||||||
- port: 9229 # node debug
|
- port: 9229 # node debug
|
||||||
onOpen: ignore
|
onOpen: ignore
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- before: |
|
- before: |
|
||||||
echo '
|
echo '
|
||||||
export COOKIE_DOMAIN=gitpod.io
|
export COOKIE_DOMAIN=gitpod.io
|
||||||
export HOME_LOCATION=$(gp url 8000)
|
export HOME_LOCATION=$(gp url 8000)
|
||||||
export API_LOCATION=$(gp url 3000)
|
export API_LOCATION=$(gp url 3000)
|
||||||
' >> ~/.bashrc;
|
export CYPRESS_BASE_URL=$(gp url 8000)
|
||||||
exit;
|
' >> ~/.bashrc;
|
||||||
|
exit;
|
||||||
|
|
||||||
- name: db
|
- name: db
|
||||||
# starting mongo in background, so it doesn't block prebuilds
|
# starting mongo in background, so it doesn't block prebuilds
|
||||||
before: >
|
before: >
|
||||||
mkdir -p /workspace/data &&
|
mkdir -p /workspace/data &&
|
||||||
(mongod --dbpath /workspace/data &)
|
(mongod --dbpath /workspace/data &)
|
||||||
|
|
||||||
- name: server
|
- 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,
|
# init is not executed for prebuilt workspaces and restarts,
|
||||||
# so we should put all the heavy initialization here
|
# so we should put all the heavy initialization here
|
||||||
init: >
|
init: >
|
||||||
cp sample.env .env &&
|
cp sample.env .env &&
|
||||||
npm ci &&
|
npm ci &&
|
||||||
gp sync-done npm-ci &&
|
gp sync-done npm-ci &&
|
||||||
gp await-port 27017 &&
|
gp await-port 27017 &&
|
||||||
npm run seed &&
|
npm run seed &&
|
||||||
mongo --eval "db.fsyncLock(); db.fsyncUnlock()"
|
mongo --eval "db.fsyncLock(); db.fsyncUnlock()"
|
||||||
command: >
|
command: >
|
||||||
npm run ensure-env &&
|
npm run ensure-env &&
|
||||||
gp await-port 27017 &&
|
gp await-port 27017 &&
|
||||||
npm run develop:server
|
npm run develop:server
|
||||||
|
|
||||||
- name: client
|
- 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: >
|
init: >
|
||||||
cd ./client &&
|
cd ./client &&
|
||||||
gp sync-await npm-ci &&
|
gp sync-await npm-ci &&
|
||||||
npm run prebuild &&
|
npm run prebuild &&
|
||||||
npm run build:workers &&
|
npm run build:workers &&
|
||||||
cd ..
|
cd ..
|
||||||
command: >
|
command: >
|
||||||
gp await-port 3000 &&
|
gp await-port 3000 &&
|
||||||
cd ./client &&
|
cd ./client &&
|
||||||
npm run develop -- -H '0.0.0.0'
|
npm run develop -- -H '0.0.0.0'
|
||||||
openMode: split-right
|
openMode: split-right
|
||||||
|
|
||||||
github:
|
github:
|
||||||
prebuilds:
|
prebuilds:
|
||||||
|
53
cypress-install.sh
Normal file
53
cypress-install.sh
Normal 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
|
@ -19,6 +19,7 @@
|
|||||||
"precypress": "node ./cypress-install.js",
|
"precypress": "node ./cypress-install.js",
|
||||||
"cypress": "cypress",
|
"cypress": "cypress",
|
||||||
"cypress:install": "cypress install && echo 'for use with ./cypress-install.js'",
|
"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:run": "npm run cypress -- run",
|
||||||
"cypress:dev:watch": "npm run cypress -- open",
|
"cypress:dev:watch": "npm run cypress -- open",
|
||||||
"cypress:prd:run": "npm run cypress -- run",
|
"cypress:prd:run": "npm run cypress -- run",
|
||||||
|
Reference in New Issue
Block a user