Closed OleksandrBaior closed 3 months ago
Let's go through each line of this GitHub Actions configuration file:
name: Cypress Tests
on: workflow_dispatch:
push: branches: [master]
master
pull_request: branches: [master]
jobs: test: timeout-minutes: 60
runs-on: ubuntu-latest
ubuntu-latest
name: E2E on Chrome
steps:
- name: Checkout uses: actions/checkout@v4
actions/checkout@v4
- name: Cypress run uses: cypress-io/github-action@v6 with: browser: chrome record: true parallel: true
cypress-io/github-action@v6
chrome
true
env: group: 'UI-Chrome' TZ: Europe/Warsaw CYPRESS_ENV: Poland CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UI-Chrome
Europe/Warsaw
Poland
- name: Screenshots report if: always() uses: actions/upload-artifact@v4 with: name: cypress-screenshots path: cypress/screenshots if-no-files-found: ignore
actions/upload-artifact@v4
cypress-screenshots
cypress/screenshots
ignore
- name: Video report if: always() uses: actions/upload-artifact@v4 with: name: cypress-videos path: cypress/videos if-no-files-found: ignore
cypress-videos
cypress/videos
- name: Create cucumber-report uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: cucumber-report path: ./cucumber-report retention-days: 15
cucumber-report
./cucumber-report
deploy: needs: test runs-on: ubuntu-latest if: always()
steps: - name: Download cucumber report artifact if: always() uses: actions/download-artifact@v4
actions/download-artifact@v4
- name: Display structure of downloaded files if: always() run: ls -R
ls -R
- name: Deploy report to Github Pages if: always() uses: peaceiris/actions-gh-pages@v2 env: PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} PUBLISH_BRANCH: gh-pages PUBLISH_DIR: ./cucumber-report
peaceiris/actions-gh-pages@v2
gh-pages
Let's go through each line of this GitHub Actions configuration file for running Playwright tests:
name: Playwright Tests
push: branches: [main]
main
pull_request: branches: [main]
- uses: actions/checkout@v4
- uses: actions/setup-node@v4 with: node-version: 20
actions/setup-node@v4
20
- name: Install dependencies run: npm ci
npm ci
package-lock.json
- name: Install Playwright Browsers run: npx playwright install --with-deps
npx playwright install --with-deps
- name: Run Playwright tests run: npx playwright test
npx playwright test
- name: Create playwright-report uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: html-report path: reports retention-days: 30
html-report
reports
- name: Get Allure history uses: actions/checkout@v2 if: always() continue-on-error: true with: ref: gh-pages path: gh-pages
actions/checkout@v2
- name: Allure Report action from marketplace uses: simple-elf/allure-report-action@master if: always() with: allure_results: reports/allure-results allure_history: reports/allure-history keep_reports: 10
simple-elf/allure-report-action@master
reports/allure-results
reports/allure-history
- name: Deploy report to Github Pages if: always() uses: peaceiris/actions-gh-pages@v2 env: PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} PUBLISH_BRANCH: gh-pages PUBLISH_DIR: reports/allure-history
В нас вже є секція про yml, яка пояснює, що воно таке та найбільш потрібні моменти: https://knowledge-base.luxequality.com/docs/guides/GitHub/gitHub_action
Я не певен, чи нам треба більше
Example YML file for Cypress framework
Let's go through each line of this GitHub Actions configuration file:
Header and Trigger Events
master
branch.master
branch.Jobs Description
Job "test"
ubuntu-latest
).Steps of the "test" Job
actions/checkout@v4
action to clone the repository.cypress-io/github-action@v6
action to run Cypress tests.chrome
).true
).true
).UI-Chrome
).Europe/Warsaw
).Poland
).actions/upload-artifact@v4
action to upload artifacts.cypress-screenshots
).cypress/screenshots
).ignore
).actions/upload-artifact@v4
action to upload artifacts.cypress-videos
).cypress/videos
).ignore
).actions/upload-artifact@v4
action to upload artifacts.cucumber-report
)../cucumber-report
).Job "deploy"
ubuntu-latest
).Steps of the "deploy" Job
actions/download-artifact@v4
action to download artifacts.ls -R
to display the structure of downloaded files.peaceiris/actions-gh-pages@v2
action to deploy artifacts to GitHub Pages.gh-pages
)../cucumber-report
).Example YML file for Playwright framework
Let's go through each line of this GitHub Actions configuration file for running Playwright tests:
Header and Trigger Events
main
branch.main
branch.Jobs Description
Job "test"
ubuntu-latest
).Steps of the "test" Job
actions/checkout@v4
action to clone the repository.actions/setup-node@v4
action to set up Node.js.20
).npm ci
to install dependencies based on thepackage-lock.json
.npx playwright install --with-deps
to install Playwright browsers with dependencies.npx playwright test
to execute the Playwright tests.actions/upload-artifact@v4
action to upload artifacts.html-report
).reports
).actions/checkout@v2
action to clone the repository.gh-pages
).gh-pages
).simple-elf/allure-report-action@master
action to generate Allure reports.reports/allure-results
).reports/allure-history
).peaceiris/actions-gh-pages@v2
action to deploy artifacts to GitHub Pages.gh-pages
).reports/allure-history
).