Skip to content
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

Use playwright for desktop smoke tests #128479

Closed
joaomoreno opened this issue Jul 12, 2021 · 8 comments · Fixed by #146692
Closed

Use playwright for desktop smoke tests #128479

joaomoreno opened this issue Jul 12, 2021 · 8 comments · Fixed by #146692
Assignees
Labels
debt Code quality issues engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders sandbox Running VSCode in a node-free environment
Milestone

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Jul 12, 2021

We are using playwright for our browser tests (#128061) and should explore to use this library also for our Electron based smoke tests.

Update (Nov 2021, @bpasero)
We now have a branch up and running with playwright for Electron smoke tests: #136367

However, there are blocking issues:

  • we see extension host connection hanging making the overall execution flaky ([1])
  • we should explore to reduce or drop window.driver and rely purely on playwright APIs for the driver
  • we need to investigate how others are using our current Electron based driver and whether they could adopt playwright too

[1]
When the extension host connection hangs, messages that are passed between window process and extension host process (node.js socket / named pipe) are not fully transmitted. Since messages are not fully delivered, our protocol that is implemented on top does not work. Either the extension host is not receiving the initialization data from the window or the extension host is unable to acknowledge that it is ready.
We believe this may be related to how playwright enables remote-debugging-port which is something we never have enabled otherwise. Possibly this results in unknown runtime behaviour when the browser window has node.js enabled. We should revisit this when we have sandbox enabled, though it might still not be an option given the shared process will remain node.js enabled for the time being.

@bpasero
Copy link
Member

bpasero commented Sep 8, 2021

Simple code to bring up Code:

const { _electron } = require('playwright');

const electronApp = await _electron.launch({  executablePath: '/Users/bpasero/Desktop/Visual Studio Code - Insiders.app/Contents/MacOS/Electron' });

The executablePath property allows us to use an existing Electron, as opposed to Playwright picking one.

@bpasero bpasero self-assigned this Sep 8, 2021
@joaomoreno
Copy link
Member Author

Yeah, that the option I mentioned a couple months ago when we discussed this. I’m glad to know it just works, fantastic! Shouldn’t be too hard to get the existing Playwright driver to run our smoketests. Just some glue code, hopefully.

@bpasero bpasero modified the milestones: September 2021, October 2021 Sep 23, 2021
@bpasero bpasero added the debt Code quality issues label Oct 4, 2021
@bpasero bpasero modified the milestones: October 2021, November 2021 Oct 20, 2021
@bpasero bpasero modified the milestones: November 2021, On Deck Nov 8, 2021
@bpasero bpasero added the sandbox Running VSCode in a node-free environment label Nov 8, 2021
@bpasero bpasero modified the milestones: On Deck, Backlog Nov 8, 2021
@bpasero bpasero changed the title Smoke Tests: Use Playwright driver for Electron Use playwright for desktop smoke tests Mar 30, 2022
@bpasero
Copy link
Member

bpasero commented Mar 30, 2022

Did a quick exploration in a hello world sample and was not able to get screenshots from the tracing, filed microsoft/playwright#13180

@bpasero
Copy link
Member

bpasero commented Mar 31, 2022

Nevermind, I might have validated wrong, according to Pavel they should work. I think we need to revisit this when we pick up the work again to see.

@christian-bromann
Copy link
Contributor

@bpasero I guess I am a bit too late for this but just so you and the team is aware we @stateful have invested time to build an integration into WebdriverIO that allows to run browser and Electron tests on Windows, Mac and Ubuntu. As part of this integration we will maintain a set of page objects for VSCode that avoids breaking builds due to changing locators in the app.

@bpasero
Copy link
Member

bpasero commented Apr 5, 2022

Thats cool, but I am not sure exactly what the ask is? We will stay with playwright for our testing needs for the foreseeable future, probably even expand it to Unit tests too.

@christian-bromann
Copy link
Contributor

No ask here. Just wanted to let you know that there is a web standard based alternative 😉

@bpasero
Copy link
Member

bpasero commented Apr 5, 2022

Cool, but wouldn't it make sense to let playwright team know?

@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders sandbox Running VSCode in a node-free environment
Projects
None yet
5 participants
@joaomoreno @christian-bromann @bpasero @sandy081 and others