diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-05-11 14:12:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 14:12:06 +0300 |
commit | ea1f0d73e128182472bc2f42e926aa74d841e7da (patch) | |
tree | 167b1c312e2b37a9e9d6c5794f43f501765b6eed /test/gui/shared/scripts | |
parent | c6ea44894d05bc6b9466d2ed0983a7c206d7beb4 (diff) |
[tests-only]implement pageObject model (#8606)
Diffstat (limited to 'test/gui/shared/scripts')
-rw-r--r-- | test/gui/shared/scripts/helpers/SetupClientHelper.py | 26 | ||||
-rw-r--r-- | test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py | 35 |
2 files changed, 61 insertions, 0 deletions
diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py new file mode 100644 index 000000000..d9fb5a95d --- /dev/null +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -0,0 +1,26 @@ +from urllib.parse import urlparse + +def substituteInLineCodes(context, value): + value = value.replace('%local_server%', context.userData['localBackendUrl']) + value = value.replace('%client_sync_path%', context.userData['clientSyncPath']) + value = value.replace('%local_server_hostname%', urlparse(context.userData['localBackendUrl']).netloc) + + return value + + +def getClientDetails(context): + for row in context.table[0:]: + row[1] = substituteInLineCodes(context, row[1]) + if row[0] == 'server': + server = row[1] + elif row[0] == 'user': + user = row[1] + elif row[0] == 'password': + password = row[1] + elif row[0] == 'localfolder': + localfolder = row[1] + try: + os.makedirs(localfolder, 0o0755) + except: + pass + return server, user, password, localfolder
\ No newline at end of file diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py new file mode 100644 index 000000000..41a2905ba --- /dev/null +++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py @@ -0,0 +1,35 @@ +import names +import squish +from helpers.SetupClientHelper import getClientDetails + + +class AccountConnectionWizard(): + SERVER_ADDRESS_BOX = names.leUrl_OCC_PostfixLineEdit + NEXT_BUTTON = names.owncloudWizard_qt_passive_wizardbutton1_QPushButton + USERNAME_BOX = names.leUsername_QLineEdit + PASSWORD_BOX = names.lePassword_QLineEdit + 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 + + + def __init__(self): + pass + + def addAccount(self, context): + server, user, password, localfolder = getClientDetails(context) + + squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX)) + squish.type(squish.waitForObject(self.SERVER_ADDRESS_BOX), server) + squish.clickButton(squish.waitForObject(self.NEXT_BUTTON)) + squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX)) + squish.type(squish.waitForObject(self.USERNAME_BOX), user) + squish.type(squish.waitForObject(self.USERNAME_BOX), "<Tab>") + squish.type(squish.waitForObject(self.PASSWORD_BOX), password) + squish.clickButton(squish.waitForObject(self.NEXT_BUTTON)) + 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)) |