From 766db9dc74e2f9c44c50ae482afa7ea1cff3a7b4 Mon Sep 17 00:00:00 2001 From: NitichaiSawangsai <40546651+NitichaiSawangsai@users.noreply.github.com> Date: Sat, 15 Jun 2024 19:48:20 +0700 Subject: [PATCH] fix: fixed update code (#449) --- .github/workflows/test-e2e-req-input.yml | 37 ++++++++++++++++++ .github/workflows/test-e2e.yml | 48 ++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/test-e2e-req-input.yml create mode 100644 .github/workflows/test-e2e.yml diff --git a/.github/workflows/test-e2e-req-input.yml b/.github/workflows/test-e2e-req-input.yml new file mode 100644 index 0000000..65910f0 --- /dev/null +++ b/.github/workflows/test-e2e-req-input.yml @@ -0,0 +1,37 @@ +name: Run Test E2E Required Input +on: + workflow_dispatch: + inputs: + version-tag: + description: 'Version tag or branch to test' + required: true + default: 'master' + +jobs: + test-e2e: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository Test E2E + uses: actions/checkout@v3 + with: + repository: NitichaiSawangsai/cypress-ex1 + ref: ${{ github.event.inputs.version-tag }} + token: ${{ secrets.REPO_CYPRESS_EX1_ACCESS_TOKEN }} + + - name: Install dependencies + run: npm install + + - name: Cypress run + uses: cypress-io/github-action@v5 + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: cypress/screenshots + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: cypress/videos diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml new file mode 100644 index 0000000..580f1ee --- /dev/null +++ b/.github/workflows/test-e2e.yml @@ -0,0 +1,48 @@ +name: Run Test E2E +on: + # push: + # branches: + # - release + pull_request: + branches: + - release +jobs: + test-e2e: + runs-on: ubuntu-latest + steps: + # action clones the repository into this environment, + # making your code available for the workflow steps that follow. + - name: Checkout Repository Test E2E + uses: actions/checkout@v3 + with: + repository: NitichaiSawangsai/cypress-ex1 # เปลี่ยนเป็น repository ของคุณ + ref: master # ตรวจสอบจาก branch release + token: ${{ github.token }} # ใช้ Personal Access Token ที่มีสิทธิ์ในการอ่าน Repository REPO_CYPRESS_EX1_ACCESS_TOKEN + + - name: Install dependencies + run: npm install + + # Install NPM dependencies, cache them correctly + # and run all Cypress tests + # https://github.com/cypress-io/github-action + - name: Cypress run + uses: cypress-io/github-action@v5 + # after the test run completes + # store videos and any screenshots + # NOTE: screenshots will be generated only if E2E test failed + # thus we store screenshots only on failures + # Alternative: create and commit an empty cypress/screenshots folder + # to always have something to upload + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: cypress/screenshots + # Test run video was always captured, so this action uses "always()" condition + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: cypress/videos + +