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

web: Make element selectors in browser tests valid for BiDi #18133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("ExternalInterface", () => {
it("loads the test", async () => {
await openTest(browser, "integration_tests/external_interface");
await injectRuffleAndWait(browser);
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await playAndMonitor(
browser,
player,
Expand Down Expand Up @@ -108,7 +108,7 @@ ExternalInterface.objectID: "flash_name"
});

it("responds to 'log'", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute(
(player) =>
player.log("Hello world!", {
Expand Down Expand Up @@ -136,7 +136,7 @@ ExternalInterface.objectID: "flash_name"
});

it("returns a value", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
const returned = await browser.execute(
(player) => player.returnAValue(123.4),
player,
Expand All @@ -155,7 +155,7 @@ ExternalInterface.objectID: "flash_name"
});

it("calls a method with delay", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute(
(player) =>
player.callMethodWithDelay("window.RuffleTest.set", true),
Expand All @@ -179,7 +179,7 @@ ExternalInterface.objectID: "flash_name"
// [NA] Broken on Ruffle at time of writing
it.skip("calls a reentrant JS method", async () => {
// JS -> Flash -> JS within one call
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
const actualValue = await browser.execute((player) => {
player.callMethodImmediately("window.RuffleTest.set", {
nested: { object: { complex: true } },
Expand Down Expand Up @@ -211,7 +211,7 @@ ExternalInterface.objectID: "flash_name"

it("calls a reentrant Flash method", async () => {
// Flash -> JS -> Flash within one call
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute((player) => {
player.callMethodWithDelay("window.RuffleTest.log", "Reentrant!");
}, player);
Expand All @@ -236,7 +236,7 @@ log called with 1 argument
});

it("supports a JS function as name", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute((player) => {
player.callMethodWithDelay(
"function(name){window.RuffleTest.set(name)}",
Expand All @@ -263,7 +263,7 @@ log called with 1 argument
});

it("supports calling a method that doesn't exist", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute((player) => {
player.callMethodWithDelay("does.not.exist");
}, player);
Expand All @@ -283,7 +283,7 @@ log called with 1 argument
});

it("doesn't enforce Strict Mode", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute((player) => {
player.callMethodWithDelay(
"function(){return aPropertyThatDoesntExist = 'success!'}",
Expand All @@ -305,7 +305,7 @@ log called with 1 argument
});

it("allows overriding a Ruffle method", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");
await browser.execute((player) => {
player.addAnotherCallback("isPlaying", "isPlaying from EI");
}, player);
Expand All @@ -325,7 +325,7 @@ log called with 1 argument
});

it("allows redefining a method", async () => {
const player = await browser.$("<ruffle-object>");
const player = await browser.$("ruffle-object");

// First definition
await browser.execute((player) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("Key up and down events work", () => {
loadJsAPI("/test/integration_tests/keyboard_input/test.swf");

it("'a' key is recognised", async () => {
const player = await browser.$("<ruffle-player>");
const player = await browser.$("ruffle-player");
await player.click();
// Extra safety click in case there's a modal
await player.click();
Expand All @@ -30,7 +30,7 @@ event.keyCode = 65
});

it("enter key is recognised", async () => {
const player = await browser.$("<ruffle-player>");
const player = await browser.$("ruffle-player");
await player.click();

await browser.keys([Key.Enter]);
Expand Down
2 changes: 1 addition & 1 deletion web/packages/selfhosted/test/js_api/exposed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Exposed RufflePlayer methods/properties", () => {
loadJsAPI();

it("exposed API has not changed", async () => {
const player = await browser.$("<ruffle-player>");
const player = await browser.$("ruffle-player");
const keys = await browser.execute(async (playerElement) => {
// https://github.com/webdriverio/webdriverio/issues/6486
const player = playerElement as unknown;
Expand Down
2 changes: 1 addition & 1 deletion web/packages/selfhosted/test/js_api/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("RufflePlayer.load", () => {
loadJsAPI();

it("loads and plays a URL", async () => {
const player = await browser.$("<ruffle-player>");
const player = await browser.$("ruffle-player");
await browser.execute(async (playerElement) => {
// https://github.com/webdriverio/webdriverio/issues/6486
const player = playerElement as unknown as Player;
Expand Down
2 changes: 1 addition & 1 deletion web/packages/selfhosted/test/js_api/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("RufflePlayer.metadata", () => {
loadJsAPI("/test_assets/example.swf");

it("has metadata after load", async () => {
const player = await browser.$("<ruffle-player>");
const player = await browser.$("ruffle-player");
const metadata = await browser.execute(
// https://github.com/webdriverio/webdriverio/issues/6486
(player) => (player as unknown as Player).metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Flash inside frame with injected ruffle", () => {
it("polyfills inside a frame", async () => {
await injectRuffleAndWait(browser);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -37,7 +37,7 @@ describe("Flash inside frame with injected ruffle", () => {
// And finally, check
await browser.switchToFrame(null);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Flash inside frame with provided ruffle", () => {

it("polyfills inside a frame", async () => {
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -36,7 +36,7 @@ describe("Flash inside frame with provided ruffle", () => {
// And finally, check
await browser.switchToFrame(null);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Embed tag", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Embed with case-insensitive MIME type", () => {

it("Polyfills", async () => {
await injectRuffleAndWait(browser);
await browser.$("<ruffle-embed />").waitForExist();
await browser.$("ruffle-embed").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -25,7 +25,7 @@ describe("Embed with case-insensitive MIME type", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Embed without type attribute", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Flash inside iframe with injected ruffle", () => {
it("polyfills inside an iframe", async () => {
await injectRuffleAndWait(browser);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -36,7 +36,7 @@ describe("Flash inside iframe with injected ruffle", () => {
// And finally, check
await browser.switchToFrame(null);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("iframe onload", () => {

it("runs the iframe onload event", async () => {
await injectRuffleAndWait(browser);
await browser.$("<div />").waitForExist();
await browser.$("div").waitForExist();

const actual = await browser.$("#container").getHTML(false);
const expected = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Flash inside iframe with provided ruffle", () => {

it("polyfills inside an iframe", async () => {
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -35,7 +35,7 @@ describe("Flash inside iframe with provided ruffle", () => {
// And finally, check
await browser.switchToFrame(null);
await browser.switchToFrame(await browser.$("#test-frame"));
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Object with case-insensitive MIME type", () => {

it("Polyfills", async () => {
await injectRuffleAndWait(browser);
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -25,7 +25,7 @@ describe("Object with case-insensitive MIME type", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Object with case-insensitive clsid", () => {

it("Polyfills", async () => {
await injectRuffleAndWait(browser);
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -25,7 +25,7 @@ describe("Object with case-insensitive clsid", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object with clsid and embed", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
4 changes: 2 additions & 2 deletions web/packages/selfhosted/test/polyfill/object_data/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Object with only data attribute", () => {

it("Polyfills", async () => {
await injectRuffleAndWait(browser);
await browser.$("<ruffle-object />").waitForExist();
await browser.$("ruffle-object").waitForExist();

const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
Expand All @@ -25,7 +25,7 @@ describe("Object with only data attribute", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object tag", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object with another object tag", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object using classid with another object tag without classid", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object tag", () => {
it("Plays a movie with flashvars", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
`// _level0.a
1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object tag", () => {
it("Plays a movie with flashvars", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
`// _level0.a
1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object for old IE must work everywhere", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object without type attribute", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-embed />"),
await browser.$("#test-container").$("ruffle-embed"),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Object without type and classid attributes", () => {
it("Plays a movie", async () => {
await playAndMonitor(
browser,
await browser.$("#test-container").$("<ruffle-object />"),
await browser.$("#test-container").$("ruffle-object"),
);
});
});
Loading