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

Development fix farm page tests #3690

Draft
wants to merge 19 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/playground/tests/frontend_selenium/Config.ini

This file was deleted.

23 changes: 15 additions & 8 deletions packages/playground/tests/frontend_selenium/pages/farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,21 @@ def search_functionality(self, farm_name):
return table

def search_functionality_invalid_name(self, farm_name):
sleep(2)
self.browser.find_element(*self.search_bar).send_keys(Keys.CONTROL + "a")
self.browser.find_element(*self.search_bar).send_keys(Keys.DELETE)
for char in farm_name:
self.browser.find_element(*self.search_bar).send_keys(char)
table = self.browser.find_element(*self.table).text
sleep(3)
return table
# sleep(2)
# self.browser.find_element(*self.search_bar).send_keys(Keys.CONTROL + "a")
# self.browser.find_element(*self.search_bar).send_keys(Keys.DELETE)
# for char in farm_name:
# self.browser.find_element(*self.search_bar).send_keys(char)
# table = self.browser.find_element(*self.table).text
# sleep(3)
# return table
self.wait_until_visible(self.search_bar)
self.browser.find_element(*self.search_bar).clear()
self.browser.find_element(*self.search_bar).send_keys(farm_name)
WebDriverWait(self.browser, 30).until(
lambda driver: "No data available" in driver.find_element(*self.table).text or farm_name in driver.find_element(*self.table).text
)
return self.browser.find_element(*self.table).text

def display_all_farms(self):
self.browser.execute_script("window.scrollTo(0,document.body.scrollHeight)")
Expand Down
44 changes: 0 additions & 44 deletions packages/playground/tests/frontend_selenium/selenium.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def test_farmpayout_address(browser):
assert farm_page.wait_for_farm_name(farm_name)
farm_page.search_functionality("")
farm_page.setup_farmpayout_address(farm_name)
farm_page.wait_for_button(browser.find_element(*farm_page.add_v2_button)).click()
self.browser.execute_script("arguments[0].scrollIntoView();", self.browser.find_element(*farm_page.add_v2_button))
self.wait_for_no_overlay()
self.wait_until_clickable(farm_page.add_v2_button).click()
cases = [' ', 'dgdd', generate_string(), 'gdhjP6TF3UXYXTNEZ2P36J5FH7W4BJJQ4AYYAXC66I2Q2AH5B6O6Bcfg']
for case in cases:
assert farm_page.add_farmpayout_address(case).is_enabled()==False
Expand All @@ -166,7 +168,9 @@ def test_farmpayout_address(browser):
assert farm_page.wait_for('Address Added successfully!')
assert farm_page.farmpayout_address_value()[:-3] in case
case = "GAK2AN6ZC4REV2GXZPTMJG2JKLRJQX746JNG7ACKNC4RSJE7ETAZSE7D"
farm_page.wait_for_button(browser.find_element(*farm_page.add_v2_button)).click()
self.browser.execute_script("arguments[0].scrollIntoView();", self.browser.find_element(*farm_page.add_v2_button))
self.wait_for_no_overlay()
self.wait_until_clickable(farm_page.add_v2_button).click()
farm_page.wait_for_button(farm_page.add_farmpayout_address(case)).click()
assert farm_page.wait_for('This action will be reflected in a bit')
assert farm_page.wait_for('Address Added successfully!')
Expand Down Expand Up @@ -215,8 +219,8 @@ def test_ip(browser):
cases = [gateway, '2.0.0.1', '3.0.0.0', '139.255.255.255', '59.15.35.78']
for case in cases:
farm_page.setup_gateway('125.25.25.25/16', case, farm_name, False)
assert farm_page.wait_for('Gateway IP not in the provided IP range.')
assert browser.find_element(*farm_page.save_button).is_enabled()==False
assert farm_page.wait_for('Gateway IP not in the provided IP range.'), f"Expected error message for {case}"
assert not browser.find_element(*farm_page.save_button).is_enabled(), "Save button should be disabled"
farm_page.close_ip()
farm_page.setup_gateway(gateway, gateway, farm_name, False)
assert farm_page.wait_for('IPs cannot be the same.')
Expand Down Expand Up @@ -300,6 +304,8 @@ def test_range_ips(browser):
assert farm_page.wait_for('Not a valid IP')
assert browser.find_element(*farm_page.save_button).is_enabled()==False
farm_page.add_range_ips('255.0.0.1/32', 0, 0).is_enabled()
assert farm_page.wait_for('IP is not public'), "Expected 'IP is not public' error"
assert not browser.find_element(*farm_page.save_button).is_enabled(), "Save button should be disabled for invalid IP"
assert farm_page.wait_for('IP is not public')
assert browser.find_element(*farm_page.save_button).is_enabled()==False
assert farm_page.wait_for_button(farm_page.add_range_ips('1.1.1.254/16', '1.1.1.255/16', '1.1.1.1')).is_enabled()==True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def test_validate_homepage_links(browser):
"""
dashboard_page = before_test_setup(browser)
assert dashboard_page.navigate_to_find_more() == ('https://threefold.io/')
assert dashboard_page.navigate_to_explore_capacity() == ( 'https://stats.' + Base.net + '.grid.tf/')
if Base.net == 'main':
stats_url = 'https://stats.grid.tf/'
else:
stats_url = 'https://stats.' + Base.net + '.grid.tf/'
assert dashboard_page.navigate_to_explore_capacity() == ( stats_url )
assert dashboard_page.navigate_to_learn_about_grid() == ('https://www.manual.grid.tf/')


Expand Down
33 changes: 0 additions & 33 deletions packages/playground/tests/frontend_selenium/tests/conftest.py

This file was deleted.

9 changes: 0 additions & 9 deletions packages/playground/tests/frontend_selenium/utils/base.py

This file was deleted.

101 changes: 0 additions & 101 deletions packages/playground/tests/frontend_selenium/utils/grid_proxy.py

This file was deleted.

Loading