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

HasManyOrdered failing test case #35

Conversation

eebs
Copy link
Contributor

@eebs eebs commented Jul 21, 2023

In this test I attempted to create an element named header both at the top level and within a has_many_ordered. This results in passing a HasOneResult object to has_css? instead of a String selector.

capybara-3.39.1/lib/capybara/selector/selector.rb:69: warning:

Locator PageEz::HasOneResult:#<PageEz::HasOneResult:0x0000000109c5a940 @result=#<#<Class:0x00000001092cac90>:0x0000000109c50c10 @container=#<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/MAIN[1]/SECTION[1]/UL[1]/LI[1]/DIV[1]">>>

for selector :css must be an instance of String or Symbol. This will raise an error in a future version of Capybara. Called from: /Users/eebs/code/eebs/page_ez/lib/page_ez/has_one_result.rb:7
Backtrace
→ bundle exec rspec spec/features/has_many_ordered_spec.rb:4 --backtrace
Run options: include {:locations=>{"./spec/features/has_many_ordered_spec.rb"=>[4]}}

Randomized with seed 60411

has_many_ordered
Capybara starting Puma...
* Version 6.3.0 , codename: Mugi No Toki Itaru
* Min threads: 0, max threads: 4
* Listening on http://127.0.0.1:50391
D, [2023-07-21T13:13:42.460288 #46238] DEBUG -- : Declaring page object: {anonymous page object}
D, [2023-07-21T13:13:42.460431 #46238] DEBUG -- : has_one :header, ""
D, [2023-07-21T13:13:42.462825 #46238] DEBUG -- : Declaring page object: {anonymous page object}
D, [2023-07-21T13:13:42.462865 #46238] DEBUG -- :   has_one :heading, "h2"
D, [2023-07-21T13:13:42.462941 #46238] DEBUG -- :   * heading
D, [2023-07-21T13:13:42.462972 #46238] DEBUG -- :   * has_heading?
D, [2023-07-21T13:13:42.462985 #46238] DEBUG -- :   * has_no_heading?
D, [2023-07-21T13:13:42.463019 #46238] DEBUG -- : * header
D, [2023-07-21T13:13:42.463033 #46238] DEBUG -- : * has_header?
D, [2023-07-21T13:13:42.463044 #46238] DEBUG -- : * has_no_header?
D, [2023-07-21T13:13:42.463066 #46238] DEBUG -- : has_many_ordered :webhooks, "ul[data-role=webhooks-list] li"
D, [2023-07-21T13:13:42.463276 #46238] DEBUG -- : Declaring page object: {anonymous page object}
D, [2023-07-21T13:13:42.463301 #46238] DEBUG -- :   has_one :header, "div[data-role=webhook-header]"
D, [2023-07-21T13:13:42.463342 #46238] DEBUG -- :   Declaring page object: {anonymous page object}
D, [2023-07-21T13:13:42.463355 #46238] DEBUG -- :     has_one :source, "div[data-role=webhook-source]"
D, [2023-07-21T13:13:42.463398 #46238] DEBUG -- :     * source
D, [2023-07-21T13:13:42.463410 #46238] DEBUG -- :     * has_source?
D, [2023-07-21T13:13:42.463419 #46238] DEBUG -- :     * has_no_source?
D, [2023-07-21T13:13:42.463438 #46238] DEBUG -- :   * header
D, [2023-07-21T13:13:42.463469 #46238] DEBUG -- :   Declaring page object: {anonymous page object}
D, [2023-07-21T13:13:42.463478 #46238] DEBUG -- :     has_one :heading, "h2"
D, [2023-07-21T13:13:42.463524 #46238] DEBUG -- :     * heading
D, [2023-07-21T13:13:42.463535 #46238] DEBUG -- :     * has_heading?
D, [2023-07-21T13:13:42.463544 #46238] DEBUG -- :     * has_no_heading?
D, [2023-07-21T13:13:42.463558 #46238] DEBUG -- :   * header
D, [2023-07-21T13:13:42.463570 #46238] DEBUG -- :   * has_header?
D, [2023-07-21T13:13:42.463578 #46238] DEBUG -- :   * has_no_header?
D, [2023-07-21T13:13:42.463586 #46238] DEBUG -- :   * has_header?
D, [2023-07-21T13:13:42.463595 #46238] DEBUG -- :   * has_no_header?
D, [2023-07-21T13:13:42.463614 #46238] DEBUG -- : * webhooks
D, [2023-07-21T13:13:42.463625 #46238] DEBUG -- : * has_webhooks_count?
D, [2023-07-21T13:13:42.463639 #46238] DEBUG -- : * webhook_at
D, [2023-07-21T13:13:42.463650 #46238] DEBUG -- : * has_webhook_at?
/Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/selector/selector.rb:69: warning: Locator PageEz::HasOneResult:#<PageEz::HasOneResult:0x0000000112e7ad48 @result=#<#<Class:0x00000001129fb560>:0x0000000112e71018 @container=#<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/MAIN[1]/SECTION[1]/UL[1]/LI[1]/DIV[1]">>> for selector :css must be an instance of String or Symbol. This will raise an error in a future version of Capybara. Called from: /Users/eebs/code/eebs/page_ez/lib/page_ez/has_one_result.rb:7
  allows for nested elements with the same name (FAILED - 1)

Failures:

  1) has_many_ordered allows for nested elements with the same name
     Failure/Error:
       container.find(
         selector,
         **options
       )

     Selenium::WebDriver::Error::InvalidSelectorError:
       invalid selector: An invalid or illegal selector was specified
         (Session info: headless chrome=115.0.5790.102); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#invalid-selector-exception
     # 0   chromedriver                        0x0000000103037f48 chromedriver + 4226888
     # 1   chromedriver                        0x00000001030304f4 chromedriver + 4195572
     # 2   chromedriver                        0x0000000102c74d68 chromedriver + 281960
     # 3   chromedriver                        0x0000000102c796b0 chromedriver + 300720
     # 4   chromedriver                        0x0000000102c7afe4 chromedriver + 307172
     # 5   chromedriver                        0x0000000102c7b0d4 chromedriver + 307412
     # 6   chromedriver                        0x0000000102cafcac chromedriver + 523436
     # 7   chromedriver                        0x0000000102ca5734 chromedriver + 481076
     # 8   chromedriver                        0x0000000102ce6c58 chromedriver + 748632
     # 9   chromedriver                        0x0000000102ca3f1c chromedriver + 474908
     # 10  chromedriver                        0x0000000102ca4ef4 chromedriver + 478964
     # 11  chromedriver                        0x0000000102ff959c chromedriver + 3970460
     # 12  chromedriver                        0x0000000102ffd6f0 chromedriver + 3987184
     # 13  chromedriver                        0x00000001030035b4 chromedriver + 4011444
     # 14  chromedriver                        0x0000000102ffe2fc chromedriver + 3990268
     # 15  chromedriver                        0x0000000102fd61c0 chromedriver + 3826112
     # 16  chromedriver                        0x000000010301a088 chromedriver + 4104328
     # 17  chromedriver                        0x000000010301a1e0 chromedriver + 4104672
     # 18  chromedriver                        0x0000000103029f28 chromedriver + 4169512
     # 19  libsystem_pthread.dylib             0x000000019f10bfa8 _pthread_start + 148
     # 20  libsystem_pthread.dylib             0x000000019f106da0 thread_start + 8
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/response.rb:55:in `assert_ok'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/http/common.rb:83:in `new'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/http/common.rb:83:in `create_response'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/bridge.rb:620:in `execute'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/remote/bridge.rb:551:in `find_elements_by'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.10.0/lib/selenium/webdriver/common/search_context.rb:78:in `find_elements'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/selenium/extensions/find.rb:17:in `find_by'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/selenium/extensions/find.rb:11:in `find_css'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/base.rb:110:in `find_css'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/queries/selector_query.rb:253:in `find_nodes_by_selector_format'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/queries/selector_query.rb:166:in `block in resolve_for'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/base.rb:77:in `synchronize'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/queries/selector_query.rb:165:in `resolve_for'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/finders.rb:303:in `block in synced_resolve'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/base.rb:84:in `synchronize'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/finders.rb:301:in `synced_resolve'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/node/finders.rb:60:in `find'
     # ./lib/page_ez/has_one_result.rb:7:in `initialize'
     # ./lib/page_ez/method_generators/has_one_static_selector.rb:25:in `new'
     # ./lib/page_ez/method_generators/has_one_static_selector.rb:25:in `block in run'
     # ./lib/page_ez/delegates_to.rb:10:in `method_missing'
     # ./spec/features/has_many_ordered_spec.rb:50:in `block (2 levels) in <top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:263:in `instance_exec'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:263:in `block in run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `block in run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
     # ./spec/spec_helper.rb:49:in `block (2 levels) in <top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `map'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `run_examples'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `map'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116:in `block in run_specs'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74:in `report'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115:in `run_specs'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:71:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:45:in `invoke'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2/exe/rspec:4:in `<top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/bin/rspec:25:in `load'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/bin/rspec:25:in `<top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:58:in `load'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:58:in `kernel_load'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:23:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli.rb:483:in `exec'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli.rb:31:in `dispatch'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/cli.rb:25:in `start'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/exe/bundle:48:in `block in <top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.3.11/exe/bundle:36:in `<top (required)>'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/bin/bundle:25:in `load'
     # /Users/eebs/.asdf/installs/ruby/3.2.0/bin/bundle:25:in `<main>'

Finished in 2.92 seconds (files took 0.30557 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/has_many_ordered_spec.rb:4 # has_many_ordered allows for nested elements with the same name

Swapping the nested header to webhook_header allows the tests to pass.

In this test I attempted to create an element named `header` both at the
top level and within a `has_many_ordered`. This results in passing a
HasOneResult object to `has_css?` instead of a String selector.

```
capybara-3.39.1/lib/capybara/selector/selector.rb:69: warning:

Locator PageEz::HasOneResult:#<PageEz::HasOneResult:0x0000000109c5a940 @Result=#<#<Class:0x00000001092cac90>:0x0000000109c50c10 @container=#<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/MAIN[1]/SECTION[1]/UL[1]/LI[1]/DIV[1]">>>

for selector :css must be an instance of String or Symbol. This will
raise an error in a future version of Capybara. Called from:
/Users/eebs/code/eebs/page_ez/lib/page_ez/has_one_result.rb:7
```
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.

1 participant