cheezy / page-object

Gem to implement PageObject pattern in watir-webdriver and selenium-webdriver
MIT License
653 stars 220 forks source link

version 2.1.1 killed appium? #419

Open eskignax opened 7 years ago

eskignax commented 7 years ago

Hello,

I have a project that test mobile app with Appium and page-object. Until the version 2.1.1 of page-object, everything was fine we just use that code to make it works together:

env.rb: $browser = Appium::Driver.new(desired_caps).start_driver

hook.rb: Before do @browser = $browser end

But with the version 2.1.1 the trick doesn't work anymore and now methods are not implemented:

log:

Selenium::WebDriver::Error::UnknownError: Method has not yet been implemented
(eval):1:in `process_watir_call'
./lib/pages/search_job_page.rb:9:in `search'
./features/step_definitions/search_steps.rb.rb:2:in `/^I make a dummy search$/'
./features/dummy_search.feature:5:in `When I make a dummy search'

class:

class SearchJobPage
  include PageObject

  text_field :what, id: 'what_input'
  text_field :where, id: 'where_input'
  button :job_search, xpath: '(//android.widget.Button)[0]'

  def search(data={})
    self.what= 'dummy'
    self.where= 'search'
    job_search
  end

end

Questions: Is this happen because of the drop of selenium-driver or there is a real bug behind ? How to avoid this error?

Thank you

cheezy commented 7 years ago

I will be looking into this tomorrow.

Sent from my iPhone

On Mar 14, 2017, at 8:41 AM, eskignax notifications@github.com wrote:

Hello,

I have a project that test mobile app with Appium and page-object. Until the version 2.1.1 of page-object, everything was fine we just use that code to make it works together:

env.rb: $browser = Appium::Driver.new(desired_caps).start_driver

hook.rb: Before do @browser = $browser end

But with the version 2.1.1 the trick doesn't work anymore and now methods are not implemented:

log:

Selenium::WebDriver::Error::UnknownError: Method has not yet been implemented (eval):1:in process_watir_call' ./lib/pages/search_job_page.rb:9:insearch' ./features/step_definitions/search_steps.rb.rb:2:in /^I make a dummy search$/' ./features/dummy_search.feature:5:inWhen I make a dummy search' class:

class SearchJobPage include PageObject

text_field :what, id: 'what_input' text_field :where, id: 'where_input' button :job_search, xpath: '(//android.widget.Button)[0]'

def search(data={}) self.what= 'dummy' self.where= 'search' job_search end

end

Questions: Is this happen because of the drop of selenium-driver or there is a real bug behind ? How to avoid this error?

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cheezy commented 7 years ago

I wrote a very simple example this morning that is working just fine with the latest page-object. Can you provide more details about the issue you are having - what it is trying to do when it fails? Here is the code from my example:

require 'spec_helper' require 'appium_lib'

class GooglePage include PageObject end

describe "Using Appium with PageObject" do it 'should work' do caps = {} caps['appiumVersion'] = '1.6.3' caps['deviceName'] = 'iPhone Simulator' caps['deviceOrientation'] = 'portrait' caps['platformVersion'] = '10.2' caps['platformName'] = 'iOS' caps['browserName'] = 'Safari' browser = Appium::Driver.new({caps: caps}).start_driver page = GooglePage.new(browser) page.navigate_to('http://google.com') end end

On Mar 14, 2017, at 7:41 AM, eskignax notifications@github.com wrote:

Hello,

I have a project that test mobile app with Appium and page-object. Until the version 2.1.1 of page-object, everything was fine we just use that code to make it works together:

env.rb: $browser = Appium::Driver.new(desired_caps).start_driver

hook.rb: Before do @browser = $browser end

But with the version 2.1.1 the trick doesn't work anymore and now methods are not implemented:

log:

Selenium::WebDriver::Error::UnknownError: Method has not yet been implemented (eval):1:in process_watir_call' ./lib/pages/search_job_page.rb:9:insearch' ./features/step_definitions/search_steps.rb.rb:2:in /^I make a dummy search$/' ./features/dummy_search.feature:5:inWhen I make a dummy search' class:

class SearchJobPage include PageObject

text_field :what, id: 'what_input' text_field :where, id: 'where_input' button :job_search, xpath: '(//android.widget.Button)[0]'

def search(data={}) self.what= 'dummy' self.where= 'search' job_search end

end

Questions: Is this happen because of the drop of selenium-driver or there is a real bug behind ? How to avoid this error?

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cheezy/page-object/issues/419, or mute the thread https://github.com/notifications/unsubscribe-auth/AACGKiNiTV8E6nsJjOCWpMi8h8wltcrwks5rlosMgaJpZM4MchQo.

eskignax commented 7 years ago

Hello Cheezy, thank you for your time.

I can see it's work when testing on a browser on mobile phone. The problem is when I am testing a mobile application.

I make this project to train my skill in mobile app testing: https://github.com/eskignax/indeed_testing_app

login_page.rb:

 element :login_without_account, 'android.view.View', id: 'appSignInDismiss'
 button :create_account, id: 'appSignInCreate'

with page-object 2.0.0 calling login_without_accountworks calling create_account raise the error

 Selenium::WebDriver::Error::NoSuchElementError: An element could not be located on the page using the given search parameters.

Which is normal since the element doesn't exist in that page. (but if the element exist, it works)

with page-object 2.1.1 calling login_without_account raise the error:

NameError: undefined local variable or method `android' for #<Watir::Browser:0x..f8d6a464e closed=false>
./lib/pages/login_page.rb:8:in `login_guest'
./features/step_definitions/user_steps.rb:2:in `/^I am a guest user$/'
./features/search.feature:4:in `Given I am a guest user'

calling create_account raise the error:

Selenium::WebDriver::Error::UnknownError: Method has not yet been implemented
(eval):1:in `process_watir_call'
./features/step_definitions/user_steps.rb:12:in `/^I click on Create account$/'
./features/account.feature:4:in `When I click on Create account'

I know that page-object wasn't design for mobile app testing, but still think it's useful to use it.

PatrickDuncan commented 6 years ago

Hello @cheezy, has there been any progress with this particular ticket? We're hoping to use your library with Appium to test mobile applications (outside of just the browser).