Skip to content

Commit

Permalink
Added first test on dockerized app
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Jan 3, 2024
1 parent 106a4e1 commit 966b669
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Start containers
run: docker-compose up -d --build
- name: Setup node
uses: actions/setup-node@v3
with:
Expand All @@ -74,4 +76,7 @@ jobs:
name: playwright-report
path: tests/playwright-report/
retention-days: 30
- name: Stop containers
if: always()
run: docker-compose down

11 changes: 6 additions & 5 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ version: "3.9"
services:
db:
ports:
- "5432:5432"
- "10100:5432"
image: postgres:12.2-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: FoodDiary
PGPORT: 10100
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
test: ["CMD-SHELL", "pg_isready -p 10100 -U postgres"]
interval: 10s
retries: 5
web:
Expand All @@ -20,17 +21,17 @@ services:
context: ../
dockerfile: Dockerfile
ports:
- "5001:443"
- "10000:443"
environment:
- ASPNETCORE_URLS=https://+:443
- ASPNETCORE_Kestrel__Certificates__Default__Password=test
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/app.pfx
- ConnectionStrings__Default=User ID=postgres;Password=postgres;Host=db;Port=5432;Database=FoodDiary
- ConnectionStrings__Default=User ID=postgres;Password=postgres;Host=db;Port=10100;Database=FoodDiary
- Auth__AllowedEmails__0=test.user@gmail.com
- Google__ExportFolderId=test_folder_id
- GoogleAuth__ClientId=test_client_id
- GoogleAuth__ClientSecret=test_client_secret
- VITE_APP_API_URL=https://localhost:5001
- VITE_APP_API_URL=https://localhost:10000
- VITE_APP_AUTH_CHECK_INTERVAL=14400000 # 4 hours
volumes:
- ../certs:/https:ro
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { defineConfig, devices } from '@playwright/test';
*/
export default defineConfig({
testDir: './scenarios',
timeout: 30 * 1000,
timeout: 60 * 1000,
expect: {
timeout: 5000,
},
Expand Down
9 changes: 5 additions & 4 deletions tests/scenarios/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test } from '@playwright/test';
import { test, expect } from '@playwright/test';

test('should display google search page', async ({ page }) => {
await page.goto('https://www.google.com/');
await expect(page.getByRole('img', { name: 'Google' })).toBeVisible();
test('should display sign in page', async ({ page }) => {
await page.goto('https://localhost:10000');

await expect(page.getByRole('button', { name: /sign in with google/i })).toBeVisible();
});

0 comments on commit 966b669

Please sign in to comment.