Webdriverio: W3C ๋ชจ๋“œ์—์„œ ๋น„ W3C ํ‘œ์ค€ ๋ช…๋ น์„ ํ˜ธ์ถœํ•  ์ˆ˜ ์—†์Œ

์— ๋งŒ๋“  2019๋…„ 06์›” 10์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: webdriverio/webdriverio

ํ™˜๊ฒฝ(๋‹ค์Œ ์ •๋ณด๋ฅผ ์ž‘์„ฑํ•˜์‹ญ์‹œ์˜ค):

  • WebdriverIO ๋ฒ„์ „: 4.14.4
  • ๋ชจ๋“œ: WDIO ํ…Œ์ŠคํŠธ ๋Ÿฌ๋„ˆ
  • WDIO Testrunner์ธ ๊ฒฝ์šฐ sync/async: sync๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  • Node.js ๋ฒ„์ „: 10.15.0
  • NPM ๋ฒ„์ „: 6.4.1
  • ๋ธŒ๋ผ์šฐ์ € ์ด๋ฆ„ ๋ฐ ๋ฒ„์ „: google-chrome-stable_75.0.3770.80-1
  • ํ”Œ๋žซํผ ์ด๋ฆ„ ๋ฐ ๋ฒ„์ „: LINUX
  • ** "wdio-cucumber-framework": "^1.1.0", "wdio-selenium-standalone-service": "0.0.10",

WebdriverIO ๊ตฌ์„ฑ
WebdriverIO ๊ตฌ์„ฑ์„ ๊ตฌ์„ฑํ•œ ๋ฐฉ๋ฒ•์˜ ์˜ˆ

const path = require("path");

const isDebugMode = process.env.DEBUG === "true";

const chrome = 
    {
        browserName: "chrome",
        chromeOptions: {
            args: ["--window-size=1366,768"]
        }
    };

var capabilities = [chrome];

if(process.env.RUNNING_IN_DOCKER)
{
    capabilities = 
        [
            {
                browserName: "chrome",
                chromeOptions: {
                    args: ["--headless", "--window-size=1366,768"]
                }
            }
            // TO DO: Add headless Firefox see docker-compose.yml
        ];
} else if(process.env.ALL_BROWSERS)
{
    capabilities = 
        [
            chrome,
            {
                // set protected mode to the same value across all four zones in tools-> internet options -> security
                // also make sure zoom level is 100%
                browserName: "internet explorer"
            }
        ];
}

exports.config = {
    debug:  isDebugMode,
    execArgv: isDebugMode ? ['--inspect=9299'] : [],
    sync: true,
    maxInstances: 1,
    //maxInstances: isDebugMode ? 1 : 10,
    // Use selenium standalone server locally so we don't have a seperate selenium server in a seperate command prompt
    // Use the selenium grid via docker on TC
    services: process.env.RUNNING_IN_DOCKER ? [] : ["selenium-standalone"],
    seleniumLogs: "./logs",

    specs: [
        "./features/**/*.feature"
    ],

    exclude: [
        "./features/**/topic-page.feature"
    ],

    capabilities: capabilities,

    logLevel: "verbose",
    coloredLogs: true,
    screenshotPath: "./errorShots/",
    baseUrl: "https://*********/",
    reporters: process.env.RUNNING_IN_DOCKER ? ["spec", "teamcity"] : ["spec"],

    // Use BDD with Cucumber
    framework: "cucumber",
    cucumberOpts: {
        compiler: ["js:babel-register"], // Babel so we can use ES6 in tests
        require: [
            "./steps/given.js",
            "./steps/when.js",
            "./steps/then.js"
        ],
        tagExpression: "not @pending", // See https://docs.cucumber.io/tag-expressions/
        timeout: 30000
    },

    // Set up global asssertion libraries
    before: function before() {
        const chai = require("chai");
        global.expect = chai.expect;
        global.assert = chai.assert;
        global.should = chai.should();
    },
}

