Can Playwright be used from a test server to run tests on a schedule?

In our Ask Me Anything on Playwright with @utchbe, a practical question came up, courtesy of Corry:

“Can Playwright be used from a test server to run tests on a schedule? How is this set up, and what are the system requirements?”

Does anyone have insights or experience in configuring Playwright for scheduled testing on a server?

3 Likes

I guess I dont quite understand what you mean by “scheduled”?

At my last job (RIP) we had several Azure pipelines built just for various test suites and some where playwrite or selenium or even C# api tests. the pipeline would build the solution, containerize it on an “agent” and then run the tests against an indicated environment. We then had some pipelines scheduled to run at certain times making them “scheduled”. I highly doubt its unique to azure. Im sure AWS, Github, Jenkins, etc can do similar things.

So I think my confusion is that the “scheduling” is not a function of Playwrite. Its a function of the infrastructure around the Playwrite tests. At least in my experience it is.

Or did I miss something? Wouldnt be the first time for that :slight_smile:

EDIT: in rethinking it yeah I did misunderstand but still answered in a backwards kind of a way…

1 Like

Playwright tests can be run on any CI provider. One of the best ways to write CI is to set it up through Github Actions.

This way playwright tests will run on push or pull request: on the server it install Playwright, pull the code, and then run the tests on the codebase. It will also create a simple run report.

5 Likes

After 7 years of Azure, Im trying ot GitHub actions. It looks pretty awesome.

2 Likes

Yes Playwright can be used from a test server to run on a schedule, but like the others above have mentioned, the orchestration of running tests with Playwright actually happens outside of Playwright.

You still need something to kick off your Playwright jobs (to actually run the npx playwright test command). By default if installing the node (TS/JS) version of Playwright going through the init process called out in the docs, you are asked if you would like to create a basic GitHub actions file to setup how/when you want to run your automation.

I would recommend learning how GitHub actions works, as it’s really powerful and will continue to be useful as it’s built into GitHub. To get GitHub actions working on a schedule you will want to look at the GitHub action event trigger “on schedule”.

Hope you have a great learning journey, I’ve been impressed with all the functionality they have built in the past 5 years.

4 Likes