In odoo 17 I am trying to test a button that a implemented in the POS, I have some code but I would like to know If this is the correct way.
/** @odoo-module **/
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
import { Chrome } from "@point_of_sale/app/pos_app";
import { mount, nextTick } from "@web/../tests/helpers/utils";
QUnit.module("POS Custom Button Test", (hooks) => {
let testEnv;
hooks.beforeEach(async function () {
testEnv = await makeTestEnv();
});
QUnit.test("Renderiza el botón de nota de crédito en el POS", async function (assert) {
assert.expect(1);
// Montar Chrome, que maneja la interfaz general del POS
await mount(Chrome, { env: testEnv.env });
// Esperar al siguiente ciclo de renderizado
await nextTick();
// Verificar si el botón existe en la interfaz
assert.ok(
document.querySelector(".oa_l10n_ec_edi_pos.ReasonCreditNoteButton"),
"El botón de nota de crédito se muestra en la interfaz del POS."
);
});
});
I got the next error: The following modules are needed by other modules but have not been defined, they may not be present in the correct asset bundle:
Array [ "@point_of_sale/app/pos_app" ] and
The following modules could not be loaded because they have unmet dependencies, this is a secondary error which is likely caused by one of the above problems:
Array [ "@oa_l10n_ec_edi_pos/../tests/unit/credit_note_button_test" ]