Skip to content

Commit

Permalink
run in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Mineev committed Aug 23, 2022
1 parent 0b0c811 commit 8d980b3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 45 deletions.
47 changes: 5 additions & 42 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: frontend
name: e2e

on:
push:
Expand All @@ -15,55 +15,18 @@ on:

jobs:
tests:
name: E2E Tests
name: Tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16.15.1"

- name: Start containers
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f compose-e2e-test.yml up -d --build

- name: Install pnpm
uses: pnpm/[email protected]
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i
working-directory: frontend/e2e

- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: frontend/e2e

- name: Run tests
run: pnpm test
working-directory: frontend/e2e
- name: Build & run containers
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f compose-e2e-test.yml up -d --build --quiet-pull

- uses: actions/upload-artifact@v2
with:
name: playwright-report
path: playwright-report/
path: /playwright-report/
retention-days: 30
10 changes: 8 additions & 2 deletions compose-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ services:

image: umputun/remark42:dev
container_name: "remark42"
hostname: "remark42"

ports:
- "8080:8080" # primary rest server
- "8484:8084" # local oauth2 server

environment:
- REMARK_URL=http://127.0.0.1:8181
- REMARK_URL=http://remark:8080
- SECRET=12345
- DEBUG=true
- ADMIN_PASSWD=password
Expand All @@ -32,3 +31,10 @@ services:
- AUTH_EMAIL_ENABLE=true
volumes:
- ./var:/srv/var

tests:
build:
context: ./frontend
dockerfile: Dockerfile.e2e
volumes:
- ./playwright-report:/frontend/e2e/playwright-report
15 changes: 15 additions & 0 deletions frontend/Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/playwright:v1.25.0-focal

ENV CI true
WORKDIR /frontend

COPY ./package.json ./pnpm-workspace.yaml ./pnpm-lock.yaml /frontend/
COPY ./e2e/package.json /frontend/e2e/
RUN corepack enable pnpm && pnpm install

COPY ./e2e/tsconfig.json ./e2e/playwright.config.ts /frontend/e2e/
COPY ./e2e/tests /frontend/e2e/tests/

WORKDIR /frontend/e2e

RUN pnpm test
1 change: 1 addition & 0 deletions frontend/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const config: PlaywrightTestConfig = {

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
baseURL: process.env.CI ? "http://remark:8080" : "http://127.0.0.1:8080",
},

/* Configure projects for major browsers */
Expand Down
2 changes: 1 addition & 1 deletion frontend/e2e/tests/post-comment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from "@playwright/test";

test.describe("Post comment", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://127.0.0.1:8080/web/");
await page.goto("/web/");
});

test("as dev user", async ({ page }) => {
Expand Down

0 comments on commit 8d980b3

Please sign in to comment.