Skip to content

Commit d5fd07f

Browse files
modSpikeishabaral
andauthored
Squish updates for new folders gui (#12471)
* break squish this reveals the new folders gui against which the tests should be updated * test: update squish selectors * update object names on message boxes including the buttons inside. * test: update squish selectors with human readable text --------- Co-authored-by: ishabaral <baralisha.16@gmail.com>
1 parent 381bc32 commit d5fd07f

7 files changed

Lines changed: 53 additions & 43 deletions

File tree

src/gui/FoldersGui/accountfolderscontroller.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,11 @@ void AccountFoldersController::onEnableVfs()
206206
"\n\n"
207207
"This action will abort any currently running synchronization."),
208208
QMessageBox::Yes | QMessageBox::No, ocApp()->gui()->settingsDialog());
209+
msgBox.setObjectName("confirmDisableVfsDialog");
209210
msgBox.button(QMessageBox::Yes)->setText(tr("Disable support"));
211+
msgBox.button(QMessageBox::Yes)->setObjectName("disableVfsButton");
210212
msgBox.button(QMessageBox::No)->setText(tr("Cancel"));
213+
msgBox.button(QMessageBox::No)->setObjectName("cancelDisableVfsButton");
211214

212215
int result = msgBox.exec();
213216
if (result == QDialog::Rejected)
@@ -285,6 +288,9 @@ void AccountFoldersController::onForceSync()
285288
tr("Synchronization is paused because the Internet connection is a metered connection"
286289
"<p>Do you really want to force a Synchronization now?"),
287290
QMessageBox::Yes | QMessageBox::No, ocApp()->gui()->settingsDialog());
291+
messageBox.setObjectName("confirmForceSyncWhenMeteredDialog");
292+
messageBox.button(QMessageBox::No)->setObjectName("cancelForceSyncWhenMeteredButton");
293+
messageBox.button(QMessageBox::Yes)->setObjectName("forceSyncWhenMeteredButton");
288294
int result = messageBox.exec();
289295
if (result == QMessageBox::No)
290296
return;
@@ -305,6 +311,9 @@ void AccountFoldersController::onTogglePauseSync()
305311
QMessageBox msgbox(QMessageBox::Question, tr("Sync Running"), tr("The sync operation is running.<br/>Do you want to stop it?"),
306312
QMessageBox::Yes | QMessageBox::No, ocApp()->gui()->settingsDialog());
307313
msgbox.setDefaultButton(QMessageBox::No);
314+
msgbox.setObjectName("confirmPauseRunningSyncDialog");
315+
msgbox.button(QMessageBox::Yes)->setObjectName("pauseRunningSyncButton");
316+
msgbox.button(QMessageBox::No)->setObjectName("cancelPausRunningSyncButton");
308317
int result = msgbox.exec();
309318
if (result == QMessageBox::No)
310319
return;
@@ -333,6 +342,9 @@ void AccountFoldersController::onRemoveSync()
333342
QMessageBox::Yes | QMessageBox::No, ocApp()->gui()->settingsDialog());
334343
msgBox.button(QMessageBox::Yes)->setText(tr("Remove Folder Sync Connection"));
335344
msgBox.button(QMessageBox::No)->setText(tr("Cancel"));
345+
msgBox.setObjectName("confirmRemoveFolderSyncDialog");
346+
msgBox.button(QMessageBox::Yes)->setObjectName("removeFolderSyncButton");
347+
msgBox.button(QMessageBox::No)->setObjectName("cancelRemoveFolderSyncButton");
336348

337349
int result = msgBox.exec();
338350
if (result == QMessageBox::No)

