Right-Click and Double-Click Steps
Use this when the feature hides behind a gesture, like a context menu or a double-click to open. With strict: true the step takes only that gesture: a plain click on the file is blocked and shakes the popover instead of doing something else.
Files
const driverObj = driver({
showButtons: ["close"],
onElementMissing: "previousAction",
steps: [
{
element: "#file",
advanceOn: { event: "contextmenu", strict: true },
allowedElements: ".file-menu",
popover: {
title: "Copy the file",
instruction: "Right-click <b>report.pdf</b>.",
},
},
{
element: ".file-menu [data-action=duplicate]",
waitForElement: 500,
advanceOn: "click",
allowedElements: ".file-menu",
popover: {
title: "Duplicate it",
instruction: "Choose <b>Duplicate</b>.",
},
},
{
element: "#file-copy",
waitForElement: 1000,
advanceOn: { event: "dblclick", strict: true },
popover: {
title: "Open the copy",
instruction: "Double-click <b>report copy.pdf</b>.",
},
},
],
});
driverObj.drive();- Your app’s own
contextmenuanddblclickhandlers run as usual. The step completes after them. strictblocks the other clicks on the element only. Clicks inallowedElements, like the menu, still work.- iOS Safari never fires
contextmenu. On touch devices, accept another event too, like["contextmenu", "dblclick"], or offer a button that opens the same menu.
Uses: advanceOn with strict, allowedElements, onElementMissing
driver.js