Skip to content

Commit

Permalink
Make simple html test work
Browse files Browse the repository at this point in the history
  • Loading branch information
mtusnio committed Aug 24, 2024
1 parent ad80c69 commit dc3d908
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions browser_tests/popup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,11 @@ test("popup appears when hovering over text in plain html", async () => {

await utils.toggleExtension(worker)
await utils.wait(200)

await page.setViewport({ width: 1280, height: 720 });
await utils.wait(500)

await page.mouse.move(50, 10)
const exists = !! await page.waitForSelector("#zhongwen-window");
expect(exists).toBe(true)
})
1 change: 1 addition & 0 deletions browser_tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const EXTENSION_PATH = './';
async function setupBrowser() {
const browser = await puppeteer.launch({
headless: false,
devTools: true,
args: [
`--disable-extensions-except=${EXTENSION_PATH}`,
`--load-extension=${EXTENSION_PATH}`
Expand Down
2 changes: 1 addition & 1 deletion dict_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ function getTextFromSingleNode(node, selEndList, maxLength) {


function onMouseMove(mouseMove) {
console.log("Mouse Move");
console.log("Mouse Move", mouseMove);
if (mouseMove.target.nodeName === 'TEXTAREA' || mouseMove.target.nodeName === 'INPUT'
|| mouseMove.target.nodeName === 'DIV') {

Expand Down

0 comments on commit dc3d908

Please sign in to comment.