old conflicts and version update
This commit is contained in:
parent
7af61a917f
commit
4885c94b72
66
app/assets/package-lock.json
generated
66
app/assets/package-lock.json
generated
@ -9,7 +9,41 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"highlight.js": "^11.11.1"
|
"highlight.js": "^11.11.1",
|
||||||
|
"playwright": "^1.61.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.60.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@playwright/test": {
|
||||||
|
"version": "1.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.1.tgz",
|
||||||
|
"integrity": "sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"playwright": "1.61.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/highlight.js": {
|
"node_modules/highlight.js": {
|
||||||
@ -20,6 +54,36 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.0.0"
|
"node": ">=12.0.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright": {
|
||||||
|
"version": "1.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.1.tgz",
|
||||||
|
"integrity": "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"playwright-core": "1.61.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright-core": {
|
||||||
|
"version": "1.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.1.tgz",
|
||||||
|
"integrity": "sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"playwright-core": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
"@playwright/test": "^1.60.0"
|
"@playwright/test": "^1.60.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"highlight.js": "^11.11.1"
|
"highlight.js": "^11.11.1",
|
||||||
|
"playwright": "^1.61.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,58 +0,0 @@
|
|||||||
import { defineConfig, devices } from "@playwright/test";
|
|
||||||
|
|
||||||
// Default Playwright e2e configuration.
|
|
||||||
//
|
|
||||||
// Uses Firefox by default (Playwright Chromium crashes on macOS 15
|
|
||||||
// due to Crashpad permission restrictions).
|
|
||||||
//
|
|
||||||
// ## Usage
|
|
||||||
//
|
|
||||||
// make playwright # run with default browser (Firefox)
|
|
||||||
// PLAYWRIGHT_BROWSER=chromium make playwright
|
|
||||||
// PLAYWRIGHT_BROWSER=webkit make playwright
|
|
||||||
//
|
|
||||||
// # Run a single test file:
|
|
||||||
// PLAYWRIGHT_BROWSERS_PATH=assets/node_modules/playwright-core/.local-browsers \
|
|
||||||
// npx playwright test --config=playwright.config.ts test/e2e/smoke.spec.ts
|
|
||||||
//
|
|
||||||
// ## Docker Chrome (alternative)
|
|
||||||
//
|
|
||||||
// Use playwright.docker.config.ts instead of this config:
|
|
||||||
//
|
|
||||||
// docker compose -f docker-compose.chrome.yml up -d
|
|
||||||
// npx playwright test --config=playwright.docker.config.ts
|
|
||||||
|
|
||||||
const browserEnv = process.env.PLAYWRIGHT_BROWSER || "firefox";
|
|
||||||
|
|
||||||
const deviceFor = (name: string) => {
|
|
||||||
switch (name) {
|
|
||||||
case "chromium": return devices["Desktop Chrome"];
|
|
||||||
case "firefox": return devices["Desktop Firefox"];
|
|
||||||
case "webkit": return devices["Desktop Safari"];
|
|
||||||
default:
|
|
||||||
console.warn(`Unknown browser "${name}", falling back to Firefox`);
|
|
||||||
return devices["Desktop Firefox"];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
testDir: "./test/e2e",
|
|
||||||
fullyParallel: true,
|
|
||||||
forbidOnly: !!process.env.CI,
|
|
||||||
retries: process.env.CI ? 2 : 0,
|
|
||||||
workers: process.env.CI ? 1 : undefined,
|
|
||||||
reporter: "list",
|
|
||||||
|
|
||||||
use: {
|
|
||||||
baseURL: process.env.PLAYWRIGHT_BASE_URL || "http://localhost:8056",
|
|
||||||
trace: "on-first-retry",
|
|
||||||
headless: process.env.PLAYWRIGHT_HEADLESS !== "false",
|
|
||||||
},
|
|
||||||
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: browserEnv,
|
|
||||||
use: { ...deviceFor(browserEnv) },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
/**
|
|
||||||
* Auth helpers for Playwright e2e tests.
|
|
||||||
*
|
|
||||||
* Provides utilities for logging in as a test user.
|
|
||||||
* The app uses email-only registration (magic-link flow for initial confirmation)
|
|
||||||
* and email+password for subsequent logins.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Page } from "@playwright/test";
|
|
||||||
|
|
||||||
export const TEST_USER = {
|
|
||||||
email: process.env.PLAYWRIGHT_EMAIL || "test@firehose.test",
|
|
||||||
password: process.env.PLAYWRIGHT_PASSWORD || "testpassword123!",
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigate to the login page, fill in credentials, and submit.
|
|
||||||
* Returns the page after successful login (redirected to home).
|
|
||||||
*/
|
|
||||||
export async function loginAsTestUser(page: Page) {
|
|
||||||
await page.goto("/users/log-in");
|
|
||||||
// Use the password-based login form
|
|
||||||
await page.getByLabel("Email").fill(TEST_USER.email);
|
|
||||||
await page.getByLabel("Password").fill(TEST_USER.password);
|
|
||||||
// Click "Log in and stay logged in"
|
|
||||||
await page.getByRole("button", { name: /log in and stay logged in/i }).click();
|
|
||||||
await page.waitForURL("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigate to the registration page, fill in email, and submit.
|
|
||||||
* Note: In dev mode, registration is invite-only by default. Set
|
|
||||||
* `PLAYWRIGHT_ALLOW_REGISTRATION=true` to run tests against a server
|
|
||||||
* with open registration enabled.
|
|
||||||
*/
|
|
||||||
export async function registerTestUser(page: Page) {
|
|
||||||
await page.goto("/users/register");
|
|
||||||
await page.getByLabel("Email").fill(TEST_USER.email);
|
|
||||||
await page.getByRole("button", { name: /create an account/i }).click();
|
|
||||||
await page.waitForURL("/users/log-in");
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import { test, expect } from "./fixtures";
|
|
||||||
import { loginAsTestUser } from "./auth-helpers";
|
|
||||||
|
|
||||||
test.describe("Authenticated pages", () => {
|
|
||||||
test("redirects unauthenticated users to login page", async ({ page }) => {
|
|
||||||
const response = await page.goto("/editor/dashboard");
|
|
||||||
// Should redirect to login
|
|
||||||
expect(response?.url()).toContain("/users/log-in");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("can log in and access the editor dashboard", async ({ page }) => {
|
|
||||||
await loginAsTestUser(page);
|
|
||||||
|
|
||||||
// After login, we should be on the home page
|
|
||||||
await expect(page).toHaveURL("/");
|
|
||||||
await expect(page.locator("body")).not.toBeEmpty();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("can log out", async ({ page }) => {
|
|
||||||
await loginAsTestUser(page);
|
|
||||||
|
|
||||||
// Now log out
|
|
||||||
await page.goto("/users/log-out");
|
|
||||||
|
|
||||||
// Should redirect to home
|
|
||||||
await expect(page).toHaveURL("/");
|
|
||||||
|
|
||||||
// Try accessing an authenticated page
|
|
||||||
await page.goto("/editor/dashboard");
|
|
||||||
// Should redirect to login
|
|
||||||
await expect(page).toHaveURL(/\/users\/log-in/);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* Custom Playwright test fixtures.
|
|
||||||
*
|
|
||||||
* Provides a `test` function that connects to a remote Chrome via CDP
|
|
||||||
* when PLAYWRIGHT_CDP_URL is set (Docker Chrome mode).
|
|
||||||
* Falls back to the default local browser otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { test as base, chromium } from "@playwright/test";
|
|
||||||
|
|
||||||
type Fixtures = {
|
|
||||||
// Browser is provided by Playwright Test by default.
|
|
||||||
// We only override it when connecting to remote Docker Chrome.
|
|
||||||
};
|
|
||||||
|
|
||||||
const cdpUrl = process.env.PLAYWRIGHT_CDP_URL;
|
|
||||||
|
|
||||||
export const test = cdpUrl
|
|
||||||
? base.extend<Fixtures>({
|
|
||||||
browser: async ({}, use) => {
|
|
||||||
const browser = await chromium.connectOverCDP(cdpUrl);
|
|
||||||
await use(browser);
|
|
||||||
await browser.close();
|
|
||||||
},
|
|
||||||
})
|
|
||||||
: base;
|
|
||||||
|
|
||||||
export { expect } from "@playwright/test";
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
import { test, expect } from "./fixtures";
|
|
||||||
|
|
||||||
test.describe("Connectivity smoke test", () => {
|
|
||||||
test("visits the homepage and verifies it loads", async ({ page }) => {
|
|
||||||
const response = await page.goto("/");
|
|
||||||
expect(response?.ok()).toBeTruthy();
|
|
||||||
|
|
||||||
// Verify the page has content
|
|
||||||
await expect(page).toHaveTitle(/Firehose/);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("visits the contact page", async ({ page }) => {
|
|
||||||
const response = await page.goto("/contact");
|
|
||||||
expect(response?.ok()).toBeTruthy();
|
|
||||||
await expect(page.locator("body")).not.toBeEmpty();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("visits the blog engineering index", async ({ page }) => {
|
|
||||||
const response = await page.goto("/blog/engineering");
|
|
||||||
expect(response?.ok()).toBeTruthy();
|
|
||||||
await expect(page.locator("body")).not.toBeEmpty();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("visits the blog releases index", async ({ page }) => {
|
|
||||||
const response = await page.goto("/blog/releases");
|
|
||||||
expect(response?.ok()).toBeTruthy();
|
|
||||||
await expect(page.locator("body")).not.toBeEmpty();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -153,7 +153,9 @@ defmodule Blogex.Blog do
|
|||||||
def _validate_links(posts, blog_id) do
|
def _validate_links(posts, blog_id) do
|
||||||
Enum.each(posts, fn post ->
|
Enum.each(posts, fn post ->
|
||||||
case Blogex.LinkValidator.validate_body(post.body, blog_id, post_id: post.id) do
|
case Blogex.LinkValidator.validate_body(post.body, blog_id, post_id: post.id) do
|
||||||
:ok -> :ok
|
:ok ->
|
||||||
|
:ok
|
||||||
|
|
||||||
{:error, errors} ->
|
{:error, errors} ->
|
||||||
raise Blogex.LinkError,
|
raise Blogex.LinkError,
|
||||||
blog: blog_id,
|
blog: blog_id,
|
||||||
|
|||||||
@ -174,7 +174,6 @@ defmodule Blogex.LinkValidator do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# --- Private helpers ---
|
# --- Private helpers ---
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user