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

Update spectron app handler to pick VSCode window #744

Merged
merged 4 commits into from
Nov 14, 2018

Conversation

lcampos
Copy link
Contributor

@lcampos lcampos commented Nov 13, 2018

What does this PR do?

Updates our Spectron application handler and re-enables system tests in appveyor. The changes address a Spectron Windows OS issue (electron-userland/spectron#60) where multiple empty terminals get opened when running Spectron, causing our tests to fail in appveyor.

What issues does this PR fix or reference?

@W-5511648@

const title = await this.webclient.getTitle();

if (
process.platform === 'win32' &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NodeJs always returns win32 regardless of which windows version is being used (https://nodejs.org/docs/latest-v8.x/api/process.html#process_process_platform).

if (
process.platform === 'win32' &&
title !== '' &&
/Visual Studio Code/.test(title)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do without this check but wanted to make sure we look for the vscode window in case the empty terminals start returning a title (currently they return an empty title).

@codecov
Copy link

codecov bot commented Nov 13, 2018

Codecov Report

Merging #744 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #744   +/-   ##
========================================
  Coverage    74.23%   74.23%           
========================================
  Files          163      163           
  Lines         6609     6609           
  Branches      1039     1039           
========================================
  Hits          4906     4906           
  Misses        1433     1433           
  Partials       270      270

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cb73a7...48e17c5. Read the comment docs.

for (let i = 0; i < count; i++) {
await this.webclient.windowByIndex(i);

if (/bootstrap\/index\.html/.test(await this.webclient.getUrl())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a basic question, but why is the window that we want in focus during the Spectron test going to be named "...bootstrap/index.html"? Is that a Spectron convention?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That has to do with how spectron loads the vscode window, it's normally a file path that represents the local vscode location being used.

I think the path might've changed with vscode moving to a newer electron version (now we get something like electron-browser/workbench/workbench.html) but I was only able to test in Windows and Mac OS so I kept this for now.

@lcampos lcampos force-pushed the lcampos/spectron-win-empty-terminal branch from eb7617c to 14f7ecb Compare November 13, 2018 19:10
@lcampos lcampos merged commit d177f4e into develop Nov 14, 2018
@lcampos lcampos deleted the lcampos/spectron-win-empty-terminal branch November 14, 2018 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants