Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TestCaféでE2Eテスト!

 TestCaféでE2Eテスト!

Azusa Okamoto

May 28, 2022
Tweet

More Decks by Azusa Okamoto

Other Decks in Programming

Transcript

  1. TestCaféとは? const const homeTab = ( ). ( ). (

    ); = . ( ). ( ); . ( . ). ( ); tabs homeTab tabs Selector find nth child nth expect eql '#root' 'div' 'a' 'Home' 2 0 awaitt innerText (例)
  2. (例) // innerText // value const const = . (

    ). ; = . ( ). ; pageTitle pageContents inputForm form $ formName child find 'h1' `input[name=" "]` innerText value { }
  3. click() (例) const const = ( ). ( ). (

    ); = . ( ). ( ); . ( ); navTabs formTab navTabs formTab Selector find nth child nth click '#root' 'div' 'a' 2 1 await t
  4. click() (例) const true . await inputForm form inputForm =

    ( ); find typeText `input[name="name"]` 'テスト花子' . ( , , : ); t { } replace
  5. click() (例) // クラス名で指定することも可能 // await t.expect(対象要素).eql(想定している結果); const const =

    ( ). ( ); = . ( ). ; . ( ). ( ); modal modalText modal modalText Selector child child expect eql '.test-modal' 'div' 'p' 'Modalが出現!!' innerText t await
  6. click() (例) // ok() // notOk() await await . (

    . ( )). (); . ( . ( )). (); t t expect hasAttribute ok expect hasAttribute notOk submitBtn submitBtn 'disabled' 'disabled'
  7. click() (例) await . ( : , : ); t

    takeScreenshot { 'result/checkHomeTabContents.png' } path fullPage true