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

It seems there is no way to WebDriver Protocol over WebDriver Bidi Protocol when using WebdriverIO to do E2E test #1485

Open
li-zheng-dmm opened this issue Feb 11, 2025 · 0 comments

Comments

@li-zheng-dmm
Copy link

I'm trying to use WebdriverIO to do E2E test, but since WebDriver Bidi Protocol is default Automation Protocols,
when testing started, instead of showing content of my app, below "BiDi-CDP Mapper is controlling this tab" is showing.
So the test is always failed.
Image

I've checked documents of tauri and WebdriverIO, can't find anything about how to control it.
Since wry is doing the rendering, I guess it maybe here to post the issue.

Below is the wdio.conf.js file I'm using

const os = require("os");
const path = require("path");
const { spawn, spawnSync } = require("child_process");

// keep track of the `tauri-driver` child process
let tauriDriver;

const application = path.resolve(
  process.cwd(), // or __dirname if defined via shim
  "..",
  "..",
  "src-tauri",
  "target",
  "release",
  "tauri-app-selenium.exe"
);

exports.config = {
  hostname: "127.0.0.1", // ensure WDIO connects to tauri-driver
  port: 4444,
  path: "/",
  specs: ["./test/specs/**/*.js"],
  maxInstances: 1,
  capabilities: [
    {
      browserName: "wry", // custom browser name for tauri-driver
      maxInstances: 1,
      "tauri:options": {
        application: application,
      },
    },
  ],
  reporters: ["spec"],
  framework: "mocha",
  mochaOpts: {
    ui: "bdd",
    timeout: 60000,
  },

  // Build the rust project since we expect the binary to exist
  onPrepare: () => spawnSync("pnpm", ["tauri", "build"], { stdio: "inherit" }),

  // Start `tauri-driver` before the session begins so that we can proxy webdriver requests
  beforeSession: () =>
    (tauriDriver = spawn(
      path.resolve(os.homedir(), ".cargo", "bin", "tauri-driver"),
      [],
      { stdio: [null, process.stdout, process.stderr] }
    )),

  // Clean up the `tauri-driver` process when the session ends
  afterSession: () => tauriDriver.kill(),
};
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

No branches or pull requests

1 participant