mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 07:19:13 +08:00
This continues a thread started in 0650978a91 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
```
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
from .framework import (
|
|
selenium_test,
|
|
SeleniumTestCase
|
|
)
|
|
|
|
|
|
class AnonymousHistoriesTestCase(SeleniumTestCase):
|
|
|
|
@selenium_test
|
|
def test_anon_history_landing(self):
|
|
self.home()
|
|
self.assert_initial_history_panel_state_correct()
|
|
|
|
# Anonymous users can annotate or tag, these components should be absent.
|
|
self.components.history_panel.tag_icon.assert_absent_or_hidden()
|
|
self.components.history_panel.annotation_icon.assert_absent_or_hidden()
|
|
|
|
# History has a name but...
|
|
name_element = self.components.history_panel.name.wait_for_and_click()
|
|
|
|
# ... name should NOT be editable when clicked by anon-user
|
|
editable_text_class = self.navigation._.selectors.editable_text
|
|
assert editable_text_class.as_css_class not in name_element.get_attribute("class")
|
|
|
|
@selenium_test
|
|
def test_anon_history_upload(self):
|
|
self.home()
|
|
self.perform_upload(self.get_filename("1.txt"))
|
|
self.wait_for_history()
|
|
# Reload the history and make sure the state is preserved.
|
|
self.home()
|
|
self.history_panel_wait_for_hid_state(1, "ok")
|
|
|
|
# empty should be NO LONGER be displayed
|
|
self.components.history_panel.empty_message.assert_absent_or_hidden()
|
|
|
|
@selenium_test
|
|
def test_anon_history_after_registration(self):
|
|
self._upload_file_anonymous_then_register_user()
|
|
self.home()
|
|
self.history_panel_wait_for_hid_state(1, "ok")
|
|
|
|
@selenium_test
|
|
def test_clean_anon_history_after_logout(self):
|
|
self._upload_file_anonymous_then_register_user()
|
|
self.logout_if_needed()
|
|
# Give Galaxy a chance to load the new empty history for that now
|
|
# anonymous user. Make sure this new history is empty.
|
|
self.history_panel_wait_for_history_loaded()
|
|
history_contents = self.current_history_contents()
|
|
assert len(history_contents) == 0
|
|
|
|
def _upload_file_anonymous_then_register_user(self):
|
|
self.home()
|
|
self.perform_upload(self.get_filename("1.txt"))
|
|
self.wait_for_history()
|
|
self.register()
|