Set static path for karma runner

251 Views Asked by At

I was able prepare my OpenUI5 app for testing. I am having issue with the working directory for tests, because for my test I need to use a pre-populated sqlite3 database. For testing I use chrome with parameters --user-data-dir="C:\tmp" --profile-directory="karma", and I can place this file into chrome profile path. But I am not able to do this with karma, because karma always start with randomly generated id in path (karma-xxxxxx).

I am trying run custom browser config, with above chrome parameters, but it does not work.

module.exports = function(config) {
    "use strict";

    var chromeFlags = [
        "--window-size=1280,1024",
        "--disable-web-security",
        "--allow-file-access-from-files",
        '--user-data-dir="C:\\tmp"',
        '--profile-directory="karma"'
    ];

    config.set({

        basePath: '',
        ui5: {
            type: "application",
            preload: 'async',
            animation: 'false',
            paths: {
                webapp: "www", // application
            }
        },

        frameworks: ["ui5"],

        browsers: ["CustomChrome"],

        browserConsoleLogOptions: {
            level: "error"
        },

        customLaunchers: {
            CustomChrome: {
                base: "Chrome",
                flags: chromeFlags
            },
            CustomChromeHeadless: {
                base: "ChromeHeadless",
                flags: chromeFlags
            }
        },

    });
};

with this config, chrome always start like this, so automatic testing does not work:

enter image description here

0

There are 0 best solutions below