]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
💡 Add comments with instructions for Playwright screenshot scripts (#12193)
authorSebastián Ramírez <tiangolo@gmail.com>
Fri, 13 Sep 2024 09:14:46 +0000 (11:14 +0200)
committerGitHub <noreply@github.com>
Fri, 13 Sep 2024 09:14:46 +0000 (11:14 +0200)
scripts/playwright/request_form_models/image01.py
scripts/playwright/separate_openapi_schemas/image01.py
scripts/playwright/separate_openapi_schemas/image02.py
scripts/playwright/separate_openapi_schemas/image03.py
scripts/playwright/separate_openapi_schemas/image04.py
scripts/playwright/separate_openapi_schemas/image05.py

index 15bd3858c52c83020df7128ced1e796e1d69a383..fe4da32fcbf5340762305050e3a07bd6854a9e3b 100644 (file)
@@ -8,11 +8,13 @@ from playwright.sync_api import Playwright, sync_playwright
 # Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
-    context = browser.new_context()
+    # Update the viewport manually
+    context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_role("button", name="POST /login/ Login").click()
     page.get_by_role("button", name="Try it out").click()
+    # Manually add the screenshot
     page.screenshot(path="docs/en/docs/img/tutorial/request-form-models/image01.png")
 
     # ---------------------
index 0b40f3bbcf1c79f8ff0da533f49a4738f6ec3fc4..0eb55fb73a8648729cb78de5047cb3d159ee86a3 100644 (file)
@@ -3,13 +3,16 @@ import subprocess
 from playwright.sync_api import Playwright, sync_playwright
 
 
+# Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
+    # Update the viewport manually
     context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_text("POST/items/Create Item").click()
     page.get_by_role("tab", name="Schema").first.click()
+    # Manually add the screenshot
     page.screenshot(
         path="docs/en/docs/img/tutorial/separate-openapi-schemas/image01.png"
     )
index f76af7ee22177510e5c363e92ef443cc5153cfdc..0eb6c3c7967f8c66c3723fc14979d4cfcf8b2523 100644 (file)
@@ -3,14 +3,17 @@ import subprocess
 from playwright.sync_api import Playwright, sync_playwright
 
 
+# Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
+    # Update the viewport manually
     context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_text("GET/items/Read Items").click()
     page.get_by_role("button", name="Try it out").click()
     page.get_by_role("button", name="Execute").click()
+    # Manually add the screenshot
     page.screenshot(
         path="docs/en/docs/img/tutorial/separate-openapi-schemas/image02.png"
     )
index 127f5c428e86e94bc557ecbfa5976e657b075ffe..b68e9d7db887875491e7579beebb5c5829d059ac 100644 (file)
@@ -3,14 +3,17 @@ import subprocess
 from playwright.sync_api import Playwright, sync_playwright
 
 
+# Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
+    # Update the viewport manually
     context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_text("GET/items/Read Items").click()
     page.get_by_role("tab", name="Schema").click()
     page.get_by_label("Schema").get_by_role("button", name="Expand all").click()
+    # Manually add the screenshot
     page.screenshot(
         path="docs/en/docs/img/tutorial/separate-openapi-schemas/image03.png"
     )
index 208eaf8a0c7813469c32b60106439c8bdb7c9631..a36c2f6b2b3e042a890b63e6256687367c98a064 100644 (file)
@@ -3,14 +3,17 @@ import subprocess
 from playwright.sync_api import Playwright, sync_playwright
 
 
+# Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
+    # Update the viewport manually
     context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_role("button", name="Item-Input").click()
     page.get_by_role("button", name="Item-Output").click()
     page.set_viewport_size({"width": 960, "height": 820})
+    # Manually add the screenshot
     page.screenshot(
         path="docs/en/docs/img/tutorial/separate-openapi-schemas/image04.png"
     )
index 83966b4498cac14a913336b709a8c78667b98a2f..0da5db0cfa52c035d8b80c3ea71e297bd042ce67 100644 (file)
@@ -3,13 +3,16 @@ import subprocess
 from playwright.sync_api import Playwright, sync_playwright
 
 
+# Run playwright codegen to generate the code below, copy paste the sections in run()
 def run(playwright: Playwright) -> None:
     browser = playwright.chromium.launch(headless=False)
+    # Update the viewport manually
     context = browser.new_context(viewport={"width": 960, "height": 1080})
     page = context.new_page()
     page.goto("http://localhost:8000/docs")
     page.get_by_role("button", name="Item", exact=True).click()
     page.set_viewport_size({"width": 960, "height": 700})
+    # Manually add the screenshot
     page.screenshot(
         path="docs/en/docs/img/tutorial/separate-openapi-schemas/image05.png"
     )