Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: e2e
on:
push:
branches:
- "**"
- "!gh-pages"
tags:
- "**"

permissions:
contents: read

concurrency:
group: global-workflow-queue
cancel-in-progress: false

jobs:
e2e-job:
runs-on: ubuntu-latest

concurrency:
group: deploy-gh-pages
cancel-in-progress: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js - Cache dependencies - Install dependencies
uses: ./.github/workflows/setup-node

- name: Determine NEXT_PUBLIC_BASE_PATH
id: set-path
run: |
if [[ "${GITHUB_REF}" == refs/heads/* ]]; then
NAME="${GITHUB_REF#refs/heads/}"
BASE_PATH="/solid-memo/branches/${NAME}"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
NAME="${GITHUB_REF#refs/tags/}"
BASE_PATH="/solid-memo/tags/${NAME}"
else
echo "Unsupported ref: ${GITHUB_REF}"
exit 1
fi

SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="${NAME}:${SHORT_SHA}"

echo "base_path=$BASE_PATH" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: End-to-end test
run: npm run test:e2e
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.set-path.outputs.base_path }}
NEXT_PUBLIC_VERSION: ${{ steps.set-path.outputs.version }}
8 changes: 8 additions & 0 deletions apps/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Playwright
node_modules/
/test-results/
/tests-examples/
/playwright-report/
/blob-report/
/playwright/.cache/
19 changes: 19 additions & 0 deletions apps/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@solid-memo/e2e",
"version": "0.1.0",
"private": true,
"main": "index.js",
"license": "Apache-2.0",
"scripts": {
"test:e2e": "npx playwright test",
"test:e2e:ui": "npx playwright test --ui"
},
"devDependencies": {
"@types/node": "^22.15.21"
},
"dependencies": {
"@playwright/test": "^1.52.0",
"http-server": "^14.1.1",
"playwright": "^1.52.0"
}
}
80 changes: 80 additions & 0 deletions apps/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { defineConfig, devices } from "@playwright/test";

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* 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: 'http://localhost:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
webServer: {
command: "npx http-server --port 3000 ../web/out",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
timeout: 60 * 1000,
},
});
33 changes: 33 additions & 0 deletions apps/e2e/tests/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { test, expect } from "@playwright/test";

test("has Solid Memo title", async ({ page }) => {
await page.goto("http://localhost:3000/");

await expect(page).toHaveTitle(/Solid Memo/);

await expect(
page.getByRole("button", { name: "Go to Login page" })
).toBeVisible();

await expect(
page.getByRole("button", { name: "Go to non-existant page" })
).not.toBeVisible();
});

test.skip("go to login page", async ({ page }) => {
await page.goto("http://localhost:3000/");

await page.getByRole("button", { name: "Go to Login page" }).click();

// Expects page to have a heading with the name of Installation.
await expect(page.getByText("Welcome to Solid Memo")).toBeVisible();
await expect(page.getByText("Choose your Solid WebID")).toBeVisible();
await expect(page.getByText("Or continue with")).toBeVisible();
await expect(
page.getByText("Your Solid WebID", { exact: true })
).toBeVisible();
await expect(page.getByText("Don't have a WebID?")).toBeVisible();
await expect(
page.getByRole("link", { name: "Find a WebID provider" })
).toBeVisible();
});
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"type": "module",
"license": "Apache-2.0",
"scripts": {
"test": "npm run test:unit && npm run test:integration",
"test:unit": "vitest run test/unit/",
Expand Down
Loading