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

Another Round of Selenium Fixes and Improvements #4753

Merged
merged 5 commits into from Oct 9, 2017

Conversation

Projects
None yet
3 participants
@jmchilton
Member

jmchilton commented Oct 4, 2017

Fixes

This also includes various fixes aimed at getting the newer library tests to work under Jenkins -
9a43048 fixes some issues and cc5f44b disables one test that doesn't work for reasons I don't understand really - path_paste uploads just seem to fail under the docker-compose setup.

Enhancements

This includes 36863f5 which forces Selenium to target a Galaxy using a proxy-prefix (superseding #4709) - so we will catch more proxy prefix related bugs ideally along with numerous fixes for the tests when run against such a Galaxy in 225ad7f.

225ad7f in addition to bundling some fixes includes includes another set of improvements to the navigation YAML reworking. From the commit message:

This continues a thread started in 0650978 and #4732 of switching to smarter selectors from a more structured YAML description of the Galaxy DOM. This continues that by:

  • Eliminating any use of the old navigation YAML file (navigation-data.yml) and deleting that file from the code base.
  • Replacing href selectors with other things since they break when testing Galaxy with a proxy-prefix.
  • Extending the raw selectors to allow concept of nesting selectors (there were some half thought threw ideas related to this included in #4732 but they weren't used). This really flushes things out and makes heavy use of them. See second example below.
  • And finally, building even smarter "components" that wrap these raw selectors generated from the YAML directly in a way that allows them to utilize the actual Selenium session and helper class.

So the old self.navigation_data is gone, self.navigation still yields the raw selectors, and self.components yields the smarter variant. Hopefully all will agree the code that uses self.components is more compact and readable.

The following a very basic example of this:

     def click_masthead_user(self):
-        self.wait_for_and_click(self.navigation.masthead.selectors.user)
+        self.components.masthead.user.wait_for_and_click()

Here is an example of combining it with the new child selector syntax:

     def assert_item_dbkey_displayed_as(self, hid, dbkey):
-        item_body_selector = self.history_panel_item_body_selector(hid=hid, wait=True)
-        dbkey_selector = item_body_selector + ' ' + self.test_data["historyPanel"]["selectors"]["hda"]["dbkey"]
-        dbkey_element = self.wait_for_selector_visible(dbkey_selector)
-        assert dbkey in dbkey_element.text
+        item_body = self.history_panel_item_component(hid=hid)
+        dbkey_text = item_body.dbkey.wait_for_text()
+        assert dbkey in dbkey_text

Before I found moving raw constants into the YAML file after I had written a test a chore and indeed community contributed tests never added to the YAML. I think with this reworking of things - people (myself included) will really be encouraged to fillout the YAML file and use these abstract selectors upfront. Hopefully having a semi-stable representation of Galaxy's components in this way will eventually prove helpful in other contexts so as when writing tours or building automated applications in other frameworks (the way I was able to reuse some of what Carl had done with the YAML when switching to Selenium).

jmchilton added some commits Sep 27, 2017

Fix library tests when run via docker-compose setup used by Jenkins.
Need to point the tests at the same master API key used to configure Galaxy for those tests and need to make the default admin test user a admin user of that Galaxy.
Continue push toward smarter component based Selenium testing.
This continues a thread started in 0650978 and #4732 of switching to smarter selectors from a more structured YAML description of the Galaxy DOM. This continues that by:

- Eliminating any use of the old navigation YAML file (navigation-data.yml).
- Replace href selectors with other things since they break when testing Galaxy with a proxy-prefix.
- Extending the raw selectors to allow concept of nesting selectors.
- Building even smarter "components" that wrap these raw selectors generated from the YAML directly in a way that allows them to utilize the actual Selenium session and helper class.

So the old ``self.navigation_data`` is gone, ``self.navigation`` still yields the raw selectors, and ``self.components`` yields the smarter variant. Hopefully all will agree the code that uses ``self.components`` is more compact and readable.

The following a very basic example of this:

```diff
     def click_masthead_user(self):
-        self.wait_for_and_click(self.navigation.masthead.selectors.user)
+        self.components.masthead.user.wait_for_and_click()

```

Here is an example of combining it with the new child selector syntax:

```diff
     def assert_item_dbkey_displayed_as(self, hid, dbkey):
-        item_body_selector = self.history_panel_item_body_selector(hid=hid, wait=True)
-        dbkey_selector = item_body_selector + ' ' + self.test_data["historyPanel"]["selectors"]["hda"]["dbkey"]
-        dbkey_element = self.wait_for_selector_visible(dbkey_selector)
-        assert dbkey in dbkey_element.text
+        item_body = self.history_panel_item_component(hid=hid)
+        dbkey_text = item_body.dbkey.wait_for_text()
+        assert dbkey in dbkey_text

```
Comment out test that doesn't work on Jenkins.
I don't know why it doesn't work - I'll revisit later but Jenkins is currently broken.
@jmchilton

This comment has been minimized.

Member

jmchilton commented Oct 4, 2017

Here is a link for these tests passing again on Jenkins:

https://jenkins.galaxyproject.org/job/jmchilton-selenium/80/testReport/

@martenson martenson merged commit bbd96f2 into galaxyproject:dev Oct 9, 2017

6 checks passed

api test Build finished. 303 tests run, 4 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
framework test Build finished. 161 tests run, 0 skipped, 0 failed.
Details
integration test Build finished. 55 tests run, 0 skipped, 0 failed.
Details
lgtm analysis: JavaScript No alert changes
Details
toolshed test Build finished. 579 tests run, 0 skipped, 0 failed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment