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

try system test to count navbar typeahead results in dropdown #5525

Merged
merged 9 commits into from
Apr 24, 2019

Conversation

jywarren
Copy link
Member

Re: #4515

@plotsbot
Copy link
Collaborator

plotsbot commented Apr 18, 2019

1 Message
📖 @jywarren Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.

Generated by 🚫 Danger

@jywarren jywarren mentioned this pull request Apr 22, 2019
5 tasks
@jywarren
Copy link
Member Author

[Screenshot]: tmp/screenshots/failures_test_searching_using_navbar_autocomplete.png
 FAIL["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x00007fd458c10460 @name="SearchTest">, 33.867744201999926]
 test_searching_using_navbar_autocomplete#SearchTest (33.87s)
        Expected false to be truthy.
        test/system/search_test.rb:19:in `block in <class:SearchTest>'


fill_in("searchform_input", with: "Canon")

assert page.evaluate_script("$('.typeahead.dropdown-menu').is(':visible')")
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like Capybara won't wait unless we ask it to look for a selector. Even then we can increase the max time:

select('Item that is being loaded', wait: 10)

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

also see https://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Matchers#assert_selector-instance_method

for example: page.assert_selector('li', text: 'Horse', visible: true)

@jywarren
Copy link
Member Author

[Screenshot]: tmp/screenshots/failures_test_searching_using_navbar_autocomplete.png
ERROR["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x00007fcca2808c18 @name="SearchTest">, 18.193436125000062]
 test_searching_using_navbar_autocomplete#SearchTest (18.19s)
Capybara::ElementNotFound:         Capybara::ElementNotFound: Unable to find select box "typeahead.dropdown-menu" that is not disabled and Unable to find input box with datalist completion "typeahead.dropdown-menu" that is not disabled
            test/system/search_test.rb:19:in `block in <class:SearchTest>'


fill_in("searchform_input", with: "Canon")

assert_select 'typeahead.dropdown-menu' do
Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm


 FAIL["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x00007f8136b478c8 @name="SearchTest">, 10.584121601999982]
 test_searching_using_navbar_autocomplete#SearchTest (10.58s)
        expected to find select box "typeahead.dropdown-menu" that is not disabled but there were no matches
        test/system/search_test.rb:19:in `block in <class:SearchTest>'

what am I doing wrong here? so close!

@jywarren
Copy link
Member Author

 FAIL["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x000055c70cd8ee00 @name="SearchTest">, 148.193087525]
 test_searching_using_navbar_autocomplete#SearchTest (148.19s)
        expected to find select box ".typeahead" that is not disabled but there were no matches
        test/system/search_test.rb:19:in `block in <class:SearchTest>'

@jywarren
Copy link
Member Author

Hmm. I can't seem to get this to wait for the typeahead dropdown to appear. Capybara is supposed to wait 2 seconds, and i even extended it to 10 seconds. Is it possible I've set this up wrong? I'm trying to detect when the .typeahead element appears when you type a search term into the navbar. @siaw23 do you have any experience with Capybara tests?

@jywarren
Copy link
Member Author

OMG wait! This error is different!


 FAIL["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x00005600b8c466c0 @name="SearchTest">, 143.99473105099992]
 test_searching_using_navbar_autocomplete#SearchTest (143.99s)
        Expected: 1
          Actual: 4
        test/system/search_test.rb:22:in `block in <class:SearchTest>'

Four matches! I can do this!

@jywarren
Copy link
Member Author

Oh bummer!

ERROR["test_searching_an_item_from_the_homepage", #<Minitest::Reporters::Suite:0x000055d3d1040a38 @name="SearchTest">, 103.21799982900006]
 test_searching_an_item_from_the_homepage#SearchTest (103.22s)
Selenium::WebDriver::Error::SessionNotCreatedError:         Selenium::WebDriver::Error::SessionNotCreatedError: session not created: Chrome version must be between 70 and 73
          (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.4.0-101-generic x86_64)
            test/system/search_test.rb:6:in `block in <class:SearchTest>'
ERROR["test_searching_using_navbar_autocomplete", #<Minitest::Reporters::Suite:0x000055d3d0f919c0 @name="SearchTest">, 104.00540367200006]
 test_searching_using_navbar_autocomplete#SearchTest (104.01s)
Selenium::WebDriver::Error::SessionNotCreatedError:         Selenium::WebDriver::Error::SessionNotCreatedError: session not created: Chrome version must be between 70 and 73
          (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.4.0-101-generic x86_64)
            test/system/search_test.rb:15:in `block in <class:SearchTest>'

I wonder if it's related to #5507 or #5509...

@jywarren
Copy link
Member Author

I think we need to match the chrome version with:

- docker-compose exec web bash -c "wget https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip" # https://sites.google.com/a/chromium.org/chromedriver/

We're using chrome stable: Unpacking google-chrome-stable (74.0.3729.108-1) ...

So, i think we need to change the travis.yml line here:

- docker-compose exec web bash -c "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"

to chrome 73?

@jywarren
Copy link
Member Author

Chromedriver went to v2.46 in Feb 2019, and then the version numbering changed, perhaps to match Chrome versions?

https://chromedriver.storage.googleapis.com/

Or the latest seems to support Chrome 74:

https://chromedriver.storage.googleapis.com/74.0.3729.6/notes.txt

We were on 73.0.3683.68, but Chrome 74 was released. I'll try upgrading. We may want to peg these version numbers...

@jywarren
Copy link
Member Author

😄

@jywarren jywarren merged commit 099a1ab into master Apr 24, 2019
SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
…lab#5525)

* try system test to count navbar typeahead results in dropdown

* Update search_test.rb

* add wait

* Update search_test.rb

* Update search_test.rb

* Update search_test.rb

* , wait: 10

* search for 4 li elements

* chromedriver 74.0.3729.6
digitaldina pushed a commit to digitaldina/plots2 that referenced this pull request May 12, 2019
…lab#5525)

* try system test to count navbar typeahead results in dropdown

* Update search_test.rb

* add wait

* Update search_test.rb

* Update search_test.rb

* Update search_test.rb

* , wait: 10

* search for 4 li elements

* chromedriver 74.0.3729.6
@cesswairimu cesswairimu deleted the system-dropdown branch May 4, 2021 14:05
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.

2 participants