Skip to content

Commit

Permalink
Move Playwright tests to top level of XFD repo, make changes needed f…
Browse files Browse the repository at this point in the history
…or Github Actions.
  • Loading branch information
JCantu248 committed Apr 5, 2024
1 parent 2ae45d6 commit b26eaa8
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 27 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Playwright Tests
on:
deployment_status:
paths:
- 'playwright/**'
- '.github/workflows/playwright.yml'
defaults:
run:
working-directory: ./playwright
env:
PW_XFD_URL: ${{ vars.PW_XFD_URL }}
PW_XFD_USERNAME: ${{ secrets.PW_XFD_USERNAME }}
PW_XFD_PASSWORD: ${{ secrets.PW_XFD_PASSWORD }}
PW_XFD_2FA_ISSUER: ${{ secrets._PW_XFD_2FA_ISSUER }}
PW_XFD_2FA_SECRET: ${{ secrets.PW_XFD_2FA_SECRET }}
PW_XFD_USER_ROLE: ${{ vars.PW_XFD_USER_ROLE }}

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.41.2-jammy
if: github.event.deployment_status.state == 'success'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: cd ../playwright && npm ci
- name: Run your tests
run: npx playwright test
env:
HOME: /root
21 changes: 0 additions & 21 deletions frontend/xfd_playwright/.github/workflows/playwright.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ dotenv.config();
const authFile = './storageState.json';

let totp = new OTPAuth.TOTP({
issuer: process.env.CROSSFEED_2FA_ISSUER,
issuer: process.env.PW_XFD_2FA_ISSUER,
label: 'Crossfeed',
algorithm: 'SHA1',
digits: 6,
period: 30,
secret: process.env.CROSSFEED_2FA_SECRET
secret: process.env.PW_XFD_2FA_SECRET
});

async function globalSetup(config: FullConfig) {
Expand All @@ -21,13 +21,13 @@ async function globalSetup(config: FullConfig) {
const page = await browser.newPage();

//Log in with credentials.
await page.goto(String(process.env.CROSSFEED_URL));
await page.goto(String(process.env.PW_XFD_URL));
await page
.getByPlaceholder('Enter your email address')
.fill(String(process.env.CROSSFEED_USERNAME));
.fill(String(process.env.PW_XFD_USERNAME));
await page
.getByPlaceholder('Enter your password')
.fill(String(process.env.CROSSFEED_PASSWORD));
.fill(String(process.env.PW_XFD_PASSWORD));
await page.getByRole('button', { name: 'Sign in' }).click();
await page
.getByPlaceholder('Enter code from your authenticator app')
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.CROSSFEED_URL,
baseURL: process.env.PW_XFD_URL,
storageState: 'storageState.json',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
Expand Down
File renamed without changes.

0 comments on commit b26eaa8

Please sign in to comment.