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

Behatを使ってWordPressの構成をテストする

 Behatを使ってWordPressの構成をテストする

PHPカンファレンス 2016のスライドです。

Takayuki Miyauchi

November 03, 2016
Tweet

More Decks by Takayuki Miyauchi

Other Decks in Technology

Transcript

  1. Scenario: wp say <string> 
 When I run `wp say

    hello` Then STDOUT should be: ``` Success: hello ``` 81$-*ίϚϯυͷςετίʔυͷྫ
  2. features/ !"" 01-login.feature !"" 02-responsive.feature !"" 03-session.feature !"" 04-mouseover.feature !""

    05-screenshot.feature !"" 06-form.feature GFBUVSFͱ͍͏ϑΝΠϧ͸ςετɻ
  3. ςετͷجຊతͳจ๏ Feature: Button Tests Scenario: I should see "Hello" Given

    I am on "/" When I press "#button" Then I should see "Hello" Scenario: ... ...
  4. Scenario: Showing the Homepage When I am on "/" Then

    I should see "Welcome" ΋͠ 8IFO ͳΒ 5IFO Ͱ͋Δ΂͖
  5. Scenario: Click a button Given I am on "/" When

    I push ".button" Then I should see "Welcome" (JWFO͸લఏͱͳΔ৚݅
  6. Scenario: Showing the Homepage When I am on "/" And

    I push ".button" Then I should see "Welcome" And I should see "Hello World" "OEͰෳ਺ࢦఆ͕ՄೳͰ͢ɻ
  7. @javascript Scenario: Login as Administrator When I login as the

    "administrator" role And I am on "/" Then I should see "Howdy, admin" When I logout And I am on "/" Then I should not see "Howdy, admin" ϩάΠϯϢʔβʔʹରͯ͠؅ཧόʔ͕දࣔ͞Ε͍ͯΔ͔ʁ ϩάΞ΢τͨ࣌͠ʹඇදࣔʹͳ͍ͬͯΔ͔ʁ
  8. @javascript Scenario: PC and Mobile Given I login as the

    "administrator" role And I am on "/wp-admin/" When the screen size is 1440x900 Then I should see "Dashboard" \
 in the "#adminmenu" element When the screen size is 320x400 Then I should not see "Dashboard" \
 in the "#adminmenu" element ϞόΠϧͰ؅ཧը໘ͷϝχϡʔ͕ඇදࣔʹͳ͍ͬͯΔ͔ʁ
  9. @javascript Scenario: PC and Mobile Given I login as the

    "administrator" role And I am on "/wp-admin/" When I am on "/" Then I should see "Welcome" When I am on "/wp-admin/plugins.php" Then I should see "Contact Form 7" ηογϣϯΛ࣋ͬͯา͘͜ͱ΋Ͱ͖·͢ɻ
  10. @javascript Scenario: I hover over the specific element Given the

    screen size is 1440x900 And I login as the "administrator" role And I am on "/" When I hover over the \ "#wp-admin-bar-my-account" element And I wait for 3 seconds Then I should see "Edit My Profile" +BWB4DSJQUͷNPVTFPWFSͷςετ
  11. @javascript Scenario: I hover over the specific element Given the

    screen size is 1440x900 And I login as the "administrator" role And I am on "/" When I hover over the \ "#wp-admin-bar-my-account" element And I wait for 3 seconds Then I should see "Edit My Profile" And take a screenshot and save it to \ "~/Desktop/screenshot-1.png" εΫϦʔϯγϣοτ΋ࡱΕ·͢ɻ
  12. @javascript Scenario: Send message from contact form Given I am

    on "/contact" When I fill in the following: | your-name | miya | | your-email | [email protected] | | your-subject | Hello | | your-message | ͜Μʹͪ͸ʂ | And I press "Send" And I wait for 3 seconds Then I should see "Thank you" ϑΥʔϜͷςετ΋؆୯