Integrate Content Editor and Publication workflow
This commit is contained in:
+15
-11
@@ -36,7 +36,7 @@ def main():
|
||||
work = Path(temp)
|
||||
site, dist = work / "site", work / "dist"
|
||||
shutil.copytree(
|
||||
ROOT / "examples/ai-studio", site, ignore=shutil.ignore_patterns(".engine")
|
||||
ROOT / "examples/site-studio", site, ignore=shutil.ignore_patterns(".engine")
|
||||
)
|
||||
build_site(site, dist)
|
||||
live = (dist / "current").resolve()
|
||||
@@ -61,6 +61,7 @@ def main():
|
||||
options = {"headless": True}
|
||||
if kind.name == "chromium":
|
||||
options["args"] = ["--no-sandbox", "--no-proxy-server"]
|
||||
options["channel"] = "chromium"
|
||||
if kind.name == "firefox":
|
||||
options["firefox_user_prefs"] = {"network.proxy.type": 0}
|
||||
if os.environ.get("QA_BROWSER_EXECUTABLE"):
|
||||
@@ -84,16 +85,13 @@ def main():
|
||||
page.wait_for_url(origin + "/admin/")
|
||||
page.goto(origin + "/admin/publish")
|
||||
with patch(
|
||||
"site_engine.web.api.routes.publish",
|
||||
"site_engine.services.publication.build_site",
|
||||
side_effect=PermissionError("QA publish denied"),
|
||||
):
|
||||
page.get_by_role("button", name="Опубликовать текущий черновик сайта").click()
|
||||
with page.expect_response(
|
||||
lambda r: r.url.endswith("/admin/publish") and r.request.method == "POST"
|
||||
lambda r: r.url.endswith("/admin/publication/build") and r.request.method == "POST"
|
||||
) as failed:
|
||||
page.locator("#confirm-dialog").get_by_role(
|
||||
"button", name="Продолжить"
|
||||
).click()
|
||||
page.locator('[data-pub-action=candidate]').first.click()
|
||||
response = failed.value
|
||||
assert response.status == 500
|
||||
correlation = response.headers["x-request-id"]
|
||||
@@ -146,16 +144,22 @@ def main():
|
||||
page.unroute("**/admin/editor/pages/index/save")
|
||||
checks.append("network_failure_is_visible_and_preserves_unsaved_source")
|
||||
page.get_by_role("button", name="Сохранить документ", exact=True).click()
|
||||
expect(page.locator("#editor-result")).to_have_attribute("data-saved", "1")
|
||||
page.wait_for_function(
|
||||
"expected => window.siteDocument?.state?.saved === expected && !window.siteDocument.state.dirty",
|
||||
arg=edited,
|
||||
)
|
||||
assert (site / "pages/index.md").read_text() == edited
|
||||
assert (dist / "current").resolve() == live
|
||||
checks.append("save_recovers_after_failure_without_publishing")
|
||||
page.goto(origin + "/admin/publish")
|
||||
page.get_by_role("button", name="Опубликовать текущий черновик сайта").click()
|
||||
page.locator('[data-pub-action=candidate]').first.click()
|
||||
page.locator('[data-publication-root][aria-busy=false]').wait_for()
|
||||
page.locator('[data-pub-action=publish]').click()
|
||||
page.locator('#release-comment').fill('Error recovery QA release')
|
||||
with page.expect_response(
|
||||
lambda r: r.url.endswith("/admin/publish") and r.request.method == "POST"
|
||||
lambda r: r.url.endswith("/admin/publication/activate") and r.request.method == "POST"
|
||||
) as published:
|
||||
page.locator("#confirm-dialog").get_by_role("button", name="Продолжить").click()
|
||||
page.locator('[data-pub-action=confirm-publish]').click()
|
||||
assert published.value.status == 200
|
||||
assert (dist / "current").resolve() != live
|
||||
expect(page.locator("#request-error")).to_be_hidden()
|
||||
|
||||
Reference in New Issue
Block a user