-
Notifications
You must be signed in to change notification settings - Fork 153
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
deps: update to electron 10.1.5 #3547
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
be749ea
update electron dep
karanbirsingh fde8c4b
Merge branch 'master' of https://github.com/microsoft/accessibility-i…
karanbirsingh b3e5088
electron10, spectron broken, issue spectron@720
karanbirsingh fa1bb51
unit test updates
karanbirsingh d705b74
update asset number
karanbirsingh 1db1807
fix merge conflict
karanbirsingh 3f13dc3
some cleaning
karanbirsingh faafcfe
remove errant spacing introduced by manual merge
karanbirsingh d030231
add caret
karanbirsingh e145094
make selctor required param
karanbirsingh aa176b0
update comment
karanbirsingh d5ee412
Merge branch 'master' of https://github.com/microsoft/accessibility-i…
karanbirsingh e226464
merge
karanbirsingh ee025b4
remove comment
karanbirsingh 7d77ff1
double timeout on waitforselectortodisappear to allow for implicit ti…
karanbirsingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 71 additions & 21 deletions
92
src/tests/electron/common/view-controllers/spectron-async-client.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,89 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import { SpectronWindow } from 'spectron'; | ||
import { SpectronClient, SpectronWindow } from 'spectron'; | ||
import * as WebDriverIO from 'webdriverio'; | ||
|
||
// spectron 10.0.1 includes @types/webdriverio, whose absence | ||
// we worked around when initially consuming spectron. | ||
// @types/webdriver lacks promises, so this file adds | ||
// promise-based signatures that our e2e code can rely on. | ||
// @types/webdriver has been superceded by improved types | ||
// in webdriverio 5 directly, but Spectron has not consumed them | ||
// This file worked around incorrect or missing spectron/webdriverio | ||
// typings in the past. These types are improved in spectron 12.0.0, | ||
// so this file is now just a single place to update the usages. We | ||
// can remove this extra layer by updating individual end-to-end | ||
// tests/controllers to consume SpectronClient directly. | ||
|
||
export function getSpectronAsyncClient(client: SpectronClient, browserWindow: SpectronWindow) { | ||
const typedAsyncClient: SpectronAsyncClient = { | ||
browserWindow, | ||
$: (selector: string) => client.$(selector), | ||
$$: (selector: string) => client.$$(selector), | ||
click: async (selector: string) => { | ||
const element = await client.$(selector); | ||
return await element.click(); | ||
}, | ||
execute: (script: string | ((...args: any[]) => void), ...args: any[]) => | ||
client.execute(script, ...args), | ||
executeAsync: (script: string | ((...args: any[]) => void), ...args: any[]) => | ||
client.executeAsync(script, ...args), | ||
getAttribute: async (selector: string, attributeName: string) => { | ||
const element = await client.$(selector); | ||
return await element.getAttribute(attributeName); | ||
}, | ||
getText: async (selector: string) => { | ||
const element = await client.$(selector); | ||
return await element.getText(); | ||
}, | ||
isEnabled: async (selector: string) => { | ||
const element = await client.$(selector); | ||
return await element.isEnabled(); | ||
}, | ||
keys: (keys: string) => client.keys(keys), | ||
pause: (milliseconds: number) => client.pause(milliseconds), | ||
waitForEnabled: async (selector: string, milliseconds?: number, reverse?: boolean) => { | ||
const element = await client.$(selector); | ||
return await element.waitForEnabled({ | ||
timeout: milliseconds, | ||
reverse, | ||
}); | ||
}, | ||
waitForExist: async ( | ||
selector: string, | ||
milliseconds?: number, | ||
reverse?: boolean, | ||
timeoutMsg?: string, | ||
) => { | ||
const element = await client.$(selector); | ||
return await element.waitForExist({ | ||
timeout: milliseconds, | ||
reverse, | ||
timeoutMsg, | ||
}); | ||
}, | ||
waitUntil: (condition: () => Promise<Boolean>, options?: WebDriverIO.WaitUntilOptions) => | ||
client.waitUntil(condition, options), | ||
}; | ||
return typedAsyncClient; | ||
} | ||
|
||
export interface SpectronAsyncClient { | ||
// https://github.com/electron-userland/spectron/blob/cd733c4bc6b28eb5a1041ed79eef5563e75432ae/lib/api.js#L311 | ||
browserWindow: SpectronWindow; | ||
|
||
$(selector: string): Promise<WebDriverIO.RawResult<any>>; | ||
$$(selector: string): Promise<WebDriverIO.RawResult<any>[]>; | ||
click(selector?: string): Promise<void>; | ||
$(selector: string): Promise<WebDriverIO.Element>; | ||
$$(selector: string): Promise<WebDriverIO.Element[]>; | ||
click(selector: string): Promise<void>; | ||
executeAsync(script: string | ((...args: any[]) => void), ...args: any[]): Promise<any>; | ||
execute(script: string | ((...args: any[]) => void), ...args: any[]): Promise<any>; | ||
getAttribute<P>(selector: string, attributeName: string): Promise<P>; | ||
getAttribute(selector: string, attributeName: string): Promise<string>; | ||
getText(selector?: string): Promise<string>; | ||
isEnabled(selector?: string): Promise<boolean>; | ||
keys(keys: string): Promise<void>; | ||
pause(milliseconds: number): Promise<void>; | ||
waitForEnabled(selector: string, milliseconds?: number, reverse?: boolean): Promise<boolean>; | ||
waitForExist(selector: string, milliseconds?: number, reverse?: boolean): Promise<boolean>; | ||
waitUntil( | ||
condition: () => | ||
| boolean | ||
| Promise<boolean> | ||
| (WebDriverIO.Client<WebDriverIO.RawResult<any>> & WebDriverIO.RawResult<any>), | ||
timeout?: number, | ||
waitForExist( | ||
selector: string, | ||
milliseconds?: number, | ||
reverse?: boolean, | ||
timeoutMsg?: string, | ||
interval?: number, | ||
): Promise<boolean>; | ||
waitUntil( | ||
condition: () => Promise<Boolean>, | ||
options?: WebDriverIO.WaitUntilOptions, | ||
): Promise<boolean>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to leave a comment here explaining the same thing the PR description does about why we do this