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

Selenium Overhaul #4732

Merged
merged 16 commits into from Oct 3, 2017

Conversation

Projects
None yet
4 participants
@jmchilton
Member

jmchilton commented Oct 2, 2017

  • This includes #4704 which fixes a bug that hits Selenium maybe?
  • This includes #4694 which overhauls how Selenium works with time and sleeps as well as adding a test for Juypter and others tests.
  • This also includes a new commit on top of those that uses a new more structured, more object oriented approach to reading "navigation data" and component descriptions from a YAML file.

The previous YAML file "navigation-data.yml" was pretty unstructured - labels, selectors, text all over the place. Sometimes selectors outside of other components, etc... The new YAML file "navigation.yml" has a pretty clear grammar at the top and is parsed in a structured way. The idea is to break everything into components and sub-components. Any component can be associated with "selectors" (which can be XPATH, CSS, etc...), labels, and text bits. These are parsed into objects which have a more object oriented and more uniform interface. The commit is large and changes a lot - but just take for instance the following diff:

-            self.click_xpath(self.navigation_data["selectors"]["registrationPage"]["submit_xpath"])
+            self.wait_for_and_click(self.navigation.registration.selectors.submit)

As the consume of the selector - you don't need to know it is XPATH for instance. Before we had different wait methods for CSS, XPATH, Labels, IDs, etc.... Now for all selectors coming out of the navigation component data you can just use a single method. Also note that it goes from component to selector to selector name for all selectors and the more concise object oriented accession then the previous raw dictionary based approach.

Here is a Jenkins build that passes with this branch https://jenkins.galaxyproject.org/view/All/job/jmchilton-selenium/42/. Hopefully that will help make merging easier?

jmchilton added some commits Sep 29, 2017

Cleanup delayed action in history-view.js.
Might fix #4698 but who knows.
Selenium - implement managed_history decorator for tests.
Creates and deletes a history for tests - good for tests meant to aim at production servers that need to have useful metadata and need to be cleaned up.
Switch to configurable, scaling approach to Selenium timeouts.
Implement different "WAIT_TYPES" and try to sleep for different amounts of time based on what is being waited for.

Replace sleep statements in addition to Selenium wait on statements.
@jmchilton

This comment has been minimized.

Member

jmchilton commented Oct 2, 2017

dev's performance today:

screen shot 2017-10-02 at 3 03 01 pm

this branch's performance today (since I last rebased it):

screen shot 2017-10-02 at 3 03 18 pm

@bgruening

This comment has been minimized.

Member

bgruening commented Oct 2, 2017

This is insane wonderful! I would merge it right now but there are a few client changes in it. @dannon can you look at this please.

Thanks a ton @jmchilton!

@dannon

This comment has been minimized.

Member

dannon commented Oct 3, 2017

Just finished running the suite locally and checking through it. This looks really nice to me, definitely a usability improvement for the tests. The included #4704 also looks reasonable as a stab at that elusive bug.

@dannon dannon merged commit d685b49 into galaxyproject:dev Oct 3, 2017

6 checks passed

api test Build finished. 297 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. 46 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
@jmchilton

This comment has been minimized.

Member

jmchilton commented Oct 3, 2017

Thanks for the merge @dannon!

jmchilton added a commit to jmchilton/galaxy that referenced this pull request Oct 4, 2017

Continue push toward smarter component based Selenium testing.
This continues a thread started in 0650978 and galaxyproject#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

```

jmchilton added a commit to jmchilton/galaxy that referenced this pull request Oct 4, 2017

Continue push toward smarter component based Selenium testing.
This continues a thread started in 0650978 and galaxyproject#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

```

jmchilton added a commit to jmchilton/galaxy that referenced this pull request Oct 4, 2017

Continue push toward smarter component based Selenium testing.
This continues a thread started in 0650978 and galaxyproject#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

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment