Skip to content

Commit

Permalink
add test for verifying options of settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Nov 7, 2023
1 parent 0cb0f27 commit 74b5c46
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@
o_folderList_ownCloud_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "ownCloud", "type": "QModelIndex"}
contentWidget_contentWidget_QStackedWidget = {"container": setupWizardWindow_contentWidget_QStackedWidget, "name": "contentWidget", "type": "QStackedWidget", "visible": 1}
o_folderList_Personal_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "Personal", "type": "QModelIndex"}
add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard}
add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard}
stack_scrollArea_QScrollArea = {"container": settings_stack_QStackedWidget, "name": "scrollArea", "type": "QScrollArea", "visible": 1}
scrollArea_generalGroupBox_QGroupBox = {"container": stack_scrollArea_QScrollArea, "name": "generalGroupBox", "type": "QGroupBox", "visible": 1}
107 changes: 107 additions & 0 deletions test/gui/shared/scripts/pageObjects/Settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import names
import squish


class Settings:
GENERAL_OPTIONS_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QCheckBox",
"visible": 1,
}
ADVANCED_OPTIONS_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QCheckBox",
"visible": 1,
}
NETWORK_OPTIONS_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QGroupBox",
"visible": 1,
}
ABOUT_BUTTON = {
"container": names.settings_stack_QStackedWidget,
"name": "about_pushButton",
"type": "QPushButton",
"visible": 1,
}
ABOUT_DIALOG = {
"name": "OCC__AboutDialog",
"type": "OCC::AboutDialog",
"visible": 1,
}
ABOUT_DIALOG_OK_BUTTON = {
"text": "OK",
"type": "QPushButton",
"unnamed": 1,
"visible": 1,
"window": ABOUT_DIALOG,
}

GENERAL_OPTIONS_MAP = {
"Start on Login": "autostartCheckBox",
"Use Monochrome Icons in the system tray": "monoIconsCheckBox",
"Language": "languageDropdown",
"Show desktop Notifications": "desktopNotificationsCheckBox",
}
ADVANCED_OPTION_MAP = {
"Sync hidden files": "syncHiddenFilesCheckBox",
"Show crash reporter": "",
"Edit ignored files": "ignoredFilesButton",
"Log settings": "logSettingsButton",
"Ask for confirmation before synchronizing folders larger than 500 MB": "newFolderLimitCheckBox",
"Ask for confirmation before synchronizing external storages": "newExternalStorage",
}
NETWORK_OPTION_MAP = {
"Proxy Settings": "proxyGroupBox",
"Download Bandwidth": "downloadBox",
"Upload Bandwidth": "uploadBox",
}

@staticmethod
def get_general_option_selector(name):
selector = Settings.GENERAL_OPTIONS_ITEM.copy()
selector.update({"name": name})
if name == "languageDropdown":
selector.update({"type": "QComboBox"})
return selector

@staticmethod
def get_advanced_option_selector(name):
selector = Settings.ADVANCED_OPTIONS_ITEM.copy()
selector.update({"name": name})
if name == "ignoredFilesButton" or name == "logSettingsButton":
selector.update({"type": "QPushButton"})
return selector

@staticmethod
def get_network_option_selector(name):
selector = Settings.NETWORK_OPTIONS_ITEM.copy()
selector.update({"name": name})
return selector

@staticmethod
def check_general_option(option):
selector = Settings.GENERAL_OPTIONS_MAP[option]
squish.waitForObjectExists(Settings.get_general_option_selector(selector))

@staticmethod
def check_advanced_option(option):
selector = Settings.ADVANCED_OPTION_MAP[option]
squish.waitForObjectExists(Settings.get_advanced_option_selector(selector))

@staticmethod
def check_network_option(option):
selector = Settings.NETWORK_OPTION_MAP[option]
squish.waitForObjectExists(Settings.get_network_option_selector(selector))

@staticmethod
def open_about_button():
squish.clickButton(squish.waitForObject(Settings.ABOUT_BUTTON))

@staticmethod
def wait_for_about_dialog_to_be_visible():
squish.waitForObjectExists(Settings.ABOUT_DIALOG)

@staticmethod
def close_about_dialog():
squish.clickButton(squish.waitForObjectExists(Settings.ABOUT_DIALOG_OK_BUTTON))
4 changes: 4 additions & 0 deletions test/gui/shared/scripts/pageObjects/Toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ def getDisplayedAccountText(displayname, host):
Toolbar.getItemSelector(displayname + "@" + host)
).text
)

@staticmethod
def openSettingsTab():
squish.clickButton(squish.waitForObject(Toolbar.getItemSelector("Settings")))
5 changes: 5 additions & 0 deletions test/gui/shared/steps/server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,8 @@ def step(context, user, folder_name):
@Given('user "|any|" has uploaded file with content "|any|" to "|any|" in the server')
def step(context, user, file_content, file_name):
webdav.create_file(user, file_name, file_content)


@When("the user clicks on the settings tab")
def step(context):
Toolbar.openSettingsTab()
29 changes: 29 additions & 0 deletions test/gui/shared/steps/sync_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pageObjects.SyncConnection import SyncConnection
from pageObjects.Toolbar import Toolbar
from pageObjects.Activity import Activity
from pageObjects.Settings import Settings

from helpers.SetupClientHelper import getResourcePath
from helpers.ConfigHelper import get_config
Expand Down Expand Up @@ -173,3 +174,31 @@ def step(context, folderName):
@When('the user syncs the "|any|" space')
def step(context, spaceName):
SyncConnectionWizard.syncSpace(spaceName)


@Then('the settings tab should have the following options in the general section:')
def step(context):
for item in context.table:
Settings.check_general_option(item[0])


@Then('the settings tab should have the following options in the advanced section:')
def step(context):
for item in context.table:
Settings.check_advanced_option(item[0])


@Then('the settings tab should have the following options in the network section:')
def step(context):
for item in context.table:
Settings.check_network_option(item[0])


@When('the user opens the about dialog')
def step(context):
Settings.open_about_button()


@Then('the about dialog should be opened')
def step(context):
Settings.wait_for_about_dialog_to_be_visible()
25 changes: 24 additions & 1 deletion test/gui/tst_checkAlltabs/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,27 @@ Feature: Visually check all tabs
Given user "Alice" has been created on the server with default attributes and without skeleton files
And user "Alice" has set up a client with default settings
When the user presses the "Ctrl+l" keys
Then the log dialog should be opened
Then the log dialog should be opened


Scenario: Verify various setting options in Settings tab
Given user "Alice" has been created on the server with default attributes and without skeleton files
And user "Alice" has set up a client with default settings
When the user clicks on the settings tab
Then the settings tab should have the following options in the general section:
| Start on Login |
| Use Monochrome Icons in the system tray |
| Show desktop Notifications |
| Language |
And the settings tab should have the following options in the advanced section:
| Sync hidden files |
| Edit ignored files |
| Log settings |
| Ask for confirmation before synchronizing folders larger than 500 MB |
| Ask for confirmation before synchronizing external storages |
And the settings tab should have the following options in the network section:
| Proxy Settings |
| Download Bandwidth |
| Upload Bandwidth |
When the user opens the about dialog
Then the about dialog should be opened

0 comments on commit 74b5c46

Please sign in to comment.