Skip to content

Commit

Permalink
workflow for testing deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbonothing64 committed Dec 11, 2023
1 parent 43d31a5 commit 2443c8a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/run-app-end-to-end-deployed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Playwright Tests Deployment
on:
deployment_status:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
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: npm ci
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
8 changes: 5 additions & 3 deletions app/tests/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { test, expect } from '@playwright/test';

const BASE_URL = process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:5173/';

test('test page load', async ({ page }) => {
await page.goto('http://localhost:5173/');
await page.goto(BASE_URL);
await expect(page.getByRole('heading', { name: '🐜 Minimise for Python Tutor' })).toBeVisible();
await expect(page.getByText('/5600')).toBeVisible();
});

test('test minimise', async ({ page }) => {
await page.goto('http://localhost:5173/');
await page.goto(BASE_URL);
await page.getByPlaceholder('Your python code...').click();
await page
.getByPlaceholder('Your python code...')
Expand All @@ -28,7 +30,7 @@ test('test minimise', async ({ page }) => {
});

test('test minimise tiny', async ({ page }) => {
await page.goto('http://localhost:5173/');
await page.goto(BASE_URL);
await page.getByPlaceholder('Your python code...').click();
await page
.getByPlaceholder('Your python code...')
Expand Down

1 comment on commit 2443c8a

@vercel
Copy link

@vercel vercel bot commented on 2443c8a Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.