Skip to content

fix: align profile name with avatar and edit button (backport #3203) #2000

fix: align profile name with avatar and edit button (backport #3203)

fix: align profile name with avatar and edit button (backport #3203) #2000

Workflow file for this run

name: Frontend Tests
on:
pull_request:
paths:
- "frontend/**"
- "package.json"
# Read from disk by frontend/src/tests/ravenRuleModel.test.ts.
- "lms/raven_provider.py"
- ".github/workflows/frontend-tests.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
plan:
name: Plan
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
run: ${{ steps.plan.outputs.run }}
steps:
# Pull requests into develop and the hotfix branches skip this suite: it runs every hour
# on the branch instead (branch-status.yml on develop), and on the release pull request.
# A label runs it on one pull request. Labels are read live, so a re-run sees a new one.
- id: plan
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
BASE: ${{ github.base_ref }}
run: |
labels=$(gh pr view "$PR" --repo "$GITHUB_REPOSITORY" --json labels --jq '[.labels[].name]')
has() { jq -e --arg l "$1" 'index($l) != null' <<<"$labels" >/dev/null; }
run=true
if [ "$BASE" = develop ] || [[ "$BASE" == *-hotfix ]]; then
run=false
if has "Run Frontend Tests" || has fixes-develop; then run=true; fi
fi
echo "run=$run" >> "$GITHUB_OUTPUT"
echo "Base $BASE, labels $labels: run=$run"
vitest:
name: Vitest
needs: plan
if: >-
!cancelled() && (github.event_name != 'pull_request' || needs.plan.outputs.run == 'true')
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
# The bench layout, because frontend/package.json declares
# `@framework/ui: link:../../frappe/ui` the way helpdesk and crm do. A
# checkout at the workspace root resolves that link outside the workspace,
# and vitest then fails with "Failed to resolve import
# @framework/ui/ConditionBuilder", naming neither the link nor the cause.
# Depth 2 keeps the PR base (the merge commit's first parent), which
# the test selection diffs against.
- uses: actions/checkout@v4
with:
path: apps/lms
fetch-depth: 2
# Only the package the link points at. `version-16`, the released line
# main-hotfix ships against: develop's ui/ renamed DataImport to
# DataImportWizard. It is bundled into the SPA at build time, so this pins
# what LMS builds against, not what it runs on.
- uses: actions/checkout@v4
with:
repository: frappe/frappe
ref: version-16
path: apps/frappe
sparse-checkout: ui
- uses: actions/setup-node@v6
with:
node-version: 24
check-latest: true
cache: yarn
cache-dependency-path: apps/lms/frontend/yarn.lock
- name: Install dependencies
working-directory: apps/lms/frontend
run: yarn install --frozen-lockfile
# A PR that changes only vitest files runs just those. Any other change,
# a setup file or helper included, runs the whole suite.
- name: Select tests
id: select
if: >-
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.labels.*.name, 'all-tests') &&
!contains(github.event.pull_request.labels.*.name, 'fixes-develop')
working-directory: apps/lms
run: |
set -euo pipefail
git diff --name-status --no-renames HEAD^1 HEAD \
| .github/helper/changed-tests.sh vitest >> "$GITHUB_OUTPUT"
- name: Run vitest
if: steps.select.outputs.mode != 'subset'
working-directory: apps/lms/frontend
run: yarn test --run
- name: Run changed tests
if: steps.select.outputs.mode == 'subset'
working-directory: apps/lms/frontend
env:
TESTS: ${{ steps.select.outputs.tests }}
run: |
read -ra files <<< "$TESTS"
yarn test --run "${files[@]}"