Skip to content

Commit

Permalink
Correct Broken folder_list selenium tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow243 authored and josaphatim committed Aug 27, 2024
1 parent a2e7572 commit 6644dd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/tests/selenium/creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.BinaryLocation = "/usr/bin/google-chrome"
chrome_options.add_argument("--window-size=3200,3800")

chrome_options.headless = False
chrome_options.add_argument("start-maximized")
Expand Down
28 changes: 19 additions & 9 deletions tests/selenium/folder_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def __init__(self):
self.wait_with_folder_list()

def reload_folder_list(self):
assert self.by_class('main_menu').text == 'Main'
assert self.by_class('main_menu').text.startswith('Main')
self.by_class('update_message_list').click()
self.safari_workaround(3)
assert self.by_class('main_menu').text == 'Main'
assert self.by_class('main_menu').text.startswith('Main')

def expand_section(self):
self.by_css('[data-source=".settings"]').click()
Expand All @@ -31,15 +31,25 @@ def collapse_section(self):
assert link.is_displayed() == False

def hide_folders(self):
self.by_class('hide_folders').click()
self.driver.execute_script("window.scrollBy(0, 1000);")
self.wait(By.CLASS_NAME, 'hide_folders')
# Use JavaScript to click the element
hide_button = self.by_class('hide_folders')
self.driver.execute_script("arguments[0].click();", hide_button)
assert self.by_class('folder_toggle').text.startswith('Show folders')
list_item = self.by_class('menu_home')
link = list_item.find_element(By.TAG_NAME, 'a');
assert link.is_displayed() == False

def show_folders(self):
self.by_class('folder_toggle').click()
folder_toggle = self.by_class('folder_toggle')
self.driver.execute_script("arguments[0].click();", folder_toggle)
self.wait(By.CLASS_NAME, 'main_menu')
self.by_css('[data-source=".settings"]').click()
list_item = self.by_class('menu_home')
list_item.find_element(By.TAG_NAME, 'a').click()
a_tag = list_item.find_element(By.TAG_NAME, 'a')
self.driver.execute_script("arguments[0].scrollIntoView(true);", a_tag)
self.driver.execute_script("arguments[0].click();", a_tag)
self.wait_with_folder_list()
assert self.by_class('content_title').text == 'Home'
self.by_css('[data-source=".main"]').click()
Expand All @@ -49,10 +59,10 @@ def show_folders(self):

print("FOLDER LIST TESTS")
test_runner(FolderListTests, [
#'reload_folder_list',
'reload_folder_list',
'expand_section',
'collapse_section',
# 'hide_folders',
# 'show_folders',
# 'logout'
'hide_folders',
'show_folders',
'logout'
])

0 comments on commit 6644dd4

Please sign in to comment.