-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python Support? #98
Comments
Thanks @kiebak3r for submitting this issue. This is in our backlog. Currently we support Playwright test runner and Nunit runner. Folks, please upvote 👍 this issue if you want us to prioritize it. |
I'm currently using Playwright from the Python 'playwright' package for web scraping and am curious about whether MPT could be leveraged for this purpose. My alternative is to set up some more involved plumbing to get my code to run in Azure Container Apps, but MPT feels like a quicker way to scale this dynamically and get other managed service benefits. |
I'm currently using Playwright from the Python 'playwright' package for web scraping and am curious about whether MPT could be leveraged for this purpose. My alternative is to set up some more involved plumbing to get my code to run in Azure Container Apps, but MPT feels like a quicker way to scale this dynamically and get other managed service benefits. Edit: What I'd be curious to see is if MPT can offer any benefits to the scraping use case that I couldn't get by just deploying a Python container with the playwright package installed and using Azure Functions with Azure Container Apps. |
I was able to use the service with ## Environment Variables
# PW_SERVICE_URL -> Service URL from Azure
# PW_SERVICE_TOKEN -> Access token generated from Azure. Ref: https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens
# PW_SERVICE_RUN_ID -> Any unique identifer for the test run.
import json
import os
import sys
import typing as t
import pytest
if t.TYPE_CHECKING:
from playwright.sync_api import Browser, Playwright
@pytest.fixture(scope="session")
def browser(playwright: Playwright) -> Browser:
cap = json.dumps({"os": sys.platform, "runId": os.environ["PW_SERVICE_RUN_ID"]})
return playwright.chromium.connect(
f"{os.environ['PW_SERVICE_URL']}?cap={cap}",
headers={"x-mpt-access-key": os.environ["PW_SERVICE_TOKEN"]},
expose_network="<loopback>",
) NOTE: This still doesn't handle reporting. I was not able to figure that out - yet. |
Hi @winwinashwin |
My team has a large number of python based playwright tests. We are working towards integrating them into a DevOps pipeline. Is there any guidance on how to use this service with python or an ETA for official support yet? |
In its current state, this is not an option using this service as mentioned above you could run tests but not authenticate or get any results, the current best method for devops integration is allocating multiple agents to a run in your yaml to increase the parallel strategy and then splicing the pytest suite between the agents, For example, my suite has over 1000 tests which collects all the tests then splits them between 10 agents which on each agent machine can run 2 threads with pytest-xdist concurrently (spec limit) |
Thank you for the guidance. We will investigate that option. Is there no current plan to support python? |
Is your feature request related to a problem? Please describe.
Does this or Will this ever be supported with Python using pytest-playwright?
Describe the solution you'd like
Python Support
AB#2017180
The text was updated successfully, but these errors were encountered: