|
| 1 | +import { injectRuffleAndWait, openTest, playAndMonitor } from "../../utils.js"; |
| 2 | +import { expect, use } from "chai"; |
| 3 | +import chaiHtml from "chai-html"; |
| 4 | + |
| 5 | +use(chaiHtml); |
| 6 | + |
| 7 | +describe("Context Menu", () => { |
| 8 | + it("(quirks mode) load the test", async () => { |
| 9 | + await browser.setWindowSize(1000, 1000); |
| 10 | + |
| 11 | + await openTest( |
| 12 | + browser, |
| 13 | + "integration_tests/context_menu_escaping_body", |
| 14 | + "index_quirks.html", |
| 15 | + ); |
| 16 | + await injectRuffleAndWait(browser); |
| 17 | + const player = await browser.$("<ruffle-object>"); |
| 18 | + await playAndMonitor(browser, player, "Loaded!\n"); |
| 19 | + |
| 20 | + // Dismiss hardware acceleration modal in Chrome |
| 21 | + await player.click(); |
| 22 | + await player.click(); |
| 23 | + }); |
| 24 | + |
| 25 | + it("(quirks mode) open context menu", async () => { |
| 26 | + const player = await browser.$("#objectElement"); |
| 27 | + |
| 28 | + await player.click({ x: -150, y: -150, button: "right" }); |
| 29 | + |
| 30 | + const menu = await player.$("#context-menu"); |
| 31 | + const menuLocation = await menu.getLocation(); |
| 32 | + expect(menuLocation.x).to.equal(50); |
| 33 | + expect(menuLocation.y).to.equal(50); |
| 34 | + |
| 35 | + // Dismiss the menu |
| 36 | + await player.click({ x: -151, y: -151 }); |
| 37 | + }); |
| 38 | + |
| 39 | + it("(no quirks mode) load the test", async () => { |
| 40 | + await openTest( |
| 41 | + browser, |
| 42 | + "integration_tests/context_menu_escaping_body", |
| 43 | + "index_no_quirks.html", |
| 44 | + ); |
| 45 | + await injectRuffleAndWait(browser); |
| 46 | + const player = await browser.$("<ruffle-object>"); |
| 47 | + await playAndMonitor(browser, player, "Loaded!\n"); |
| 48 | + |
| 49 | + // Dismiss hardware acceleration modal in Chrome |
| 50 | + await player.click(); |
| 51 | + await player.click(); |
| 52 | + }); |
| 53 | + |
| 54 | + it("(no quirks mode) open context menu", async () => { |
| 55 | + const player = await browser.$("#objectElement"); |
| 56 | + |
| 57 | + await player.click({ x: -150, y: -150, button: "right" }); |
| 58 | + |
| 59 | + const menu = await player.$("#context-menu"); |
| 60 | + const menuLocation = await menu.getLocation(); |
| 61 | + expect(menuLocation.x).to.equal(50); |
| 62 | + expect(menuLocation.y).to.equal(50); |
| 63 | + |
| 64 | + // Dismiss the menu |
| 65 | + await player.click({ x: -151, y: -151 }); |
| 66 | + }); |
| 67 | +}); |
0 commit comments