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
| require 'rubygems' | |
| require 'watir-webdriver' | |
| require 'selenium-webdriver' | |
| def wait_for_new_handle(original_handles, driver) | |
| handles = nil | |
| wait = Selenium::WebDriver::Wait.new(:timeout => 10) | |
| wait.until do | |
| handles = driver.wd.window_handles | |
| handles.size == original_handles.size + 1 |
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
| require 'rubygems' | |
| require 'watir-webdriver' | |
| require 'selenium-webdriver' | |
| def wait_for_new_handle(original_handles, driver) | |
| handles = nil | |
| wait = Selenium::WebDriver::Wait.new(:timeout => 10) | |
| wait.until do | |
| handles = driver.wd.window_handles | |
| handles.size == original_handles.size + 1 |
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
| Scenario: Last name is required | |
| Given I am on the page to be tested | |
| When I leave the last name blank | |
| Then I should see an error message with "Last name is required" |
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
| org.jruby.Ruby.getCacheMap()Lorg/jruby/runtime/CacheMap; (Java::JavaLang::NoSuchMethodError) | |
| MixologyService.clearCache(MixologyService.java:116) | |
| MixologyService.add_module(MixologyService.java:84) |
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
| protected static void clearCache(RubyModule klass, RubyModule module) { | |
| List<String> methodNames = new ArrayList<String>(module.getMethods().keySet()); | |
| for (Iterator iter = methodNames.iterator(); iter.hasNext();) { | |
| String methodName = (String) iter.next(); | |
| klass.getRuntime().getCacheMap().remove(klass.searchMethod(methodName)); | |
| } | |
| } |
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 do |scenario| | |
| if scenario.failed? | |
| name = "error#{Time.now}.png" | |
| @current_page.save_screenshot name | |
| embed name, 'image/png' | |
| end | |
| # do your other stuff | |
| 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
| RSpec::Matchers.define :have_element_named do |expected| | |
| match do |page| | |
| page.respond_to?("#{expected.to_s}_element") and page.send "#{expected.to_s}?" | |
| end | |
| failure_message_for_should do |page| | |
| "Expected the page to have an element named '#{expected.to_s}'" | |
| end | |
| failure_message_for_should_not do |page| |
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
| # spec_helper.rb | |
| require 'rspec' | |
| require 'watir-webdriver' | |
| require 'page-object' | |
| require 'page-object/page_factory' | |
| require 'require_all' | |
| require_all 'lib/pages' | |
| RSpec.configure do |config| |
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
| package com.leandog.puppies.data; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.net.MalformedURLException; | |
| import java.net.URL; | |
| import android.graphics.drawable.Drawable; | |
| public class ImageLoader { |
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
| class MyPage | |
| include PageObject | |
| expected_title('the title I need to look for') | |
| def initialize_page | |
| has_expected_title? | |
| end | |
| end |