UI Test
Test Anatomy
Test File Anatomy
This section explains the key elements of the generated test file. The Skyramp generated test is editable and runnable like any other executable file.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
The main test function replicates the scenario of UI actions recorded by the Playwright trace file, in exact chronological order of actions performed.
Here is a sample test using the following trace from the UI Testing guide:
Test File Anatomy
This section explains the key elements of the generated test file. The Skyramp generated test is editable and runnable like any other executable file.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
The main test function replicates the scenario of UI actions recorded by the Playwright trace file, in exact chronological order of actions performed.
Here is a sample test using the following trace from the UI Testing guide:
Test File Anatomy
This section explains the key elements of the generated test file. The Skyramp generated test is editable and runnable like any other executable file.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
The main test function replicates the scenario of UI actions recorded by the Playwright trace file, in exact chronological order of actions performed.
Here is a sample test using the following trace from the UI Testing guide:
Python
# Generated by Skyramp v1.2.11 on 2025-08-07 18:42:13.365822 -0400 EDT m=+0.810586085
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def test_ui(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
playwright_request_0 = {
"category": "Phones",
"description": "The ultimate smartphone - powered by Skyramp",
"image_url": "https://images.google.com/skyphone1",
"in_stock": True,
"name": "SkyPhone 1",
"price": 999
}
page.get_by_test_id("new_product_name").fill(skyramp.get_value(playwright_request_0, "name"))
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(skyramp.get_value(playwright_request_0, "description"))
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(skyramp.get_value(playwright_request_0, "image_url"))
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(skyramp.get_value(playwright_request_0, "category"))
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(str(skyramp.get_value(playwright_request_0, "price")))
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text("$999")
page.get_by_test_id("navbar-orders").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
playwright_request_1 = {
"customer_email": "sahil@skyramp.dev",
"items": [{
"product_id": "24",
"quantity": 1
}]
}
page.get_by_test_id("add-order-input-email").fill(skyramp.get_value(playwright_request_1, "customer_email"))
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id("add-order-product-option-SkyPhone 1").get_by_text("SkyPhone 1 ($999)").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders/13") as resp:
page.get_by_role("button", name="Cancel Order").click()
page.get_by_test_id("navbar-products").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("product-SkyPhone-1-view-details").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products/24") as resp:
page.get_by_role("button", name="Delete Product").click()
Skyramp Differentiators
Smart Selectors
Skyramp generates intelligent UI selectors that automatically adapt to application changes and avoids brittle selectors that break with every UI update. Instead of relying on fragile CSS classes or XPath positions, it creates robust selectors using semantic HTML structure, visual context, and multiple fallback strategies. This dramatically reduces test maintenance overhead, eliminates false test failures that block deployments, and allows teams to focus on building features rather than constantly fixing broken tests.
Hydration
Skyramp automatically adds intelligent waiting logic in the test to ensure that a web page fully loads its JavaScript code (a process otherwise known as hydration). These waits lead to less flaky tests since they ensure elements on the page being validated against appear and do not cause the test to timeout.
Modularization and Parameterization
If an UI test is generated via the Skyramp Agentic Experience (available via VSCode Extension or MCP Server), the generated test will be automatically parameterized and modularized to make the test code more readable and allow for potential re-usability of code. For more information about the Skyramp Agentic Experience, please join the waitlist.
Here is an example of the test output when modularized by the Skyramp agent:
# Generated by Skyramp v1.2.9 on 2025-08-07 18:45:15.26874 -0400 EDT m=+9.779817793
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --output ui_test_modularized.py \
# --output-dir /Users/slamba/new-docs-traces \
# --overwrite true \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def navigate_to_products_page(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
page.wait_for_timeout(1500)
def add_product(page: Page, name: str, description: str, image_url: str, category: str, price: str):
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
page.get_by_test_id("new_product_name").fill(name)
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(description)
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(image_url)
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(category)
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(price)
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text(f"${price}")
def add_order(page: Page, email: str, product_name: str, product_price: str):
page.get_by_test_id("navbar-orders").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
page.get_by_test_id("add-order-input-email").fill(email)
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id(f"add-order-product-option-{product_name}").get_by_text(f"{product_name} (${product_price})").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
page.wait_for_timeout(1500)
def cancel_order(page: Page, order_id: str):
with page.expect_response(f"**/api/v1/orders/{order_id}") as resp:
page.get_by_role("button", name="Cancel Order").click()
def delete_product(page: Page, product_id: str, product_name: str):
page.get_by_test_id("navbar-products").click()
page.wait_for_timeout(1500)
page.get_by_test_id(f"product-{product_name.replace(' ', '-')}-view-details").click()
page.wait_for_timeout(1500)
with page.expect_response(f"**/api/v1/products/{product_id}") as resp:
page.get_by_role("button", name="Delete Product").click()
def test_ui(page: Page):
navigate_to_products_page(page)
add_product(page, "SkyPhone 1", "The ultimate smartphone - powered by Skyramp", "https://images.google.com/skyphone1", "Phones", "999")
add_order(page, "sahil@skyramp.dev", "SkyPhone 1", "999")
cancel_order(page, "13")
delete_product(page, "24", "SkyPhone 1")
Python
# Generated by Skyramp v1.2.11 on 2025-08-07 18:42:13.365822 -0400 EDT m=+0.810586085
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def test_ui(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
playwright_request_0 = {
"category": "Phones",
"description": "The ultimate smartphone - powered by Skyramp",
"image_url": "https://images.google.com/skyphone1",
"in_stock": True,
"name": "SkyPhone 1",
"price": 999
}
page.get_by_test_id("new_product_name").fill(skyramp.get_value(playwright_request_0, "name"))
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(skyramp.get_value(playwright_request_0, "description"))
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(skyramp.get_value(playwright_request_0, "image_url"))
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(skyramp.get_value(playwright_request_0, "category"))
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(str(skyramp.get_value(playwright_request_0, "price")))
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text("$999")
page.get_by_test_id("navbar-orders").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
playwright_request_1 = {
"customer_email": "sahil@skyramp.dev",
"items": [{
"product_id": "24",
"quantity": 1
}]
}
page.get_by_test_id("add-order-input-email").fill(skyramp.get_value(playwright_request_1, "customer_email"))
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id("add-order-product-option-SkyPhone 1").get_by_text("SkyPhone 1 ($999)").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders/13") as resp:
page.get_by_role("button", name="Cancel Order").click()
page.get_by_test_id("navbar-products").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("product-SkyPhone-1-view-details").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products/24") as resp:
page.get_by_role("button", name="Delete Product").click()
Skyramp Differentiators
Smart Selectors
Skyramp generates intelligent UI selectors that automatically adapt to application changes and avoids brittle selectors that break with every UI update. Instead of relying on fragile CSS classes or XPath positions, it creates robust selectors using semantic HTML structure, visual context, and multiple fallback strategies. This dramatically reduces test maintenance overhead, eliminates false test failures that block deployments, and allows teams to focus on building features rather than constantly fixing broken tests.
Hydration
Skyramp automatically adds intelligent waiting logic in the test to ensure that a web page fully loads its JavaScript code (a process otherwise known as hydration). These waits lead to less flaky tests since they ensure elements on the page being validated against appear and do not cause the test to timeout.
Modularization and Parameterization
If an UI test is generated via the Skyramp Agentic Experience (available via VSCode Extension or MCP Server), the generated test will be automatically parameterized and modularized to make the test code more readable and allow for potential re-usability of code. For more information about the Skyramp Agentic Experience, please join the waitlist.
Here is an example of the test output when modularized by the Skyramp agent:
# Generated by Skyramp v1.2.9 on 2025-08-07 18:45:15.26874 -0400 EDT m=+9.779817793
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --output ui_test_modularized.py \
# --output-dir /Users/slamba/new-docs-traces \
# --overwrite true \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def navigate_to_products_page(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
page.wait_for_timeout(1500)
def add_product(page: Page, name: str, description: str, image_url: str, category: str, price: str):
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
page.get_by_test_id("new_product_name").fill(name)
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(description)
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(image_url)
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(category)
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(price)
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text(f"${price}")
def add_order(page: Page, email: str, product_name: str, product_price: str):
page.get_by_test_id("navbar-orders").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
page.get_by_test_id("add-order-input-email").fill(email)
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id(f"add-order-product-option-{product_name}").get_by_text(f"{product_name} (${product_price})").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
page.wait_for_timeout(1500)
def cancel_order(page: Page, order_id: str):
with page.expect_response(f"**/api/v1/orders/{order_id}") as resp:
page.get_by_role("button", name="Cancel Order").click()
def delete_product(page: Page, product_id: str, product_name: str):
page.get_by_test_id("navbar-products").click()
page.wait_for_timeout(1500)
page.get_by_test_id(f"product-{product_name.replace(' ', '-')}-view-details").click()
page.wait_for_timeout(1500)
with page.expect_response(f"**/api/v1/products/{product_id}") as resp:
page.get_by_role("button", name="Delete Product").click()
def test_ui(page: Page):
navigate_to_products_page(page)
add_product(page, "SkyPhone 1", "The ultimate smartphone - powered by Skyramp", "https://images.google.com/skyphone1", "Phones", "999")
add_order(page, "sahil@skyramp.dev", "SkyPhone 1", "999")
cancel_order(page, "13")
delete_product(page, "24", "SkyPhone 1")
Python
# Generated by Skyramp v1.2.11 on 2025-08-07 18:42:13.365822 -0400 EDT m=+0.810586085
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def test_ui(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
playwright_request_0 = {
"category": "Phones",
"description": "The ultimate smartphone - powered by Skyramp",
"image_url": "https://images.google.com/skyphone1",
"in_stock": True,
"name": "SkyPhone 1",
"price": 999
}
page.get_by_test_id("new_product_name").fill(skyramp.get_value(playwright_request_0, "name"))
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(skyramp.get_value(playwright_request_0, "description"))
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(skyramp.get_value(playwright_request_0, "image_url"))
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(skyramp.get_value(playwright_request_0, "category"))
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(str(skyramp.get_value(playwright_request_0, "price")))
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text("$999")
page.get_by_test_id("navbar-orders").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
playwright_request_1 = {
"customer_email": "sahil@skyramp.dev",
"items": [{
"product_id": "24",
"quantity": 1
}]
}
page.get_by_test_id("add-order-input-email").fill(skyramp.get_value(playwright_request_1, "customer_email"))
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id("add-order-product-option-SkyPhone 1").get_by_text("SkyPhone 1 ($999)").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders/13") as resp:
page.get_by_role("button", name="Cancel Order").click()
page.get_by_test_id("navbar-products").click()
# Javascript download detected. Wait until potential hydration is completed
page.wait_for_timeout(1500)
page.get_by_test_id("product-SkyPhone-1-view-details").click()
# Wait to finish any potential hydration
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products/24") as resp:
page.get_by_role("button", name="Delete Product").click()
Skyramp Differentiators
Smart Selectors
Skyramp generates intelligent UI selectors that automatically adapt to application changes and avoids brittle selectors that break with every UI update. Instead of relying on fragile CSS classes or XPath positions, it creates robust selectors using semantic HTML structure, visual context, and multiple fallback strategies. This dramatically reduces test maintenance overhead, eliminates false test failures that block deployments, and allows teams to focus on building features rather than constantly fixing broken tests.
Hydration
Skyramp automatically adds intelligent waiting logic in the test to ensure that a web page fully loads its JavaScript code (a process otherwise known as hydration). These waits lead to less flaky tests since they ensure elements on the page being validated against appear and do not cause the test to timeout.
Modularization and Parameterization
If an UI test is generated via the Skyramp Agentic Experience (available via VSCode Extension or MCP Server), the generated test will be automatically parameterized and modularized to make the test code more readable and allow for potential re-usability of code. For more information about the Skyramp Agentic Experience, please join the waitlist.
Here is an example of the test output when modularized by the Skyramp agent:
# Generated by Skyramp v1.2.9 on 2025-08-07 18:45:15.26874 -0400 EDT m=+9.779817793
# Command: skyramp generate ui rest \
# --framework pytest \
# --language python \
# --output ui_test_modularized.py \
# --output-dir /Users/slamba/new-docs-traces \
# --overwrite true \
# --playwright-trace ui_test_playwright.zip \
# Import of required libraries
import skyramp
import os
import time
import pytest
import re
from playwright.sync_api import Page, expect
@pytest.fixture(scope="session")
def browser_context_args(browser_context_args, playwright):
return {"ignore_https_errors": True, "service_workers": "block"}
def navigate_to_products_page(page: Page):
page.goto("http://demoshop.skyramp.dev/products")
page.wait_for_timeout(1500)
def add_product(page: Page, name: str, description: str, image_url: str, category: str, price: str):
page.get_by_role("button", name="Add Product").click()
page.get_by_test_id("new_product_name").click()
page.get_by_test_id("new_product_name").fill(name)
page.get_by_test_id("new_product_name").press("Tab")
page.get_by_test_id("new_product_description").fill(description)
page.get_by_test_id("new_product_description").press("Tab")
page.get_by_test_id("new_product_image_url").fill(image_url)
page.get_by_test_id("new_product_image_url").press("Tab")
page.get_by_test_id("new_product_category").fill(category)
page.get_by_test_id("new_product_category").press("Tab")
page.get_by_role("combobox").press("Tab")
page.get_by_test_id("new_product_price").fill(price)
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/products") as resp:
page.get_by_role("button", name="Submit").click()
page.wait_for_timeout(1500)
expect(page.get_by_test_id("product-detail-value-price")).to_contain_text(f"${price}")
def add_order(page: Page, email: str, product_name: str, product_price: str):
page.get_by_test_id("navbar-orders").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-btn").click()
page.wait_for_timeout(1500)
page.get_by_test_id("add-order-input-email").click()
page.get_by_test_id("add-order-input-email").fill(email)
page.get_by_test_id("add-order-input-email").press("Tab")
page.get_by_role("combobox").click()
page.get_by_test_id(f"add-order-product-option-{product_name}").get_by_text(f"{product_name} (${product_price})").click()
page.get_by_test_id("add-order-products-container").get_by_role("button", name="Add").click()
page.wait_for_timeout(1500)
with page.expect_response("**/api/v1/orders") as resp:
page.get_by_test_id("add-order-form-fields-container").get_by_role("button", name="Add Order").click()
page.wait_for_timeout(1500)
def cancel_order(page: Page, order_id: str):
with page.expect_response(f"**/api/v1/orders/{order_id}") as resp:
page.get_by_role("button", name="Cancel Order").click()
def delete_product(page: Page, product_id: str, product_name: str):
page.get_by_test_id("navbar-products").click()
page.wait_for_timeout(1500)
page.get_by_test_id(f"product-{product_name.replace(' ', '-')}-view-details").click()
page.wait_for_timeout(1500)
with page.expect_response(f"**/api/v1/products/{product_id}") as resp:
page.get_by_role("button", name="Delete Product").click()
def test_ui(page: Page):
navigate_to_products_page(page)
add_product(page, "SkyPhone 1", "The ultimate smartphone - powered by Skyramp", "https://images.google.com/skyphone1", "Phones", "999")
add_order(page, "sahil@skyramp.dev", "SkyPhone 1", "999")
cancel_order(page, "13")
delete_product(page, "24", "SkyPhone 1")