Skip to content

Commit

Permalink
OBPIH-6760 Add playwright github actions to run tests on remote envir…
Browse files Browse the repository at this point in the history
…noment
  • Loading branch information
drodzewicz committed Oct 31, 2024
1 parent 02c6188 commit 3dc5b46
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Playwright Tests
on:
schedule:
- cron: '0 0 * * *'

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Install Playwright browsers
run: npx playwright install

- name: Set environment variables
env:
APP_BASE_URL: ${{ secrets.APP_BASE_URL }}
CI: true
USER_MAIN_USERNAME: ${{ secrets.USER_MAIN_USERNAME }}
USER_MAIN_PASSWORD: ${{ secrets.USER_MAIN_PASSWORD }}
USER_ALT_USERNAME: ${{ secrets.USER_ALT_USERNAME }}
USER_ALT_PASSWORD: ${{ secrets.USER_ALT_PASSWORD }}
USER_MANAGER_USERNAME: ${{ secrets.USER_MANAGER_USERNAME }}
USER_MANAGER_PASSWORD: ${{ secrets.USER_MANAGER_PASSWORD }}
LOCATION_MAIN: ${{ secrets.LOCATION_MAIN }}
LOCATION_NO_MANAGE_INVENOTRY_DEPOT: ${{ secrets.LOCATION_NO_MANAGE_INVENOTRY_DEPOT }}
LOCATION_SUPPLIER: ${{ secrets.LOCATION_SUPPLIER }}
LOCATION_SUPPLIER_ALT: ${{ secrets.LOCATION_SUPPLIER_ALT }}
LOCATION_DEPOT: ${{ secrets.LOCATION_DEPOT }}
LOCATION_WARD: ${{ secrets.LOCATION_WARD }}
PRODUCT_ONE: ${{ secrets.PRODUCT_ONE }}
PRODUCT_TWO: ${{ secrets.PRODUCT_TWO }}
run: echo "Environment variables set"

- name: Run Playwright tests
run: npx playwright test

- name: Save test report
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ appConfig.initialize();
export default defineConfig({
testDir: './src/tests',
/* Run tests in files in parallel */
fullyParallel: true,
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!appConfig.isCI,
/* Retry on CI only */
Expand All @@ -31,7 +31,7 @@ export default defineConfig({
baseURL: appConfig.appURL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: 'retain-on-failure',

launchOptions: {
// slowMo: 1000,
Expand Down

0 comments on commit 3dc5b46

Please sign in to comment.