Skip to content

Commit

Permalink
Merge pull request #3605 from threefoldtech/development_update_seleni…
Browse files Browse the repository at this point in the history
…um_test_3.15

update hompage, transfer and proxy tests
  • Loading branch information
ramezsaeed authored Nov 19, 2024
2 parents bf66d67 + cef7d31 commit b985629
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class DashboardPage:
email_login_label = (By.XPATH, "//label[text()='Email']/following-sibling::input")
id_login_label = (By.XPATH, "//label[text()='Twin ID']/following-sibling::input")
address_login_label = (By.XPATH, "//label[text()='Address']/following-sibling::input")
capacity_stats = (By.XPATH, '/html/body/div[1]/div/div/main/div/div[2]/div/div/div[2]/div[2]/div[2]/div[1]/div/div[3]/p[1]')
nodes_stats = (By.XPATH, '/html/body/div[1]/div/div/main/div/div[2]/div/div/div[2]/div[2]/div[2]/div[2]/div/div[3]/p[1]')
countries_stats = (By.XPATH, '/html/body/div[1]/div/div/main/div/div[2]/div/div/div[2]/div[2]/div[2]/div[3]/div/div[3]/p[1]')
cores_stats = (By.XPATH, '/html/body/div[1]/div/div/main/div/div[2]/div/div/div[2]/div[2]/div[2]/div[4]/div/div[3]/p[1]')
capacity_stats = (By.XPATH, "//p[contains(@class, 'text-center') and following-sibling::p[text()='Capacity']]")
nodes_stats = (By.XPATH, "//p[contains(@class, 'text-center') and following-sibling::p[text()='Nodes']]")
countries_stats = (By.XPATH, "//p[contains(@class, 'text-center') and following-sibling::p[text()='Countries']]")
cores_stats = (By.XPATH, "//p[contains(@class, 'text-center') and following-sibling::p[text()='Cores']]")
profile_button = (By.XPATH, '/html/body/div[1]/div/div/main/header[1]/div/div[3]/i')
profile_label = (By.XPATH, '/html/body/div[1]/div/div/main/div/div[2]/div/div/div/div[1]/div/div[1]')
qr_code_img = (By.XPATH, "//img[@alt='qrcode']")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_stats(browser):
"""
dashboard_page = before_test_setup(browser)
grid_proxy = GridProxy(browser)
stats = grid_proxy.get_stats()
stats = grid_proxy.get_stats_capicity()
dashboard_stats = dashboard_page.get_dashboard_stats()
assert stats == dashboard_stats

Expand Down Expand Up @@ -183,4 +183,4 @@ def test_login_links(browser):
dashboard_page.open_profile()
assert dashboard_page.connect_manual_link() == 'https://www.manual.grid.tf/documentation/threefold_token/storing_tft/tf_connect_app.html'
assert dashboard_page.get_connect_google_link() == 'https://play.google.com/store/apps/details?id=org.jimber.threebotlogin&hl=en&gl=US'
assert dashboard_page.get_connect_apple_link() == 'https://apps.apple.com/us/app/threefold-connect/id1459845885'
assert dashboard_page.get_connect_apple_link() == 'https://apps.apple.com/us/app/threefold-connect/id1459845885'
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ def test_twin_id(browser):
cases = [' ', generate_string(), invalid_address(), generate_leters()]
for case in cases:
transfer_page.recipient_id_input(case)
assert transfer_page.wait_for('Twin ID should be a number')
assert transfer_page.wait_for('Twin ID should be a valid integer')
assert transfer_page.get_id_submit().is_enabled() == False
cases = ['0', '-52']
for case in cases:
transfer_page.recipient_id_input(case)
assert transfer_page.wait_for('Twin ID should be more than 0')
assert transfer_page.wait_for('Twin ID should be greater than zero')
assert transfer_page.get_id_submit().is_enabled() == False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ def get_twin_node(self, twin_id):
r = requests.post(Base.gridproxy_url + 'nodes?farm_ids=' + farms[:-1])
details = r.json()
return details


def get_stats_capicity(self):
r = requests.post('https://stats.' + Base.net + '.grid.tf/api/stats-summary', timeout=10)
stats_json = r.json()
return list(stats_json.values())

def get_stats(self):
up = requests.get(Base.gridproxy_url + 'stats?status=up', timeout=10).json()
Expand Down Expand Up @@ -94,4 +98,4 @@ def get_stats(self):
total_countries = len(merged_distribution) # Total unique countries
merged_data['countries'] = total_countries
# Return the dictionary directly
return merged_data
return merged_data

0 comments on commit b985629

Please sign in to comment.