Created
May 11, 2016 07:12
-
-
Save daipresents/b211d3a3cf47908e87f0766f846bd73d to your computer and use it in GitHub Desktop.
WebDriver+RSpecで、壮絶に、受け入れテスト結果を検証する方法例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @driver.find_element(:xpath, "/html/body/div/a").text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| verify { (@driver.find_element(:xpath, "/html/body/div/a").text).should == "こんにちは、藤原さん" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def verify(&blk) | |
| yield | |
| rescue ExpectationNotMetError => ex | |
| @verification_errors << ex | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| after(:each) do | |
| @driver.quit | |
| @verification_errors.should == [] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def element_present?(how, what) | |
| @driver.find_element(how, what) | |
| true | |
| rescue Selenium::WebDriver::Error::NoSuchElementError | |
| false | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment