Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Capybara::Node::Element.inspect #62

Merged
merged 2 commits into from
Nov 11, 2022

Conversation

teyamagu
Copy link
Contributor

@teyamagu teyamagu commented Nov 11, 2022

When I used Capybara::Node::Element(ex: home_page.action_sheets_section.has_buttons?) then I got a error below.
(some caps changes are for my simulator env.)

% bundle exec rspec spec/ios_example_spec.rb
{:caps=>{:platformName=>"ios", :platformVersion=>"14.4", :deviceName=>"iPhone 11", :automationName=>"XCUITest", :app=>"/Users/teppei-yamaguchi/work/appium_capybara/example/UICatalog.app.zip"}, :appium_lib=>{:server_url=>"http://localhost:4723/wd/hub"}, :global_driver=>false}
F

Failures:

  1) UICatalog smoke test should detect the nav bar and get some methods
     Failure/Error: expect(home_page.action_sheets_view.has_buttons?).to be_falsey
     Selenium::WebDriver::Error::UnknownMethodError:
       Method is not implemented
     # NotImplementedError: Method is not implemented
     #     at XCUITestDriver.execute (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:38:11)
     #     at commandExecutor (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:335:9)
     #     at /Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/async-lock/lib/index.js:146:12
     #     at AsyncLock._promiseTry (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/async-lock/lib/index.js:280:31)
     #     at exec (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/async-lock/lib/index.js:145:9)
     #     at AsyncLock.acquire (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/async-lock/lib/index.js:162:3)
     #     at XCUITestDriver.executeCommand (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:348:39)
     #     at XCUITestDriver.executeCommand (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:779:24)
     #     at AppiumDriver.executeCommand (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/lib/appium.js:563:36)
     #     at runMicrotasks (<anonymous>)
     #     at processTicksAndRejections (internal/process/task_queues.js:93:5)
     #     at asyncHandler (/Users/teppei-yamaguchi/.anyenv/envs/nodenv/versions/14.7.0/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:297:21)
     # ./spec/ios_example_spec.rb:9:in `block (2 levels) in <top (required)>'

Finished in 23.97 seconds (files took 1.79 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/ios_example_spec.rb:4 # UICatalog smoke test should detect the nav bar and get some methods

This error caused by Capybara::Node::Element.inspect. Inspect call tag_name and path.
But tag_name and path can't use in mobile.

So I propose to change Capybara::Node::Element.inspect.

ref.)
class Capybara::Selenium::Node < Capybara::Driver::Node

      def inspect
        %(#<#{self.class} tag="#{tag_name}" path="#{path}">)
      rescue NotSupportedByDriverError
        %(#<#{self.class} tag="#{tag_name}">)
      end

class Appium::Capybara::Node < Capybara::Selenium::Node

    def inspect
      %(#<#{self.class} name="#{name}">)
    end

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 11, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you.

The inspect method has been so for years, thus this won't require version restriction. Just a note.

@KazuCocoa KazuCocoa merged commit 7303687 into appium:master Nov 11, 2022
@KazuCocoa KazuCocoa mentioned this pull request Nov 11, 2022
@teyamagu
Copy link
Contributor Author

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants