Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ wt
test/e2e/report
test/e2e/static/basic-report
tmp
coverage/**
tsc-out
test/browser-env/report/**
54 changes: 46 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,52 @@ module.exports = {
ecmaVersion: 2022,
},
overrides: [
{
files: ["src/browser/isomorphic/*.ts"],
rules: {
"@typescript-eslint/no-restricted-imports": [
"error",
{
patterns: ["../**"],
},
],
},
},
{
files: ["src/**/*.ts"],
excludedFiles: ["src/browser/client-scripts/**"],
rules: {
"@typescript-eslint/no-restricted-imports": [
"error",
{
patterns: [
{
group: ["**/client-scripts/**"],
allowTypeImports: true,
message:
"Imports from client-scripts are forbidden. Use type-only imports when needed.",
},
],
},
],
},
},
{
files: ["src/browser/client-scripts/**/*.ts"],
rules: {
"@typescript-eslint/no-restricted-imports": [
"error",
{
patterns: [
{
group: ["../../**", "!../../isomorphic", "!../../isomorphic/**", "!../../..", "!../../../isomorphic", "!../../../isomorphic/**"],
message: "Client-scripts cannot import server-side code, except isomorphic modules.",
},
],
},
],
},
},
{
files: ["*.ts"],
rules: {
Expand All @@ -20,13 +66,5 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["test/**"],
rules: {
"@typescript-eslint/no-empty-function": "off",
// For convenient casting of test objects
"@typescript-eslint/no-explicit-any": "off",
},
},
],
};
98 changes: 98 additions & 0 deletions .github/workflows/browser-env.yml
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Use a unique PR comment tag for browser-env job

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 👍 / 👎.


- name: Fail the job if any Testplane job is failed
if: ${{ steps.testplane.outcome != 'success' }}
run: exit 1
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ jobs:
run: |
link="https://storage.yandexcloud.net/gh-testplane-ci/testplane-ci/e2e-reports/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/index.html"
if [ "${{ steps.testplane.outcome }}" != "success" ]; then
comment="### ❌ Testplane run failed<br><br>[Report](${link})"
comment="### ❌ Testplane E2E run failed<br><br>[Report](${link})"
echo "PR_COMMENT=${comment}" >> $GITHUB_ENV
else
comment="### ✅ Testplane run succeed<br><br>[Report](${link})"
comment="### ✅ Testplane E2E run succeed<br><br>[Report](${link})"
echo "PR_COMMENT=${comment}" >> $GITHUB_ENV
fi

Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ bundle.compat.js
bundle.native.js
wt/**
tmp/**
coverage/**
tsc-out
testplane/**
testplane-report/**
*.tsbuildinfo
test/browser-env/report/**
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ bundle.compat.js
bundle.native.js
wt/**
test/e2e/report
test/e2e/static/basic-report
tmp/**
.testplane/**
coverage/**
*.tsbuildinfo
test/browser-env/report/**
*.png
*.DS_Store
Loading