mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-12-02 20:20:35 -05:00
Match the print restriction shown by PdfCraft
This commit is contained in:
1 parent
bdd278c04c
commit
4f8a8b745f
2 files changed
+14
-4
No files matched your search
@@ -135,11 +135,14 @@ def denied_print(driver):
|
||||
opened = command(driver, "ui.command", {"id": "print.dialog"})
|
||||
if opened.get("ok"):
|
||||
command(driver, "ui.dialog.confirm", {"dialog": "top"})
|
||||
tree = result(driver, "ui.inspect", {"limit": 350})
|
||||
def denied(browser):
|
||||
tree = result(browser, "ui.inspect", {"limit": 350})
|
||||
message = json.dumps([opened, tree]).lower()
|
||||
if "don't allow printing" in message or "printing is not allowed" in message:
|
||||
return tree
|
||||
return False
|
||||
tree = WebDriverWait(driver, 10).until(denied)
|
||||
(RESULTS / "denied-dialog.json").write_text(json.dumps(tree, indent=2))
|
||||
message = json.dumps([opened, tree]).lower()
|
||||
assert ("not permitted" in message or "doesn't allow" in message
|
||||
or "does not allow" in message or "not allowed" in message), message
|
||||
assert not driver.execute_script("return !!document.querySelector('iframe[srcdoc]')")
|
||||
assert len(pdf_files()) == 1
|
||||
ImageGrab.grab().save(RESULTS / "print-denied.png")
|
||||
|
||||
@@ -51,6 +51,13 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
xvfb-run -a -s '-screen 0 1440x1100x24' /usr/bin/python3 .github/qa/verify-web-print.py
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
|
||||
if: always()
|
||||
with:
|
||||
name: pdfcraft-wasm-print-qa-site
|
||||
path: qa-site/
|
||||
retention-days: 3
|
||||
if-no-files-found: warn
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
|
||||
if: always()
|
||||
with:
|
||||
|
||||
Reference in new issue
Block a user