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
diff options
context:
space:
mode:
authorswoichha <swoichhaa@gmail.com>2021-08-13 13:39:13 +0300
committerHannah von Reth <vonreth@kde.org>2021-09-06 15:15:04 +0300
commitb4f61d0ba844286a45bc93bd5cf797944f8941d9 (patch)
treeafc2ed067af19c14d37a9610c3304ceb4364faf3 /test/gui/shared
parentdc1982a34432e5611f7c9921a5326ee99500300c (diff)
[tests-only]fix object name for adding users
Diffstat (limited to 'test/gui/shared')
-rw-r--r--test/gui/shared/scripts/bdd_hooks.py43
-rw-r--r--test/gui/shared/scripts/helpers/SetupClientHelper.py9
-rw-r--r--test/gui/shared/scripts/names.py1
-rw-r--r--test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py28
-rw-r--r--test/gui/shared/scripts/pageObjects/PublicLinkDialog.py2
-rw-r--r--test/gui/shared/steps/steps.py18
6 files changed, 77 insertions, 24 deletions
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py
index 6191035b6..380847b53 100644
--- a/test/gui/shared/scripts/bdd_hooks.py
+++ b/test/gui/shared/scripts/bdd_hooks.py
@@ -30,8 +30,11 @@ def hook(context):
'localBackendUrl': os.environ.get(
'BACKEND_HOST', cfg.get('DEFAULT', 'BACKEND_HOST')
),
- 'clientSyncPath': os.environ.get(
- 'CLIENT_SYNC_PATH', cfg.get('DEFAULT', 'CLIENT_SYNC_PATH')
+ 'clientSyncPathUser1': os.environ.get(
+ 'CLIENT_SYNC_PATH_USER1', cfg.get('DEFAULT', 'CLIENT_SYNC_PATH_USER1')
+ ),
+ 'clientSyncPathUser2': os.environ.get(
+ 'CLIENT_SYNC_PATH_USER2', cfg.get('DEFAULT', 'CLIENT_SYNC_PATH_USER2')
),
'clientSyncTimeout': os.environ.get(
'CLIENT_SYNC_TIMEOUT', cfg.get('DEFAULT', 'CLIENT_SYNC_TIMEOUT')
@@ -46,11 +49,17 @@ def hook(context):
if context.userData['localBackendUrl'] == '':
context.userData['localBackendUrl'] = 'https://localhost:9200'
- if context.userData['clientSyncPath'] == '':
- context.userData['clientSyncPath'] = '/tmp/client-bdd/'
+ if context.userData['clientSyncPathUser1'] == '':
+ context.userData['clientSyncPathUser1'] = '/tmp/client-bdd-user1/'
+ else:
+ context.userData['clientSyncPathUser1'] = (
+ context.userData['clientSyncPathUser1'].rstrip("/") + "/"
+ ) # make sure there is always one trailing slash
+ if context.userData['clientSyncPathUser2'] == '':
+ context.userData['clientSyncPathUser2'] = '/tmp/client-bdd-user2/'
else:
- context.userData['clientSyncPath'] = (
- context.userData['clientSyncPath'].rstrip("/") + "/"
+ context.userData['clientSyncPathUser2'] = (
+ context.userData['clientSyncPathUser2'].rstrip("/") + "/"
) # make sure there is always one trailing slash
if context.userData['clientSyncTimeout'] == '':
context.userData['clientSyncTimeout'] = 60
@@ -59,8 +68,11 @@ def hook(context):
context.userData['clientSyncTimeout']
)
- if not os.path.exists(context.userData['clientSyncPath']):
- os.makedirs(context.userData['clientSyncPath'])
+ if not os.path.exists(context.userData['clientSyncPathUser1']):
+ os.makedirs(context.userData['clientSyncPathUser1'])
+
+ if not os.path.exists(context.userData['clientSyncPathUser2']):
+ os.makedirs(context.userData['clientSyncPathUser2'])
if context.userData['middlewareUrl'] == '':
context.userData['middlewareUrl'] = 'http://localhost:3000/'
@@ -89,9 +101,20 @@ def hook(context):
snooze(5) # ToDo wait smarter till the app died
# delete local files/folders
- for filename in os.listdir(context.userData['clientSyncPath']):
+ for filename in os.listdir(context.userData['clientSyncPathUser1']):
+ test.log("Deleting :" + filename)
+ file_path = os.path.join(context.userData['clientSyncPathUser1'], filename)
+ try:
+ if os.path.isfile(file_path) or os.path.islink(file_path):
+ os.unlink(file_path)
+ elif os.path.isdir(file_path):
+ shutil.rmtree(file_path)
+ except Exception as e:
+ print('Failed to delete %s. Reason: %s' % (file_path, e))
+
+ for filename in os.listdir(context.userData['clientSyncPathUser2']):
test.log("Deleting :" + filename)
- file_path = os.path.join(context.userData['clientSyncPath'], filename)
+ file_path = os.path.join(context.userData['clientSyncPathUser2'], filename)
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py
index f882930d0..c054b4d26 100644
--- a/test/gui/shared/scripts/helpers/SetupClientHelper.py
+++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py
@@ -8,7 +8,12 @@ confFilePath = confdir + 'owncloud.cfg'
def substituteInLineCodes(context, value):
value = value.replace('%local_server%', context.userData['localBackendUrl'])
- value = value.replace('%client_sync_path%', context.userData['clientSyncPath'])
+ value = value.replace(
+ '%client_sync_path_user1%', context.userData['clientSyncPathUser1']
+ )
+ value = value.replace(
+ '%client_sync_path_user2%', context.userData['clientSyncPathUser2']
+ )
value = value.replace(
'%local_server_hostname%', urlparse(context.userData['localBackendUrl']).netloc
)
@@ -78,7 +83,7 @@ def setUpClient(context, username, displayName, confFilePath):
'displayUserName': displayName,
'davUserName': userFirstName[0].lower(),
'displayUserFirstName': userFirstName[0],
- 'client_sync_path': context.userData['clientSyncPath'],
+ 'client_sync_path': context.userData['clientSyncPathUser1'],
'local_server': context.userData['localBackendUrl'],
}
userSetting = userSetting.format(**args)
diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py
index 783b35dbe..966a89a56 100644
--- a/test/gui/shared/scripts/names.py
+++ b/test/gui/shared/scripts/names.py
@@ -102,3 +102,4 @@ sharingDialog_Close_QPushButton = {"text": "Close", "type": "QPushButton", "unna
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}
+error_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Error"} \ No newline at end of file
diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
index bba29edb3..2d56c124b 100644
--- a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
+++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
@@ -1,6 +1,7 @@
import names
import squish
from helpers.SetupClientHelper import getClientDetails
+import test
class AccountConnectionWizard:
@@ -11,11 +12,26 @@ class AccountConnectionWizard:
SELECT_LOCAL_FOLDER = names.pbSelectLocalFolder_QPushButton
DIRECTORY_NAME_BOX = names.fileNameEdit_QLineEdit
CHOOSE_BUTTON = names.qFileDialog_Choose_QPushButton
- CONNECT_BUTTON = names.owncloudWizard_qt_passive_wizardbutton1_QPushButton
+ FINISH_BUTTON = {
+ "name": "qt_wizard_finish",
+ "type": "QPushButton",
+ "visible": 1,
+ "window": names.owncloudWizard_OCC_OwncloudWizard,
+ }
+ ERROR_OK_BUTTON = {
+ "text": "OK",
+ "type": "QPushButton",
+ "unnamed": 1,
+ "visible": 1,
+ "window": names.error_QMessageBox,
+ }
def __init__(self):
pass
+ def sanitizeFolderPath(self, folderPath):
+ return folderPath.rstrip("/")
+
def addAccount(self, context):
server, user, password, localfolder = getClientDetails(context)
@@ -27,8 +43,16 @@ class AccountConnectionWizard:
squish.type(squish.waitForObject(self.USERNAME_BOX), "<Tab>")
squish.type(squish.waitForObject(self.PASSWORD_BOX), password)
squish.clickButton(squish.waitForObject(self.NEXT_BUTTON))
+ try:
+ squish.clickButton(squish.waitForObject(self.ERROR_OK_BUTTON))
+ except LookupError:
+ pass
squish.clickButton(squish.waitForObject(self.SELECT_LOCAL_FOLDER))
squish.mouseClick(squish.waitForObject(self.DIRECTORY_NAME_BOX))
squish.type(squish.waitForObject(self.DIRECTORY_NAME_BOX), localfolder)
squish.clickButton(squish.waitForObject(self.CHOOSE_BUTTON))
- squish.clickButton(squish.waitForObject(self.CONNECT_BUTTON))
+ test.compare(
+ str(squish.waitForObjectExists(self.SELECT_LOCAL_FOLDER).text),
+ self.sanitizeFolderPath(localfolder),
+ )
+ squish.clickButton(squish.waitForObject(self.FINISH_BUTTON))
diff --git a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py
index 536bb002d..f89baa171 100644
--- a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py
+++ b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py
@@ -76,7 +76,7 @@ class PublicLinkDialog:
test.compare(
str(squish.waitForObjectExists(self.ITEM_TO_SHARE).text),
- resource.replace(context.userData['clientSyncPath'], ''),
+ resource.replace(context.userData['clientSyncPathUser1'], ''),
)
if radioObjectName:
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index 85a99f70f..60b94c794 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -155,7 +155,7 @@ def isFileSynced(fileName):
def waitForFileToBeSynced(context, fileName):
waitFor(
lambda: isFileSynced(
- sanitizePath(context.userData['clientSyncPath'] + fileName)
+ sanitizePath(context.userData['clientSyncPathUser1'] + fileName)
),
context.userData['clientSyncTimeout'] * 1000,
)
@@ -164,7 +164,7 @@ def waitForFileToBeSynced(context, fileName):
def waitForFolderToBeSynced(context, folderName):
waitFor(
lambda: isFolderSynced(
- sanitizePath(context.userData['clientSyncPath'] + folderName)
+ sanitizePath(context.userData['clientSyncPathUser1'] + folderName)
),
context.userData['clientSyncTimeout'] * 1000,
)
@@ -277,7 +277,7 @@ def step(context, fileName):
@When('the user creates a file "|any|" with the following content on the file system')
def step(context, filename):
fileContent = "\n".join(context.multiLineText)
- f = open(context.userData['clientSyncPath'] + filename, "w")
+ f = open(context.userData['clientSyncPathUser1'] + filename, "w")
f.write(fileContent)
f.close()
@@ -309,7 +309,7 @@ def step(context, stepPart1):
@Then('the file "|any|" should exist on the file system with the following content')
def step(context, filePath):
expected = "\n".join(context.multiLineText)
- filePath = context.userData['clientSyncPath'] + filePath
+ filePath = context.userData['clientSyncPathUser1'] + filePath
f = open(filePath, 'r')
contents = f.read()
test.compare(
@@ -331,7 +331,7 @@ def step(context):
@Given('the user has changed the content of local file "|any|" to:')
def step(context, filename):
fileContent = "\n".join(context.multiLineText)
- f = open(context.userData['clientSyncPath'] + filename, "w")
+ f = open(context.userData['clientSyncPathUser1'] + filename, "w")
f.write(fileContent)
f.close()
@@ -364,14 +364,14 @@ def step(context, filename):
extpart = filename.split('.')[1]
onlyfiles = [
f
- for f in listdir(context.userData['clientSyncPath'])
- if isfile(join(context.userData['clientSyncPath'], f))
+ for f in listdir(context.userData['clientSyncPathUser1'])
+ if isfile(join(context.userData['clientSyncPathUser1'], f))
]
found = False
pattern = re.compile(buildConflictedRegex(filename))
for file in onlyfiles:
if pattern.match(file):
- f = open(context.userData['clientSyncPath'] + file, 'r')
+ f = open(context.userData['clientSyncPathUser1'] + file, 'r')
contents = f.read()
if contents == expected:
found = True
@@ -738,7 +738,7 @@ def step(context, resource, content):
snooze(5)
- f = open(context.userData['clientSyncPath'] + resource, "w")
+ f = open(context.userData['clientSyncPathUser1'] + resource, "w")
f.write(content)
f.close()