๋ฒ„๊ทธ ์„ค๋ช…
Chrome ๋ฐ ChromeDriver๋ฅผ ์—…๊ทธ๋ ˆ์ด๋“œํ•œ ํ›„ ๋‹ค์Œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Error: Promise was rejected with the following reason: unknown command: Cannot call non W3C standard command while in W3C mode at elementIdDisplayed("e88a07f5-2ca3-42ad-b458-3d66797b37f0") - isVisible.js:71:55
ChromeDriver 75.0.3770.8 http://chromedriver.chromium.org/downloads ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๋ณด๋ฉด
"๊ฐ€์žฅ ๋ˆˆ์— ๋„๋Š” ๋ณ€๊ฒฝ ์‚ฌํ•ญ์€ ์ด์ œ ChromeDriver๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ W3C ํ‘œ์ค€ ํ˜ธํ™˜ ๋ชจ๋“œ์—์„œ ์‹คํ–‰๋œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค."๋ผ๊ณ  ์–ธ๊ธ‰๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ChromeOptions w3c: false ๋ฅผ ์ง€์ •ํ•˜์—ฌ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ์ง€๋งŒ ์ด๊ฒƒ์ด ์˜ฌ๋ฐ”๋ฅธ ์ ‘๊ทผ ๋ฐฉ์‹์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์–ด๋”˜๊ฐ€์— "๋น„ w3c ํ‘œ์ค€" ๋ช…๋ น์„ ํ˜ธ์ถœํ•˜๋Š” ๋ฌด์–ธ๊ฐ€๊ฐ€ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์œผ๋ฉฐ webdriverio์˜ ์–ด๋”˜๊ฐ€์— ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.

์žฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด
์œ„์˜ ๋‚ด์šฉ์œผ๋กœ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๊ณ  npm test๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ƒ๋˜๋Š” ํ–‰๋™
ํ…Œ์ŠคํŠธ๋Š” Cannot call non W3C standard command while in W3C mode ์˜ค๋ฅ˜ ์—†์ด ์‹คํ–‰๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์ด๊ฒƒ์€ ํฌ๋กฌ์˜ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ ์˜ต์…˜์„ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์˜ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. Chrome 75๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ W3C์™€ ํ˜ธํ™˜๋˜๋ฉฐ JSONWP๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด W3C๋ฅผ false๋กœ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค(๋ฆด๋ฆฌ์Šค ๋…ธํŠธ์— ์–ธ๊ธ‰๋จ)

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ต์…˜์„ ์ œ๊ณตํ•˜์‹ญ์‹œ์˜ค.

'goog:chromeOptions': {
        'w3c': false,
        args: ["--headless", "--window-size=1366,768"]
    },

WebdriverIO ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ ์˜ต์…˜์„ ์ •์˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๋ฌธ์ œ์ด๋ฏ€๋กœ ์ง€๊ธˆ์€ ๋‹ซ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  3 ๋Œ“๊ธ€

์ด๊ฒƒ์€ ํฌ๋กฌ์˜ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ ์˜ต์…˜์„ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์˜ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. Chrome 75๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ W3C์™€ ํ˜ธํ™˜๋˜๋ฉฐ JSONWP๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด W3C๋ฅผ false๋กœ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค(๋ฆด๋ฆฌ์Šค ๋…ธํŠธ์— ์–ธ๊ธ‰๋จ)

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ต์…˜์„ ์ œ๊ณตํ•˜์‹ญ์‹œ์˜ค.

'goog:chromeOptions': {
        'w3c': false,
        args: ["--headless", "--window-size=1366,768"]
    },

WebdriverIO ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ ์˜ต์…˜์„ ์ •์˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๋ฌธ์ œ์ด๋ฏ€๋กœ ์ง€๊ธˆ์€ ๋‹ซ์Šต๋‹ˆ๋‹ค.

@wwebcreation ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋งž์Šต๋‹ˆ๋‹ค. W3C๋ฅผ false๋กœ ์„ค์ •ํ•˜๋ผ๋Š” ๋ฌธ๊ตฌ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†๋Š” ๋ฆด๋ฆฌ์Šค ๋…ธํŠธ๋ฅผ ์•Œ๋ ค ์ฃผ์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?

๊ฐ์‚ฌ ํ•ด์š”

@wswebcreation ๊ท€ํ•˜์˜ ์˜๊ฒฌ์„ 100๋ฒˆ ์ถ”์ฒœํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ๊ทธ๋ ‡๊ฒŒ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ €๋Š” NightwatchJS์—์„œ ์™”์œผ๋ฉฐ 2์ผ ๋™์•ˆ ์ด ์˜ค๋ฅ˜๋ฅผ ์กฐ์‚ฌํ•ด ์™”์Šต๋‹ˆ๋‹ค. dockerized ์…€๋ ˆ๋Š„ ํ—ˆ๋ธŒ์—์„œ ํ—ค๋“œ๋ฆฌ์Šค chromedriver๋ฅผ ์‹คํ–‰ํ•˜๋ ค๊ณ ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‚ด nightwatch.json ํŒŒ์ผ์— ํ•ด๋‹น ์Šค๋‹ˆํŽซ์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์„ ์œ„ํ•œ ์ฐธ์กฐ๋ฅผ ์œ„ํ•ด ๋‚ด ํŒŒ์ผ์˜ ํ•ด๋‹น ์„น์…˜์€ ์ด์ œ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

"chromeOptions": {
  "w3c": false,
  "args": [
    "--no-sandbox",
    "--headless",
    "--window-size=1920x1080"
  ]
}
์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