Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTalank <talank@gces.edu.np>2021-06-03 07:12:49 +0300
committerGitHub <noreply@github.com>2021-06-03 07:12:49 +0300
commit93cd5462138c6c7067d720af071f394efc3000d8 (patch)
treefcfb76fc61f6d6b12ca40e979c4a837395e52205 /test
parentf93b10750942df73a1fbead6cc0837b1c683b141 (diff)
POM implementation in the syncing tests (#8655)
Diffstat (limited to 'test')
-rw-r--r--test/gui/shared/scripts/helpers/FilesHelper.py11
-rw-r--r--test/gui/shared/scripts/names.py2
-rw-r--r--test/gui/shared/scripts/pageObjects/Activity.py30
-rw-r--r--test/gui/shared/scripts/pageObjects/SyncWizard.py17
-rw-r--r--test/gui/shared/scripts/pageObjects/Toolbar.py14
-rw-r--r--test/gui/shared/steps/steps.py51
6 files changed, 86 insertions, 39 deletions
diff --git a/test/gui/shared/scripts/helpers/FilesHelper.py b/test/gui/shared/scripts/helpers/FilesHelper.py
new file mode 100644
index 000000000..10d29cdda
--- /dev/null
+++ b/test/gui/shared/scripts/helpers/FilesHelper.py
@@ -0,0 +1,11 @@
+def buildConflictedRegex(filename):
+ if '.' in filename:
+ # TODO: improve this for complex filenames
+ namepart = filename.split('.')[0]
+ extpart = filename.split('.')[1]
+ return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)\.%s' % (
+ namepart,
+ extpart,
+ )
+ else:
+ return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)' % (filename)
diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py
index d25961616..3d06adeb6 100644
--- a/test/gui/shared/scripts/names.py
+++ b/test/gui/shared/scripts/names.py
@@ -55,7 +55,6 @@ proxyGroupBox_authRequiredcheckBox_QCheckBox = {"container": groupBox_proxyGroup
proxyGroupBox_labelLocalhost_QLabel = {"container": groupBox_proxyGroupBox_QGroupBox, "name": "labelLocalhost", "type": "QLabel", "visible": 1}
groupBox_uploadBox_QGroupBox = {"container": scrollArea_groupBox_QGroupBox, "name": "uploadBox", "type": "QGroupBox", "visible": 1}
uploadBox_autoUploadLimitRadioButton_QRadioButton = {"container": groupBox_uploadBox_QGroupBox, "name": "autoUploadLimitRadioButton", "type": "QRadioButton", "visible": 1}
-settings_settingsdialog_toolbutton_Activity_QToolButton = {"name": "settingsdialog_toolbutton_Activity", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog}
stack_qt_tabwidget_stackedwidget_QStackedWidget = {"container": settings_stack_QStackedWidget, "name": "qt_tabwidget_stackedwidget", "type": "QStackedWidget", "visible": 1}
qt_tabwidget_stackedwidget_OCC_ActivityWidget_OCC_ActivityWidget = {"container": stack_qt_tabwidget_stackedwidget_QStackedWidget, "name": "OCC__ActivityWidget", "type": "OCC::ActivityWidget", "visible": 1}
oCC_ActivityWidget_activityList_QListView = {"container": qt_tabwidget_stackedwidget_OCC_ActivityWidget_OCC_ActivityWidget, "name": "_activityList", "type": "QListView", "visible": 1}
@@ -70,7 +69,6 @@ o_folderList_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView
qt_tabwidget_stackedwidget_OCC_IssuesWidget_OCC_IssuesWidget = {"container": stack_qt_tabwidget_stackedwidget_QStackedWidget, "name": "OCC__IssuesWidget", "type": "OCC::IssuesWidget", "visible": 1}
oCC_IssuesWidget_treeWidget_QTreeWidget = {"container": qt_tabwidget_stackedwidget_OCC_IssuesWidget_OCC_IssuesWidget, "name": "_treeWidget", "type": "QTreeWidget", "visible": 1}
o_treeWidget_lorem_conflicted_copy_2020_12_14_133239_txt_QModelIndex = {"column": 1, "container": oCC_IssuesWidget_treeWidget_QTreeWidget, "text": RegularExpression("lorem (conflicted copy 2020-12-14 133239).txt"), "type": "QModelIndex"}
-stack_QTabWidget = {"container": settings_stack_QStackedWidget, "type": "QTabWidget", "unnamed": 1, "visible": 1}
scrollArea_sharedWith_QLabel = {"container": sharingDialogUG_scrollArea_QScrollArea, "name": "sharedWith", "type": "QLabel", "visible": 1}
scrollArea_permissionsEdit_QCheckBox = {"container": sharingDialogUG_scrollArea_QScrollArea, "name": "permissionsEdit", "type": "QCheckBox", "visible": 1}
scrollArea_permissionShare_QCheckBox = {"container": sharingDialogUG_scrollArea_QScrollArea, "name": "permissionShare", "type": "QCheckBox", "visible": 1}
diff --git a/test/gui/shared/scripts/pageObjects/Activity.py b/test/gui/shared/scripts/pageObjects/Activity.py
new file mode 100644
index 000000000..1ec71db9e
--- /dev/null
+++ b/test/gui/shared/scripts/pageObjects/Activity.py
@@ -0,0 +1,30 @@
+import names
+import squish
+from objectmaphelper import RegularExpression
+from helpers.FilesHelper import buildConflictedRegex
+
+
+class Activity:
+ SUBTAB = {
+ "container": names.settings_stack_QStackedWidget,
+ "type": "QTabWidget",
+ "unnamed": 1,
+ "visible": 1,
+ }
+
+ def clickTab(self, tabName):
+ # TODO: find some way to dynamically select the tab name
+ # It might take some time for all files to sync except the expected number of unsynced files
+ squish.snooze(10)
+ squish.clickTab(squish.waitForObject(self.SUBTAB), tabName)
+
+ def checkFileExist(self, filename):
+ squish.waitForObject(names.settings_OCC_SettingsDialog)
+ squish.waitForObjectExists(
+ {
+ "column": 1,
+ "container": names.oCC_IssuesWidget_tableView_QTableView,
+ "text": RegularExpression(buildConflictedRegex(filename)),
+ "type": "QModelIndex",
+ }
+ )
diff --git a/test/gui/shared/scripts/pageObjects/SyncWizard.py b/test/gui/shared/scripts/pageObjects/SyncWizard.py
new file mode 100644
index 000000000..8dcf94336
--- /dev/null
+++ b/test/gui/shared/scripts/pageObjects/SyncWizard.py
@@ -0,0 +1,17 @@
+import names
+import squish
+
+
+class SyncWizard:
+ ACTION_MENU = {
+ "container": names.settings_stack_QStackedWidget,
+ "name": "_folderList",
+ "type": "QTreeView",
+ "visible": 1,
+ }
+
+ def performAction(self, action):
+ squish.openContextMenu(
+ squish.waitForObjectItem(self.ACTION_MENU, "_1"), 0, 0, squish.Qt.NoModifier
+ )
+ squish.activateItem(squish.waitForObjectItem(names.settings_QMenu, action))
diff --git a/test/gui/shared/scripts/pageObjects/Toolbar.py b/test/gui/shared/scripts/pageObjects/Toolbar.py
new file mode 100644
index 000000000..6a46e534e
--- /dev/null
+++ b/test/gui/shared/scripts/pageObjects/Toolbar.py
@@ -0,0 +1,14 @@
+import names
+import squish
+
+
+class Toolbar:
+ ACTIVITY_BUTTON = {
+ "name": "settingsdialog_toolbutton_Activity",
+ "type": "QToolButton",
+ "visible": 1,
+ "window": names.settings_OCC_SettingsDialog,
+ }
+
+ def clickActivity(self):
+ squish.clickButton(squish.waitForObject(self.ACTIVITY_BUTTON))
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index 471d9349c..3cef9e9a4 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -11,9 +11,13 @@ import json
from objectmaphelper import RegularExpression
from pageObjects.AccountConnectionWizard import AccountConnectionWizard
from helpers.SetupClientHelper import *
+from helpers.FilesHelper import buildConflictedRegex
from pageObjects.EnterPassword import EnterPassword
from pageObjects.PublicLinkDialog import PublicLinkDialog
from pageObjects.SharingDialog import SharingDialog
+from pageObjects.SyncWizard import SyncWizard
+from pageObjects.Toolbar import Toolbar
+from pageObjects.Activity import Activity
# the script needs to use the system wide python
@@ -281,10 +285,8 @@ def step(context):
lambda: isFolderSynced(context.userData['clientSyncPath']),
context.userData['clientSyncTimeout'] * 1000,
)
- openContextMenu(
- waitForObjectItem(names.stack_folderList_QTreeView, "_1"), 0, 0, Qt.NoModifier
- )
- activateItem(waitForObjectItem(names.settings_QMenu, "Pause sync"))
+ syncWizard = SyncWizard()
+ syncWizard.performAction("Pause sync")
@Given('the user has changed the content of local file "|any|" to:')
@@ -297,10 +299,8 @@ def step(context, filename):
@When('the user resumes the file sync on the client')
def step(context):
- openContextMenu(
- waitForObjectItem(names.stack_folderList_QTreeView, "_1"), 0, 0, Qt.NoModifier
- )
- activateItem(waitForObjectItem(names.settings_QMenu, "Resume sync"))
+ syncWizard = SyncWizard()
+ syncWizard.performAction("Resume sync")
@When('the user triggers force sync on the client')
@@ -344,9 +344,8 @@ def step(context, filename):
@When('the user clicks on the activity tab')
def step(context):
- clickButton(
- waitForObject(names.settings_settingsdialog_toolbutton_Activity_QToolButton)
- )
+ toolbar = Toolbar()
+ toolbar.clickActivity()
@Then('a conflict warning should be shown for |integer| files')
@@ -369,38 +368,16 @@ def step(context, files):
)
-def buildConflictedRegex(filename):
- if '.' in filename:
- # TODO: improve this for complex filenames
- namepart = filename.split('.')[0]
- extpart = filename.split('.')[1]
- return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)\.%s' % (
- namepart,
- extpart,
- )
- else:
- return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)' % (filename)
-
-
@Then('the table of conflict warnings should include file "|any|"')
def step(context, filename):
- waitForObject(names.settings_OCC_SettingsDialog)
- waitForObjectExists(
- {
- "column": 1,
- "container": names.oCC_IssuesWidget_tableView_QTableView,
- "text": RegularExpression(buildConflictedRegex(filename)),
- "type": "QModelIndex",
- }
- )
+ activity = Activity()
+ activity.checkFileExist(filename)
@When('the user selects the unsynced files tab')
def step(context):
- # TODO: find some way to dynamically select the tab name
- # It might take some time for all files to sync except the expected number of unsynced files
- snooze(10)
- clickTab(waitForObject(names.stack_QTabWidget), "Not Synced")
+ activity = Activity()
+ activity.clickTab("Not Synced")
def openSharingDialog(context, resource, itemType='file'):