mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-10 22:38:44 +02:00
chore(deps): update webdriverio monorepo to v10 (#3678)
* chore(deps): update webdriverio monorepo to v10 * fix e2e test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
1 parent
4f29d3a938
commit
974af951a5
6 files changed
+1562
-1952
No files matched your search
@@ -44,18 +44,18 @@
|
||||
"@tauri-apps/plugin-window-state": "workspace:*",
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@wdio/appium-service": "^9.31.9",
|
||||
"@wdio/cli": "^9.31.9",
|
||||
"@wdio/globals": "^9.31.3",
|
||||
"@wdio/local-runner": "^9.31.9",
|
||||
"@wdio/mocha-framework": "^9.31.9",
|
||||
"@wdio/spec-reporter": "^9.31.2",
|
||||
"@wdio/appium-service": "^10.0.0",
|
||||
"@wdio/cli": "^10.0.0",
|
||||
"@wdio/globals": "^10.0.0",
|
||||
"@wdio/local-runner": "^10.0.0",
|
||||
"@wdio/mocha-framework": "^10.0.0",
|
||||
"@wdio/spec-reporter": "^10.0.0",
|
||||
"appium": "^3.7.0",
|
||||
"appium-uiautomator2-driver": "^8.7.0",
|
||||
"appium-xcuitest-driver": "^12.12.4",
|
||||
"cross-env": "^10.1.0",
|
||||
"typescript": "6.0.3",
|
||||
"webdriverio": "^9.31.9",
|
||||
"webdriverio": "^10.0.0",
|
||||
"ws": "^8.18.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* Runs a callback-style async script in the page: `script` is a function body
|
||||
* that receives `args` followed by a `done` callback as its `arguments`, and
|
||||
* the value passed to `done` is returned.
|
||||
*
|
||||
* Stands in for `browser.executeAsync`, which WebdriverIO v10 removed: its
|
||||
* replacement (`execute` with an `async` function) only takes functions, which
|
||||
* the drivers' script transport would stringify anyway. Classic sessions use
|
||||
* the WebDriver "Execute Async Script" command directly; BiDi has no such
|
||||
* command, so the script is wrapped in a promise, which BiDi awaits.
|
||||
*
|
||||
* Takes the browser as a parameter (rather than importing `@wdio/globals`) so
|
||||
* the wdio configs can use it from their hooks.
|
||||
*/
|
||||
export async function executeAsync(
|
||||
browser: WebdriverIO.Browser,
|
||||
script: string,
|
||||
...args: unknown[]
|
||||
): Promise<unknown> {
|
||||
if (browser.isBidi) {
|
||||
return browser.execute(
|
||||
`var args = Array.prototype.slice.call(arguments);
|
||||
return new Promise(function (done) {
|
||||
(function () { ${script} }).apply(null, args.concat([done]));
|
||||
});`,
|
||||
...args
|
||||
)
|
||||
}
|
||||
return browser.executeAsyncScript(
|
||||
script,
|
||||
// Any JSON-serializable values; the driver rejects anything else.
|
||||
args as Parameters<WebdriverIO.Browser['executeAsyncScript']>[1]
|
||||
)
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { browser } from '@wdio/globals'
|
||||
import { executeAsync } from './execute.js'
|
||||
import type * as TauriApi from '@tauri-apps/api'
|
||||
import type * as Autostart from '@tauri-apps/plugin-autostart'
|
||||
import type * as BarcodeScanner from '@tauri-apps/plugin-barcode-scanner'
|
||||
@@ -173,7 +174,7 @@ export async function tauri<R, A extends unknown[]>(
|
||||
}
|
||||
});
|
||||
`
|
||||
const raw: unknown = await browser.executeAsync(script, ...args)
|
||||
const raw: unknown = await executeAsync(browser, script, ...args)
|
||||
const outcome = (
|
||||
typeof raw === 'string' ? JSON.parse(raw) : raw
|
||||
) as PageOutcome<Awaited<R>> | null
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
startFixtureServer,
|
||||
type FixtureServer
|
||||
} from './test/helpers/server.js'
|
||||
import { executeAsync } from './test/helpers/execute.js'
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = path.resolve(dirname, '..', '..')
|
||||
@@ -190,7 +191,8 @@ export const config: WebdriverIO.Config = {
|
||||
await browser.waitUntil(
|
||||
async () => {
|
||||
try {
|
||||
const ready: unknown = await browser.executeAsync(
|
||||
const ready: unknown = await executeAsync(
|
||||
browser,
|
||||
'var done = arguments[arguments.length - 1]; done(typeof window.__TAURI__ !== "undefined");'
|
||||
)
|
||||
return ready === true
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
FIXTURE_SERVER_PORT,
|
||||
type FixtureServer
|
||||
} from './test/helpers/server.js'
|
||||
import { executeAsync } from './test/helpers/execute.js'
|
||||
|
||||
export type MobilePlatform = 'android' | 'ios'
|
||||
|
||||
@@ -243,7 +244,7 @@ export function mobileConfig(platform: MobilePlatform): WebdriverIO.Config {
|
||||
'no WEBVIEW context appeared — is the app a debug build (webview debugging enabled)?'
|
||||
}
|
||||
)
|
||||
// The specs run the page through `executeAsync`, and the XCUITest driver
|
||||
// The specs run the page through async scripts, and the XCUITest driver
|
||||
// starts with a script timeout of 0 (every async script times out at
|
||||
// once) rather than the 30s the other drivers default to.
|
||||
await browser.setTimeout({ script: 30_000 })
|
||||
@@ -251,7 +252,8 @@ export function mobileConfig(platform: MobilePlatform): WebdriverIO.Config {
|
||||
await browser.waitUntil(
|
||||
async () => {
|
||||
try {
|
||||
const ready: unknown = await browser.executeAsync(
|
||||
const ready: unknown = await executeAsync(
|
||||
browser,
|
||||
'var done = arguments[arguments.length - 1]; done(typeof window.__TAURI__ !== "undefined");'
|
||||
)
|
||||
return ready === true
|
||||
|
||||
Reference in new issue
Block a user