browsertrix/.github/workflows/ui-tests-playwright.yml
Emma Segal-Grossman b650762a45
Allow configuring available languages from helm chart (#2230)
Closes #2223 

- [x] Adds `localesAvailable` to `/api/settings` endpoint, and uses that
list if available, rather than the full list of translated locales, to
determine which options to display to users
- [x] ~~Uses the user's browser locales, filtered to the current
language setting, for formatting numbers, dates, and durations~~
- [x] Adds & persists checkbox for "use same language for formatting
dates and numbers" in user settings
- [x] Replaces uses of `sl-format-bytes` with `localize.bytes(...)`, and
`sl-format-date` with replacement `btrix-format-date` that properly
handles fallback locales
- [x] Caches all number/duration/datetime formatters by a combined key
consisting of app language, browser language, browser setting, and
formatter options so that all formatters can be reused if needed
(previously any formatter with non-default options would be recreated
every render)
- [x] Splits out ordinal formatting from number formatter, as it didn't
make much sense in some non-English locales
- [x] Adds a little demo of date/time/duration/number formatting so you
can see what effect your language settings have
  


https://github.com/user-attachments/assets/724858cb-b140-4d72-a38d-83f602c71bc7

---------

Signed-off-by: emma <hi@emma.cafe>
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2024-12-13 22:31:26 -05:00

87 lines
2.3 KiB
YAML

name: Playwright Tests
on:
pull_request:
paths:
- 'frontend/src/**'
- 'frontend/*.json'
- 'frontend/*.js'
- 'frontend/*.ts'
- '.github/workflows/ui-tests-playwright.yml'
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
DEV_PASSWORD: ${{ secrets.DEV_PASSWORD }}
API_BASE_URL: ${{ secrets.API_BASE_URL }}
working-directory: ./frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Get installed Playwright version
working-directory: frontend
id: playwright-version
run: |
yarn add @yarnpkg/lockfile
echo "PLAYWRIGHT_VERSION=$(node scripts/get-resolved-playwright-version.js)" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install dependencies
working-directory: frontend
run: yarn install --frozen-lockfile
- name: Install Playwright Browsers
working-directory: frontend
env:
HUSKY: 0
run: yarn playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install Playwright Deps
working-directory: frontend
env:
HUSKY: 0
run: yarn playwright install-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Create env file
run: |
cd frontend
touch .env
echo DEV_PASSWORD="${{ secrets.DEV_PASSWORD }}" >> .env
echo API_BASE_URL=${{ secrets.API_BASE_URL }} >> .env
cat .env
- name: Build frontend
working-directory: frontend
run: yarn build
id: build-frontend
- name: Run Playwright tests
working-directory: frontend
run: yarn playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30