fix(ci): address PR blockers and move CI/nightly off sqlite
Some checks failed
CI / nightly-e2e (pull_request) Has been skipped
CI / ci (pull_request) Failing after 35s

This commit is contained in:
Mark
2026-02-28 16:38:37 +00:00
parent 36ac487cbd
commit 14db1bb57e
18 changed files with 1279 additions and 15 deletions

View File

@@ -0,0 +1,63 @@
from __future__ import annotations
from django.core.management.base import BaseCommand
from wagtail.models import Page, Site
from apps.authors.models import Author
from apps.blog.models import ArticleIndexPage, ArticlePage, HomePage
class Command(BaseCommand):
help = "Seed deterministic content for nightly Playwright E2E checks."
def handle(self, *args, **options):
root = Page.get_first_root_node()
home = HomePage.objects.child_of(root).first()
if home is None:
home = HomePage(title="Nightly Home", slug="nightly-home")
root.add_child(instance=home)
home.save_revision().publish()
article_index = ArticleIndexPage.objects.child_of(home).filter(slug="articles").first()
if article_index is None:
article_index = ArticleIndexPage(title="Articles", slug="articles")
home.add_child(instance=article_index)
article_index.save_revision().publish()
author, _ = Author.objects.get_or_create(
slug="e2e-author",
defaults={
"name": "E2E Author",
"bio": "Seeded nightly test author.",
},
)
article = ArticlePage.objects.child_of(article_index).filter(slug="nightly-playwright-journey").first()
if article is None:
article = ArticlePage(
title="Nightly Playwright Journey",
slug="nightly-playwright-journey",
author=author,
summary="Seeded article for nightly browser journey.",
body=[("rich_text", "<p>Seeded article body for nightly browser checks.</p>")],
comments_enabled=True,
)
article_index.add_child(instance=article)
article.save_revision().publish()
site, _ = Site.objects.get_or_create(
hostname="127.0.0.1",
port=8000,
defaults={
"root_page": home,
"is_default_site": True,
"site_name": "No Hype AI",
},
)
site.root_page = home
site.is_default_site = True
site.site_name = "No Hype AI"
site.save()
self.stdout.write(self.style.SUCCESS("Seeded nightly E2E content."))

View File

@@ -0,0 +1,42 @@
from __future__ import annotations
import os
import pytest
from playwright.sync_api import expect, sync_playwright
@pytest.mark.e2e
def test_nightly_playwright_journey() -> None:
base_url = os.getenv("E2E_BASE_URL")
if not base_url:
pytest.skip("E2E_BASE_URL is not set")
base_url = base_url.rstrip("/")
with sync_playwright() as pw:
browser = pw.chromium.launch()
page = browser.new_page()
page.goto(f"{base_url}/", wait_until="networkidle")
expect(page.locator("#cookie-banner")).to_be_visible()
page.get_by_role("button", name="Toggle theme").click()
page.get_by_role("button", name="Accept all").first.click()
expect(page.locator("#cookie-banner")).to_have_count(0)
page.goto(f"{base_url}/articles/", wait_until="networkidle")
first_article_link = page.locator("main article a").first
expect(first_article_link).to_be_visible()
article_href = first_article_link.get_attribute("href")
assert article_href
article_url = article_href if article_href.startswith("http") else f"{base_url}{article_href}"
page.goto(article_url, wait_until="networkidle")
expect(page.get_by_role("heading", name="Comments")).to_be_visible()
expect(page.get_by_role("button", name="Post comment")).to_be_visible()
page.goto(f"{base_url}/feed/", wait_until="networkidle")
feed_content = page.content()
assert "<rss" in feed_content or "<feed" in feed_content
browser.close()