/** @odoo-module **/ import { expect, test } from "@odoo/hoot"; import { waitFor } from "@odoo/hoot-dom"; import { Component, xml } from "@odoo/owl"; import { BarcodeScanner } from "@barcodes/components/barcode_scanner"; import { contains, mountWithCleanup } from "@web/../tests/web_test_helpers"; test.tags("desktop"); test("Display notification for media device permission on barcode scanning", async () => { navigator.mediaDevices.getUserMedia = function () { return Promise.reject(new DOMException("", "NotAllowedError")); }; class BarcodeScan extends Component { static template = xml`
`; static components = { BarcodeScanner }; static props = ["*"]; } await mountWithCleanup(BarcodeScan); await contains("a.o_mobile_barcode").click(); await waitFor(".modal-body:contains(camera)"); expect(".modal-body").toHaveText( "Unable to access camera\nCould not start scanning. Odoo needs your authorization first." ); });