From 3d4d6d569dec7b6c2a454039b9baa4f4aa822a5f Mon Sep 17 00:00:00 2001 From: ramezsaeed Date: Sun, 5 Jan 2025 14:51:26 +0200 Subject: [PATCH] fix hompepage tests (#3773) --- .../tests/frontend_selenium/pages/dashboard.py | 9 +++++---- .../frontend_selenium/tests/TFChain/test_homepage.py | 10 +++++----- .../tests/frontend_selenium/utils/grid_proxy.py | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/playground/tests/frontend_selenium/pages/dashboard.py b/packages/playground/tests/frontend_selenium/pages/dashboard.py index 8778999278..a6af0ec7a7 100644 --- a/packages/playground/tests/frontend_selenium/pages/dashboard.py +++ b/packages/playground/tests/frontend_selenium/pages/dashboard.py @@ -36,16 +36,16 @@ class DashboardPage: login_button = (By.XPATH, "//button[.//span[text()='Login']]") login_password_input = (By.XPATH, "//label[text()='Password']/following-sibling::input") accept_terms_condition_button = (By.XPATH, "//button[.//span[text()='Accept terms and conditions']]") - connect_manual_button = (By.XPATH, "//p[@class='mb-4 text-center']/a") - connect_google_button = (By.XPATH, "//a[@title='play-store']") - connect_apple_button = (By.XPATH, "//a[@title='app-store']") + connect_manual_button = (By.XPATH,"//*[contains(text(), 'Threefold Connect')]") + connect_google_button = (By.XPATH, "//a[@title='Threefold Connect on Google Play Store']") + connect_apple_button = (By.XPATH, "//a[@title='Threefold Connect on Apple App Store']") iframe_load_label = (By.XPATH, "//*[contains(text(), 'THESE TERMS AND CONDITIONS')]") mnemonic_input_reveal_button = (By.XPATH, "//i[@aria-label='Your Mnemonic appended action']") mnemonic_login_label = (By.XPATH, "//label[text()='Your Mnemonic']/following-sibling::input") 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, "//p[contains(@class, 'text-center') and following-sibling::p[text()='Capacity']]") + capacity_stats = (By.XPATH, "//p[contains(@class, 'text-center') and following-sibling::p[text()='SSD 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']]") @@ -210,6 +210,7 @@ def manual_link(self): WebDriverWait(self.browser, 30).until(EC.visibility_of_element_located(self.logout_button)) WebDriverWait(self.browser, 30).until(EC.presence_of_element_located(self.qr_code_img)) WebDriverWait(self.browser, 30).until(EC.element_to_be_clickable(self.connect_manual_button)) + WebDriverWait(self.browser, 30).until(EC.element_to_be_clickable(self.manual_button)) WebDriverWait(self.browser, 30).until(EC.element_to_be_clickable(self.manual_button)).click() return self.get_link() diff --git a/packages/playground/tests/frontend_selenium/tests/TFChain/test_homepage.py b/packages/playground/tests/frontend_selenium/tests/TFChain/test_homepage.py index 8cfb1b3604..9120a365eb 100644 --- a/packages/playground/tests/frontend_selenium/tests/TFChain/test_homepage.py +++ b/packages/playground/tests/frontend_selenium/tests/TFChain/test_homepage.py @@ -5,7 +5,7 @@ from utils.base import Base import pytest -# Time required for the run (12 cases) is approximately 2 minutes. +# Time required for the run (8 cases) is approximately 03:40 minutes. def before_test_setup(browser): @@ -50,7 +50,6 @@ def test_tft_price(browser): assert 0.99 < tft_in_usd * usd_in_tft < 1.1 -@pytest.mark.skip(reason="https://github.com/threefoldtech/tfgrid-sdk-ts/issues/3753") def test_stats(browser): """ Test Case: TC1674 - TFT stats @@ -118,7 +117,7 @@ def test_create_account(browser): dashboard_page.logout_account() assert dashboard_page.wait_for_button(dashboard_page.login_account(password)).is_enabled() == True -@pytest.mark.skip(reason="https://github.com/threefoldtech/tfgrid-sdk-ts/issues/3753") + def test_account_validation(browser): """ Test Cases: TC1777 - Connect your wallet Validation @@ -153,7 +152,7 @@ def test_account_validation(browser): assert dashboard_page.wait_for('Passwords should match') dashboard_page.click_button(dashboard_page.connect_your_wallet(get_email(), '123456')) dashboard_page.open_profile() - assert dashboard_page.manual_link() == 'https://www.manual.grid.tf/documentation/threefold_token/storing_tft/tf_connect_app.html' + assert dashboard_page.manual_link() == 'https://www.manual.grid.tf/documentation/dashboard/wallet_connector.html' assert dashboard_page.get_mnemonic() == get_seed() assert dashboard_page.get_email() == get_email() assert grid_proxy.get_twin_address(dashboard_page.get_id()) == dashboard_page.get_address() @@ -167,7 +166,7 @@ def test_account_validation(browser): assert dashboard_page.wait_for('Password is required') assert dashboard_page.wait_for_button(dashboard_page.login_account('123456')).is_enabled() == True -@pytest.mark.skip(reason="https://github.com/threefoldtech/tfgrid-sdk-ts/issues/3753") + def test_login_links(browser): """ Test Case: TC1801 - Verify login profile manager links @@ -183,6 +182,7 @@ def test_login_links(browser): dashboard_page.import_account(get_seed()) dashboard_page.click_button(dashboard_page.connect_your_wallet(get_email(), password)) dashboard_page.open_profile() + assert dashboard_page.manual_link() == 'https://www.manual.grid.tf/documentation/dashboard/wallet_connector.html' 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' diff --git a/packages/playground/tests/frontend_selenium/utils/grid_proxy.py b/packages/playground/tests/frontend_selenium/utils/grid_proxy.py index 4f301144c8..19cfee8f4f 100644 --- a/packages/playground/tests/frontend_selenium/utils/grid_proxy.py +++ b/packages/playground/tests/frontend_selenium/utils/grid_proxy.py @@ -69,7 +69,7 @@ def get_stats_capicity(self): stats_url = 'https://stats.' + Base.net + '.grid.tf/api/stats-summary' r = requests.post(stats_url, timeout=10) stats_json = r.json() - return list(stats_json.values()) + return list(stats_json.values())[1::] #Avoid selecting HDD capacity; as its not shown in the dashboard anymore. def get_stats(self): up = requests.get(Base.gridproxy_url + 'stats?status=up', timeout=10).json()