Skip to content

Commit

Permalink
[Tests Only] add test for enable/disable vfs (#8835)
Browse files Browse the repository at this point in the history
* [Tests Only] add test for vfs

* add test for disabling vfs

* vfs object from model

* make code DRY

* added few comment for coordinates
  • Loading branch information
swoichha authored Aug 9, 2021
1 parent 71f42ce commit e9ae93e
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 2 deletions.
5 changes: 4 additions & 1 deletion test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@
o_tableView_0_1_QModelIndex = {"column": 1, "container": oCC_IssuesWidget_tableView_QTableView, "row": 0, "type": "QModelIndex"}
settings_settingsdialog_toolbutton_Add_account_QToolButton = {"name": "settingsdialog_toolbutton_Add account", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog}
settings_settingsdialog_toolbutton_Activity_QToolButton = {"name": "settingsdialog_toolbutton_Activity", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog}
sharingDialog_Close_QPushButton = {"text": "Close", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": sharingDialog_OCC_ShareDialog}
sharingDialog_Close_QPushButton = {"text": "Close", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": sharingDialog_OCC_ShareDialog}
stack_Enable_experimental_placeholder_mode_QPushButton = {"container": settings_stack_QStackedWidget, "text": "Enable experimental placeholder mode", "type": "QPushButton", "unnamed": 1, "visible": 1}
disable_virtual_file_support_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Disable virtual file support?"}
disable_virtual_file_support_Disable_support_QPushButton = {"text": "Disable support", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": disable_virtual_file_support_QMessageBox}
62 changes: 62 additions & 0 deletions test/gui/shared/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,3 +744,65 @@ def step(context, resource, content):

print("file has been overwritten")
waitForFileToBeSynced(context, resource)


def enableVFSSupport(vfsBtnText):
# The enabling/disabling VFS button do not have it's own object
# But it is inside the "stack_folderList_QTreeView" object.
# So we are clicking at (718, 27) of "stack_folderList_QTreeView" object to enable/disable VFS
mouseClick(
waitForObjectItem(names.stack_folderList_QTreeView, "_1"),
718,
27,
Qt.NoModifier,
Qt.LeftButton,
)
activateItem(waitForObjectItem(names.settings_QMenu, vfsBtnText))
clickButton(
waitForObject(names.stack_Enable_experimental_placeholder_mode_QPushButton)
)


@When("the user enables virtual file support")
def step(context):
enableVFSSupport("Enable virtual file support (experimental)...")


@Then('the "|any|" button should be available')
def step(context, btnText):
# The enabling/disabling VFS button do not have it's own object
# But it is inside the "stack_folderList_QTreeView" object.
# So we are clicking at (718, 27) of "stack_folderList_QTreeView" object to enable/disable VFS
mouseClick(
waitForObjectItem(names.stack_folderList_QTreeView, "_1"),
718,
27,
Qt.NoModifier,
Qt.LeftButton,
)
waitForObjectItem(names.settings_QMenu, btnText)


@Given("the user has enabled virtual file support")
def step(context):
enableVFSSupport("Enable virtual file support (experimental)...")


@When("the user disables virtual file support")
def step(context):
# The enabling/disabling VFS button do not have it's own object
# But it is inside the "stack_folderList_QTreeView" object.
# So we are clicking at (718, 27) of "stack_folderList_QTreeView" object to enable/disable VFS
mouseClick(
waitForObjectItem(names.stack_folderList_QTreeView, "_1"),
733,
27,
Qt.NoModifier,
Qt.LeftButton,
)
activateItem(
waitForObjectItem(names.settings_QMenu, "Disable virtual file support...")
)
clickButton(
waitForObject(names.disable_virtual_file_support_Disable_support_QPushButton)
)
2 changes: 1 addition & 1 deletion test/gui/suite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout tst_removeAccountConnection tst_checkAlltabs
TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout tst_removeAccountConnection tst_checkAlltabs tst_vfs
VERSION=3
WRAPPERS=Qt
20 changes: 20 additions & 0 deletions test/gui/tst_vfs/test.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Feature: Enable/disable virtual file support

As a user
I want to enable virtual file support
So that I can synchronize virtual files with local folder


Scenario: Enable VFS
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 enables virtual file support
Then the "Disable virtual file support..." button should be available


Scenario: Disable VFS
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
And the user has enabled virtual file support
When the user disables virtual file support
Then the "Enable virtual file support (experimental)..." button should be available
9 changes: 9 additions & 0 deletions test/gui/tst_vfs/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source(findFile('scripts', 'python/bdd.py'))

setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')


def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')

0 comments on commit e9ae93e

Please sign in to comment.