LoginSignup
4
5

More than 5 years have passed since last update.

できるだけコピペでWindows + WebDriverIO + Edge でテスト

Last updated at Posted at 2018-01-25

概要

Widows環境でWebDriverIOを使ってEdgeでE2Eテストする。

環境

  • Windows10 , 1709, 16299.192

javaインストール

これだけは java.com からダウンロードしてインストール

ディレクトリ作成

> mkdir wdio-test
> cd wdio-test

npm init

  • コマンド入れて、全部デフォルトで。
> npm init

webdriverIO 追加

> npm install webdriverio --save-dev

パスを通す

あとで、コマンドを使うとき楽するためにパスを通す

> path=.\node_modules\.bin;%PATH%

コンフィグ作成

  • とりあえず全部デフォルトで
> wdio

wdio-selenium-standalone-service 追加

> npm install wdio-selenium-standalone-service --save-dev

WebDriverインストール

> selenium-standalone install

wdio.conf.js 編集

  • wdioの capabilities の browserName の部分を "edge"に。
  • servicesに selenium-standaloneを追加

    capabilities: [{
        ...
        browserName: 'edge'
    }],
    ...
    services: ['selenium-standalone'],
    ...

テストファイル作成

  • test\specs\test.jsを作成
describe("Open browser", () => {
  it("open", () => {
    browser.url("https://google.jp");
  })
});

テスト

> wdio wdio.conf.js

Edgeが起動して、google.jpにアクセスできたらOK

package.jsonを編集して npm run test とするのが吉

"scripts": {
  "test": "wdio wdio.conf.js"
}
> npm run test

その他のブラウザ

chrome

  1. chromeのインストール
  2. browserNameのところを"chrome"に変更する

IE11

  1. browserNameのところを"internet explorer"に変更する
  2. インターネットオプション → セキュリティ
    • インターネット、ローカルイントラネット、信頼済みサイト、制限付きサイトで「保護モードを有効にする」をONにする
  • IEはテストが終わってもクローズしない

参考

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5