Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: wdio conf template refactoring #14

Open
heimwege opened this issue Jun 6, 2024 · 0 comments
Open

Discussion: wdio conf template refactoring #14

heimwege opened this issue Jun 6, 2024 · 0 comments

Comments

@heimwege
Copy link

heimwege commented Jun 6, 2024

Hey 👋🏻

@vobu I have to admit I kind of struggled enhancing the in place functions of the config file. What are your thought about using explicit functions in the template to simplify things for my future self?

e.g.

//this is just a sample in case env params are disjoint, don't judge me 🐱 
function getBrowserArgs () {
    //this was my enhancement for the CI
    if (process.argv.includes("--ci")) {
        return ["--disable-gpu", "--disable-dev-shm-usage", "--headless", "--window-size=1440,800", "--disable-software-rasterizer"];
    }
    if (process.argv.includes("--headless")) {
        return ["--headless", "--window-size=1440,800"];
    }
    if (process.argv.includes("--debug")) {
        return ["--window-size=1440,800", "--auto-open-devtools-for-tabs"];
    }
    return ["--window-size=1440,800"];
}

...
"goog:chromeOptions": {
                args: getBrowserArgs()

instead of

"goog:chromeOptions": {
                args:
                    //I would have had to enhance this which is kind of unreadable in the end 🙈 
                    process.argv.indexOf("--headless") > -1
                        ? ["--headless=new"]
                        : process.argv.indexOf("--debug") > -1
                        ? ["window-size=1440,800", "--auto-open-devtools-for-tabs"]
                        : ["window-size=1440,800"]
            },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant