Open
Description
Is there a simple pattern for creating basic tests of proxied services, eg using a tool such as playwright
?
If we know the port number a service is running on, then a simple test of the following form can be used to check that the page loads with the desired title, and then grabs a screenshot of it:
#test_app.py
PORT= 8765
def test_initial_load(page: Page):
page.goto(f"http://127.0.0.1:{PORT}")
expect(page).to_have_title("Page Title")
page.screenshot(path="proxied-service-screenshot.png")
#Usage:
# pip install pytest-playwright
# playwright install
# playwright install-deps
# pytest
Using the proxy name alias doesn't seem to get resolved, whereas specifying the port number explicitly does seem to work.
But in a general case, how can we find the port number for a proxied service, particularly if it it allocated dynamically?
I note also that we can get some general metadata about proxied services from http://localhost/server-proxy/servers-info
, although not the port numbers.