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 1, 2023
1 parent 12f366e commit 8ad8124
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 2 deletions.
6 changes: 5 additions & 1 deletion test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@
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}
scrollArea_groupBox_QGroupBox = {"container": stack_scrollArea_QScrollArea, "name": "groupBox", "type": "QGroupBox", "visible": 1}
oCC_AboutDialog_OCC_AboutDialog = {"name": "OCC__AboutDialog", "type": "OCC::AboutDialog", "visible": 1}
109 changes: 109 additions & 0 deletions test/gui/shared/scripts/pageObjects/Settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import names
import squish


class Settings:
GENERAL_OPTIONS_ITEM = {
"container": names.scrollArea_generalGroupBox_QGroupBox,
"type": "QCheckBox",
"visible": 1,
}
ADVANCED_OPTIONS_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QCheckBox",
"visible": 1,
}
NETWORK_OPTIONS_ITEM = {
"container": names.scrollArea_groupBox_QGroupBox,
"type": "QGroupBox",
"visible": 1,
}
ABOUT_BUTTON = {
"container": names.settings_stack_QStackedWidget,
"name": "about_pushButton",
"type": "QPushButton",
"visible": 1,
}
ABOUT_OWNCLOUD_DIALOG = {
"name": "tabWidget",
"type": "QTabWidget",
"visible": 1,
"window": names.oCC_AboutDialog_OCC_AboutDialog,
}

GENERAL_OPTIONS_MAP = {
"Start on Login": "autostartCheckBox",
"Use Monochrome Icons in the system tray": "monoIconsCheckBox",
"Language": "languageLabel",
"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 getGeneralOptionSelector(name):
selector = Settings.GENERAL_OPTIONS_ITEM.copy()
selector.update({"name": name})
if name == "languageLabel":
selector.update({"type": "QLabel"})
return selector

@staticmethod
def getAdvancedOptionSelector(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 getNetworkOptionSelector(name):
selector = Settings.NETWORK_OPTIONS_ITEM.copy()
selector.update({"name": name})
return selector

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

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

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

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

@staticmethod
def isAboutButtonVisible():
if squish.waitForObject(Settings.ABOUT_BUTTON):
return True
return False

@staticmethod
def waitForAboutDialogToBeVisible():
squish.waitForObjectExists(Settings.ABOUT_OWNCLOUD_DIALOG)

@staticmethod
def closeAboutOwncloudDialog():
squish.sendEvent(
"QCloseEvent", squish.waitForObject(Settings.ABOUT_OWNCLOUD_DIALOG)
)
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.checkGeneralOption(item[0])


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


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


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


@Then('the about dialog should be opened')
def step(context):
Settings.waitForAboutDialogToBeVisible()
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 setting tab shows the setting options
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 8ad8124

Please sign in to comment.