How to set Chrome's language in JS Jest?

How can I set Chrome browser’s language in JS Jest?

Hi Emma,

You can set the language forcefully on JavaScript, the script below can be used:

await page.evaluateOnNewDocument(() => {
    Object.defineProperty(navigator, "language", {
        get: function() {
            return "bn-BD";
        }
    });
    Object.defineProperty(navigator, "languages", {
        get: function() {
            return ["bn-BD", "bn"];
        }
    });
});