src/gui/accountview.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,12 @@ void AccountView::slotDeleteAccount()
378378
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>")
379379
.arg(_accountState->account()->displayNameWithHost()),
380380
QMessageBox::NoButton, this);
381+
messageBox->setObjectName("confirmRemoveAccountDialog");
381382
auto yesButton = messageBox->addButton(tr("Remove connection"), QMessageBox::YesRole);
382-
messageBox->addButton(tr("Cancel"), QMessageBox::NoRole);
383+
yesButton->setObjectName("removeAccountButton");
384+
auto noButton = messageBox->addButton(tr("Cancel"), QMessageBox::NoRole);
385+
noButton->setObjectName("cancelRemoveAccountButton");
386+
383387
messageBox->setAttribute(Qt::WA_DeleteOnClose);
384388
connect(messageBox, &QMessageBox::finished, this, [this, messageBox, yesButton]{
385389
if (messageBox->clickedButton() == yesButton) {

src/gui/settingsdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <QMainWindow>
2323
#include <QStyledItemDelegate>
2424

25-
// #define USE_NEW_FOLDER_LIST
25+
#define USE_NEW_FOLDER_LIST
2626

2727
namespace OCC {
2828

test/gui/shared/scripts/names.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
dialogStack_quickWidget_QQuickWidget = {"container": settings_dialogStack_QStackedWidget, "name": "quickWidget", "type": "QQuickWidget", "visible": 1}
5353
groupBox_folderTreeWidget_QTreeWidget = {"container": add_Folder_Sync_Connection_groupBox_QGroupBox, "name": "folderTreeWidget", "type": "QTreeWidget", "visible": 1}
5454
confirm_Folder_Sync_Connection_Removal_QMessageBox = {"name":"ConfirmFolderSyncRemovalMessageBox", "type": "QMessageBox", "visible": 1}
55-
stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget = {"container": stack_stackedWidget_QStackedWidget, "name": "quickWidget", "type": "OCC::QmlUtils::OCQuickWidget", "visible": 1}
55+
stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget = {"container": stack_stackedWidget_QStackedWidget, "name": "accountFoldersView", "type": "OCC::AccountFoldersView", "visible": 1}
5656
qt_tabwidget_stackedwidget_OCC_LocalActivityWidget_OCC_LocalActivityWidget = {"container": stack_qt_tabwidget_stackedwidget_QStackedWidget, "name": "OCC__LocalActivityWidget", "type": "OCC::LocalActivityWidget", "visible": 1}
5757
oCC_LocalActivityWidget_tableView_QTableView = {"container": qt_tabwidget_stackedwidget_OCC_LocalActivityWidget_OCC_LocalActivityWidget, "name": "_tableView", "type": "QTableView", "visible": 1}
5858
oCC_SyncErrorWidget_tableView_QTableView = {"container": qt_tabwidget_stackedwidget_OCC_SyncErrorWidget_OCC_SyncErrorWidget, "name": "_tableView", "type": "QTableView", "visible": 1}
@@ -63,3 +63,7 @@
6363
groupBox_OCC_QmlUtils_OCQuickWidget = {"container": stackedWidget_groupBox_QGroupBox, "type": "OCC::QmlUtils::OCQuickWidget", "unnamed": 1, "visible": 1}
6464
welcome_to_ownCloud_OCC_NewAccountWizard = {"name": "NewAccountWizard", "type": "OCC::NewAccountWizard", "visible": 1}
6565
server_address_QLabel = {"type": "QLabel", "unnamed": 1, "visible": 1, "window": welcome_to_ownCloud_OCC_NewAccountWizard}
66+
stackedWidget_accountFoldersTreeView_QTreeView = {"container": stack_stackedWidget_QStackedWidget, "name": "accountFoldersTreeView", "type": "QTreeView", "visible": 1}
67+
confirm_Folder_Sync_Connection_Removal_QMessageBox_2 = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Confirm Folder Sync Connection Removal"}
68+
confirmRemoveFolderSyncDialog_QMessageBox = {"name": "confirmRemoveFolderSyncDialog", "type": "QMessageBox", "visible": 1}
69+
confirmRemoveFolderSyncDialog_removeFolderSyncButton_QPushButton = {"name": "removeFolderSyncButton", "type": "QPushButton", "visible": 1, "window": confirmRemoveFolderSyncDialog_QMessageBox}

test/gui/shared/scripts/pageObjects/AccountSetting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class AccountSetting:
1616
"window": names.settings_OCC_SettingsDialog,
1717
}
1818
CONFIRM_REMOVE_CONNECTION_BUTTON = {
19-
"container": names.settings_dialogStack_QStackedWidget,
20-
"name": "RemoveConnectionButton",
19+
"container": names.settings_stack_QStackedWidget,
2120
"type": "QPushButton",
21+
"text": "Remove connection",
2222
"visible": 1,
2323
}
2424
ACCOUNT_CONNECTION_LABEL = {

test/gui/shared/scripts/pageObjects/SyncConnection.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77

88
class SyncConnection:
9-
FOLDER_SYNC_CONNECTION_LIST = {
10-
"container": names.quickWidget_scrollView_ScrollView,
11-
"type": "ListView",
9+
FOLDER_SYNC_CONNECTION_TREE = {
10+
"container": names.stack_stackedWidget_QStackedWidget,
11+
"name": "accountFoldersTreeView",
12+
"type": "QTreeView",
1213
"visible": True,
1314
}
1415
FOLDER_SYNC_CONNECTION = {
@@ -18,21 +19,21 @@ class SyncConnection:
1819
"visible": 1,
1920
}
2021
FOLDER_SYNC_CONNECTION_LABEL = {
21-
"container": names.quickWidget_scrollView_ScrollView,
22-
"type": "Label",
23-
"unnamed": 1,
24-
"visible": True,
22+
"container": names.stackedWidget_accountFoldersTreeView_QTreeView,
23+
"type": "QModelIndex",
24+
"column": 0,
2525
}
2626
FOLDER_SYNC_CONNECTION_MENU_BUTTON = {
27-
"checkable": False,
28-
"container": names.quickWidget_scrollView_ScrollView,
29-
"type": "Button",
30-
"unnamed": 1,
31-
"visible": True,
27+
"columnIndex": 1,
28+
"container": names.stackedWidget_accountFoldersTreeView_QTreeView,
29+
"name": "buttonDelegateButton",
30+
"type": "QPushButton",
31+
"visible": 1,
3232
}
3333
MENU = {
3434
"type": "QMenu",
3535
"window": names.settings_OCC_SettingsDialog,
36+
"name": "folderOptionsMenu",
3637
"visible": 1,
3738
}
3839
DISABLE_VFS_CONFIRMATION_BUTTON = {
@@ -47,16 +48,16 @@ class SyncConnection:
4748
"visible": 1,
4849
}
4950
CANCEL_FOLDER_SYNC_CONNECTION_DIALOG = {
50-
"name": "CancelFolderSyncDialog",
51+
"name": "cancelRemoveFolderSyncButton",
5152
"type": "QPushButton",
5253
"visible": 1,
53-
"window": names.confirm_Folder_Sync_Connection_Removal_QMessageBox,
54+
"window": names.confirmRemoveFolderSyncDialog_QMessageBox,
5455
}
5556
REMOVE_FOLDER_SYNC_CONNECTION_BUTTON = {
56-
"name": "RemoveFolderSyncButton",
57+
"name": "removeFolderSyncButton",
5758
"type": "QPushButton",
5859
"visible": 1,
59-
"window": names.confirm_Folder_Sync_Connection_Removal_QMessageBox,
60+
"window": names.confirmRemoveFolderSyncDialog_QMessageBox,
6061
}
6162

6263
@staticmethod
@@ -68,17 +69,12 @@ def open_menu(sync_folder=""):
6869
selector = SyncConnection.FOLDER_SYNC_CONNECTION_LABEL.copy()
6970
selector.update({"text": sync_folder})
7071

71-
menu_button = None
72-
73-
# get the parent of the sync folder label
74-
parent = object.parent(
75-
squish.waitForObject(selector)
76-
).parent.parent.parent.parent.parent
77-
children = object.children(squish.waitForObject(parent))
78-
for obj in children:
79-
# get sync folder menu button
80-
if obj.id == "moreButton":
81-
menu_button = squish.waitForObject(obj)
72+
folder_sync_connection = squish.waitForObject(selector)
73+
squish.mouseClick(folder_sync_connection)
74+
75+
menu_button_selector = SyncConnection.FOLDER_SYNC_CONNECTION_MENU_BUTTON.copy()
76+
menu_button_selector.update({"rowIndex": folder_sync_connection.row})
77+
menu_button = squish.waitForObject(menu_button_selector)
8278
squish.mouseClick(menu_button)
8379

8480
@staticmethod
@@ -155,11 +151,12 @@ def unselect_folder_in_selective_sync(folder_name):
155151

156152
@staticmethod
157153
def get_folder_connection_count():
158-
return squish.waitForObject(SyncConnection.FOLDER_SYNC_CONNECTION_LIST).count
154+
tree = squish.waitForObject(SyncConnection.FOLDER_SYNC_CONNECTION_TREE)
155+
return tree.model().rowCount()
159156

160157
@staticmethod
161158
def remove_folder_sync_connection(sync_folder=""):
162-
SyncConnection.perform_action("Remove folder sync connection", sync_folder)
159+
SyncConnection.perform_action("Remove space sync connection", sync_folder)
163160

164161
@staticmethod
165162
def cancel_folder_sync_connection_removal():

test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ class SyncConnectionWizard:
9999
ADD_FOLDER_SYNC_BUTTON = {
100100
"checkable": False,
101101
"container": names.stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget,
102-
"id": "addSyncButton",
103-
"type": "Button",
104-
"unnamed": 1,
102+
"name": "addFolderSyncButton",
103+
"type": "QPushButton",
105104
"visible": True,
106105
}
107106
WARN_LABEL = {
@@ -303,12 +302,6 @@ def has_remote_folder(folder_name):
303302
def is_remote_folder_selected(folder_selector):
304303
return squish.waitForObjectExists(folder_selector).selected
305304

306-
@staticmethod
307-
def open_sync_connection_wizard():
308-
squish.mouseClick(
309-
squish.waitForObject(SyncConnectionWizard.ADD_FOLDER_SYNC_BUTTON)
310-
)
311-
312305
@staticmethod
313306
def get_local_sync_path():
314307
return str(

0 commit comments

Comments
 (0)