Skip to content

Commit 299fc82

Browse files
committed
added yml
1 parent 8f9c8ca commit 299fc82

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

.github/workflows/playwright.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Playwright Tests
2+
on:
3+
# pull_request:
4+
# branches: [ main, master ]
5+
push:
6+
branches: [ playwright ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v5
13+
- uses: actions/setup-node@v5
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install chromium --with-deps
20+
- name: Setup DDEV
21+
uses: ddev/github-action-setup-ddev@v1
22+
- name: Start DDEV
23+
run: ddev start
24+
- name: Install composer dependencies
25+
run: ddev poser
26+
- name: Symlink the theme into the web/themes/custom directory
27+
run: ddev symlink-project
28+
- name: Install Drupal and set the theme
29+
run: ddev install
30+
- name: Get DDEV URL
31+
id: ddev_url
32+
run: |
33+
URL=$(ddev describe -j | jq -r .raw.services.web.https_url)
34+
echo "BASE_URL=$URL" >> $GITHUB_ENV
35+
- name: Run Playwright tests
36+
run: npx playwright test tests/unitTesting
37+
env:
38+
USERNAME: ${{ secrets.USERNAME }}
39+
PASSWORD: ${{ secrets.PASSWORD }}
40+
baseURL: ${{ env.BASE_URL }}
41+
- uses: actions/upload-artifact@v4
42+
if: ${{ !cancelled() }}
43+
with:
44+
name: playwright-report
45+
path: playwright-report/
46+
retention-days: 30

playwright.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ module.exports = defineConfig({
1111
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
1212
reporter: [
1313
['html'],
14-
['json', { outputFile: 'test-results/results.json' }]
14+
['github']
1515
],
1616
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
1717
use: {
1818
/* Base URL to use in actions like `await page.goto('/')`. */
19-
baseURL: 'https://ubc-cwl-auth.ddev.site:33011',
19+
baseURL: process.env.BASE_URL || 'https://ubc-cwl-auth.ddev.site',
2020

2121
/* Take screenshot on failure */
2222
screenshot: 'only-on-failure',

tests/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { exec } from 'child_process';
22
import util from 'util';
3-
import dotenv from 'dotenv';
4-
dotenv.config();
3+
// import dotenv from 'dotenv';
4+
// dotenv.config();
55

66
const execAsync = util.promisify(exec);
77

0 commit comments

Comments
 (0)