Material-ui React Component を WebdriverIO react$ で取得してみたら失敗した → できた
2019/09/06 追記
できました。詳細はここに
https://qiita.com/r315dr/items/bf12c70256c22c81c5e5
はじめに
WebdriverIOのBlogにReact Selectorsの話が出ていたので試す。
Material-uiのコンポーネントを取得してみようと思う。
ソースはここに置く
環境
- Mac
- Next.js
- Material-ui
- WebdriverIO
Getting Started
next.js with material-ui
Next.jsのGithubにはExamplesが豊富にあるので、探す。
Material-uiを見てみると、Material-uiの方をみろとあるので、こっちを見る。
書かれている通り、ソースのダウンロード&npm install
&npm run dev
して、http://localhost:3000 にアクセス
install WebdriverIO
先ほどのディレクトリのまま、WebdriverIOをGetting Startedを参考にインストールする。
- サービスはSelenium-Standaloneを選択した
- baseURLは
http://localhost:3000
いざテスト
テストコード
test/specs/basic.js
describe('material-ui component', () => {
it('go to about page and back main page', () => {
browser.url('/'); //baseURLで指定したのがここで活きる
browser.$('=Go to the about page').click(); //リンク名Selector
const button = browser.react$('Button'); //React Selector
button.waitForExist(5000);
button.click();
browser.$('=Go to the about page').waitForExist(5000);
});
});
結果
test/specs/basic.js
describe('material-ui component', () => {
it('go to about page and back main page', () => {
browser.url('/'); //baseURLで指定したのがここで活きる
browser.$('=Go to the about page').click(); //リンク名Selector
const button = browser.react$('Button'); //React Selector
button.waitForExist(5000);
button.click();
browser.$('=Go to the about page').waitForExist(5000);
});
});
失敗・・・
console抜粋
[0-0] Error in "material-ui component go to about page and back main page"
element ("Button") still not existing after 5000ms
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:13
Author And Source
この問題について(Material-ui React Component を WebdriverIO react$ で取得してみたら失敗した → できた), 我々は、より多くの情報をここで見つけました https://qiita.com/r315dr/items/356c51442b42d6eeb3f1著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .