Skip to content

chore(site): add remote playwright support and script #10445

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

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Oct 31, 2023

Got inspired to play around with this, and since I tried most of this out already, thought I'd make a PR.

I have no preference on the final implementation, so feel free to change this as you please.

Adds a new command pnpm run playwright:remote that starts a playwright server locally and opens up port forwards to the provided workspace and drops you into an SSH shell where you can start the test.

(This relies on config-ssh to use plain OpenSSH to simplify things.)

image

@mafredri mafredri marked this pull request as ready for review October 31, 2023 15:46
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even after reading the changes Idk how to use this, maybe you could add some docs about this in the docs/contributing/fe?

@mafredri
Copy link
Member Author

@BrunoQuaresma for instance, on your Mac:

coder start my-workspace
git clone https://github.com/coder/coder coder
cd coder/site
pnpm install
pnpm run playwright:remote my-workspace
# Above command gives you a shell in your workspace where you simply run tests like normal:
#   pnpm run playwright:test

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was going to allow me to run the test on my workspace using the browser on my local machine but if this is an improvement, I'm up for it.

@mafredri
Copy link
Member Author

mafredri commented Nov 6, 2023

I thought it was going to allow me to run the test on my workspace using the browser on my local machine

That's exactly what this does.

@mtojek mtojek self-requested a review November 6, 2023 15:40
@BrunoQuaresma
Copy link
Collaborator

BrunoQuaresma commented Nov 6, 2023

I thought it was going to allow me to run the test on my workspace using the browser on my local machine

That's exactly what this does.

Rephrase, I thought it would just require Chrome on my local machine. Having to set up the other things is what usually made it hard for me in the past to get it working.

@mafredri
Copy link
Member Author

mafredri commented Nov 6, 2023

So why do I need to install extra things - from what I could see - besides Chrome only?

Because playwright decided to write their own API vs using plain Chrome DevTools Protocol. 😔

@mafredri
Copy link
Member Author

mafredri commented Nov 8, 2023

@BrunoQuaresma @mtojek I rewrote the script/setup a bit now, added docs, hopefully it's a bit clearer and easier to use.

image

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 You may want to record a demo and post it on slack :)

@mafredri mafredri force-pushed the mafredri/e2e-remote-playwright branch from 98377b0 to 4aff413 Compare November 9, 2023 11:14
@mafredri mafredri changed the title chore(site): add playwright:remote script chore(site): add remote playwright support and script Nov 9, 2023
@mafredri mafredri merged commit e71c53d into main Nov 9, 2023
@mafredri mafredri deleted the mafredri/e2e-remote-playwright branch November 9, 2023 11:26
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants