Я хочу протестировать скрипт внутри действия github. локально, это дает мне точный результат, но в действии github я получаю, что длина должна быть 2, хотя длина должна быть 1, поскольку я запускаю db внутри действия github!
вот мой тестовый пример
it("should check the length of list", async () => {
// await page.goto("http://localhost:1234", { waitUntil: "networkidle2" });
const todoTask = await page.evaluate(() => {
return document.querySelector(".MuiTypography-displayBlock").innerText;
});
// console.log({ todoTask });
// const lenghtofList = await page.evaluate(() => {
// return document.querySelectorAll(".MuiTypography-displayBlock").length;
// });
const divsCounts = await page.$$eval('.MuiTypography-displayBlock', divs => divs.length);
expect(divsCounts).to.eq(1);
});
и вот мой action.yml
файл
name: Github Actions Test
# TODO:
# 4. build for Prod (master)
on:
push:
branches:
- fix/final # TODO: change later to `develop`
# env: # workflow scoped
# ## Secrets
# # Environment
# # The syntax `INPUT_ENVKEY_xxx` is needed for SpicyPizza/create-envfile@v1 action
# INPUT_ENVKEY_NODE_ENV: ${{ secrets.NODE_ENV }}
# # Admin
# INPUT_ENVKEY_PRISMA_ENDPOINT: ${{ secrets.PRISMA_ENDPOINT }}
# INPUT_ENVKEY_PRISMA_SECRET: ${{ secrets.PRISMA_SECRET }}
# # Backend
# INPUT_ENVKEY_PORT: ${{ secrets.PORT }}
# INPUT_ENVKEY_DASHBOARD_PORT: ${{ secrets.DASHBOARD_PORT }}
# INPUT_ENVKEY_FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
# INPUT_ENVKEY_REACT_APP_BACKEND_API: ${{ secrets.REACT_APP_BACKEND_API }}
jobs:
test:
runs-on: ubuntu-18.04 # Don't use "latest" version to avoid unexpected breaking changes
env:
PRISMA_ENDPOINT: ${{secrets.PRISMA_ENDPOINT}}
PRISMA_SECRET: ${{secrets.PRISMA_SECRET}}
REACT_APP_BACKEND_API: ${{secrets.REACT_APP_BACKEND_API}}
FRONTEND_URL: ${{secrets.FRONTEND_URL}}
BACKEND_PORT: ${{secrets.BACKEND_PORT}}
steps:
- uses: actions/checkout@v1 # TODO: lower priority - might upgrade to v2 (check changelog first)
- name: Bootstrap app on Ubuntu
uses: actions/setup-node@v1 # an action that checks out your repository to $GITHUB_WORKSPACE in the virtual environment.
with:
node-version: 12 # to avoid unexpected behavior with future latest node upgrades
- name: Install global packages
run: npm install -g dotenv-cli yarn lerna prisma-cli wait-port
- name: Install project deps
run: yarn
# - name: Make envfile
# uses: SpicyPizza/create-envfile@v1
# with:
# file_name: .env
# envkey_ENV_FILE: ".env"
- name: Run docker
run: docker-compose -f docker-compose.yml up --build -d
- name: Sleep
uses: jakejarvis/wait-action@master
with:
time: "60s"
- name: Check docker-compose is running properly or not
run: docker ps -a
- name: Reset the database for safety
run: yarn reset:backend
- name: Sleep
uses: jakejarvis/wait-action@master
with:
time: "60s"
- name: Deploy and seed backend
run: yarn deploy:backend
- name: Build app
run: yarn build
- name: start app
run: |
yarn start &
yarn test
почему это происходит? что я должен сделать, чтобы получить точную длину внутри github-action