-
Notifications
You must be signed in to change notification settings - Fork 73
test: implement browser-env tests on client-scripts #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shadowusr
wants to merge
1
commit into
users/shadowusr/TESTPLANE-672.client-scripts-refactor
Choose a base branch
from
users/shadowusr/TESTPLANE-672.implement-browser-env-tests
base: users/shadowusr/TESTPLANE-672.client-scripts-refactor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,6 @@ wt | |
| test/e2e/report | ||
| test/e2e/static/basic-report | ||
| tmp | ||
| coverage/** | ||
| tsc-out | ||
| test/browser-env/report/** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| name: Testplane Browser Env Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [testplane@9] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| testplane-browser-env: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| env: | ||
| DOCKER_IMAGE_NAME: html-reporter-browsers | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: "npm" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build the package | ||
| run: npm run build | ||
|
|
||
| - name: "Prepare browser-env tests: Cache browser docker image" | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.docker/cache | ||
| key: docker-browser-image-testplane | ||
|
|
||
| - name: "Prepare browser-env tests: Pull browser docker image" | ||
| run: | | ||
| mkdir -p ~/.docker/cache | ||
| if [ -f ~/.docker/cache/image.tar ]; then | ||
| docker load -i ~/.docker/cache/image.tar | ||
| else | ||
| docker pull yinfra/html-reporter-browsers | ||
| docker save yinfra/html-reporter-browsers -o ~/.docker/cache/image.tar | ||
| fi | ||
|
|
||
| - name: "Prepare browser-env tests: Run browser docker image" | ||
| run: docker run -d --name ${{ env.DOCKER_IMAGE_NAME }} -it --rm --network=host $(which colima >/dev/null || echo --add-host=host.docker.internal:0.0.0.0) yinfra/html-reporter-browsers | ||
|
|
||
| - name: "browser-env: Run Testplane" | ||
| id: "testplane" | ||
| continue-on-error: true | ||
| run: npm run test-browser-env | ||
|
|
||
| - name: "browser-env: Stop browser docker image" | ||
| run: | | ||
| docker kill ${{ env.DOCKER_IMAGE_NAME }} || true | ||
| docker rm ${{ env.DOCKER_IMAGE_NAME }} || true | ||
|
|
||
| - name: Deploy Testplane html-reporter reports | ||
| uses: jakejarvis/s3-sync-action@v0.5.1 | ||
| with: | ||
| args: --acl public-read --follow-symlinks | ||
| env: | ||
| AWS_S3_BUCKET: gh-testplane-ci | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_S3_ENDPOINT: https://s3.yandexcloud.net/ | ||
| SOURCE_DIR: "test/browser-env/report" | ||
| DEST_DIR: "testplane-ci/browser-env-reports/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/" | ||
|
|
||
| - name: Construct PR comment | ||
| run: | | ||
| link="https://storage.yandexcloud.net/gh-testplane-ci/testplane-ci/browser-env-reports/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/index.html" | ||
| if [ "${{ steps.testplane.outcome }}" != "success" ]; then | ||
| comment="### ❌ Testplane browser-env run failed<br><br>[Report](${link})" | ||
| echo "PR_COMMENT=${comment}" >> $GITHUB_ENV | ||
| else | ||
| comment="### ✅ Testplane browser-env run succeed<br><br>[Report](${link})" | ||
| echo "PR_COMMENT=${comment}" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Leave comment to PR with link to Testplane HTML reports | ||
| if: github.event.pull_request | ||
| uses: thollander/actions-comment-pull-request@v3 | ||
| with: | ||
| message: ${{ env.PR_COMMENT }} | ||
| comment-tag: testplane_results | ||
|
|
||
| - name: Fail the job if any Testplane job is failed | ||
| if: ${{ steps.testplane.outcome != 'success' }} | ||
| run: exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow posts PR comments with
comment-tag: testplane_results, which is already used by.github/workflows/e2e.yml; when both jobs run on the same PR, they target the same tagged comment and overwrite each other’s report link/message. Give browser-env its own tag so both E2E and browser-env results remain visible.Useful? React with 👍 / 👎.