This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
test: fix tests #164
This file contains 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
name: Test | |
on: | |
push: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
REACT_APP_PUB_KEY: ${{ secrets.REACT_APP_PUB_KEY }} | |
REACT_APP_SUB_KEY: ${{ secrets.REACT_APP_SUB_KEY }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
tests: | |
name: Run builtin test cases | |
runs-on: macos-13 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache React Chat Component dependencies | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-yarn-rcc-${{ hashFiles('yarn.lock') }} | |
restore-keys: ${{ runner.os }}-yarn-rcc- | |
path: '**/node_modules' | |
- name: Run types validation | |
run: | | |
yarn install --prefer-offline --frozen-lockfile | |
yarn run test | |
e2e-tests: | |
name: Run e2e tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
repository: pubnub/chat-components-e2e-tests | |
ref: master | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install e2e framework dependencies | |
run: | | |
RCC_PATH=${{ github.workspace }}/react/testing_apps | |
[[ -d "$RCC_PATH" ]] && rm -rf "$RCC_PATH" | |
cd ${{ github.workspace }}/react | |
npm ci | |
- name: Cache Playwright browsers | |
id: playwright-browsers-cache | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-playwright-${{ hashFiles('react/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-playwright- | |
path: ~/.cache/ms-playwright | |
- name: Clear Playwright cache | |
run: npx playwright install-deps | |
- name: Install project dependencies | |
run: npm install | |
- name: Install Playwright browsers | |
run: npx playwright install | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
path: react/testing_apps/react-chat-components | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache React Chat Component dependencies | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-yarn-rcc-e2e-${{ hashFiles('react/testing_apps/react-chat-components/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-yarn-rcc-e2e- | |
path: 'react/testing_apps/react-chat-components/**/node_modules' | |
- name: Install React Chat Component dependencies | |
run: | | |
cd ${{ github.workspace }}/react/testing_apps/react-chat-components | |
yarn install --prefer-offline --frozen-lockfile | |
- name: Test application setup and run | |
run: | | |
cd ${{ github.workspace }}/react/testing_apps/react-chat-components/samples/react/group-chat | |
yarn run setup | |
yarn run start & | |
- name: Run e2e tests | |
run: | | |
cd ${{ github.workspace }}/react | |
npx playwright test ./tests/message-list.spec.ts | |
- name: Expose e2e test report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: ${{ github.workspace }}/react/playwright-report/*.html | |
retention-days: 7 |