diff options
author | Talank <talank@gces.edu.np> | 2022-05-18 14:04:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 14:04:05 +0300 |
commit | 9d6ea85598ccc2ae2776e80f4586d901e3469619 (patch) | |
tree | 218c1f0506d2fc0cb7943fd81b89598192ac5941 /test | |
parent | c9603ca80d8762de34efb026211d8e8dab19d0fa (diff) |
[Tests-Only] Fixed tests related to expiration date set/change (#9463)
* Fixed tests related to expiration date set/change
* Skipped flaky tests
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/PublicLinkDialog.py | 54 | ||||
-rw-r--r-- | test/gui/tst_sharing/test.feature | 10 |
2 files changed, 40 insertions, 24 deletions
diff --git a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py index 4a9452e41..2f53a413f 100644 --- a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py +++ b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py @@ -168,11 +168,23 @@ class PublicLinkDialog: squish.Qt.NoModifier, squish.Qt.LeftButton, ) - squish.nativeType("<Delete>") - squish.nativeType("<Delete>") - squish.nativeType(expDate.month) - squish.nativeType(expDate.day) + # Move the cursor to year (last) field and enter the year + squish.nativeType("<Ctrl+Right>") + squish.nativeType("<Ctrl+Right>") squish.nativeType(expYear) + + # Move the cursor to day (middle) field and enter the day + squish.nativeType("<Ctrl+Left>") + squish.nativeType(expDate.day) + + # Move the cursor to month (first) field and enter the month + # Backspace works most of the time, so we clear the data using backspace + squish.nativeType("<Ctrl+Left>") + squish.nativeType("<Ctrl+Left>") + squish.nativeType("<Right>") + squish.nativeType("<Backspace>") + squish.nativeType("<Backspace>") + squish.nativeType(expDate.month) squish.nativeType("<Return>") actualDate = str( @@ -180,10 +192,20 @@ class PublicLinkDialog: ) expectedDate = f"{expDate.month}/{expDate.day}/{expYear}" if not actualDate == expectedDate: + test.log( + f"Expected date: {expectedDate} is not same as that of Actual date: {actualDate}, trying workaround" + ) # retry with workaround self.setExpirationDateWithWorkaround( expYear, expDate.month, expDate.day ) + actualDate = str( + squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText + ) + if not actualDate == expectedDate: + test.fail( + f"workaround failed, actual date: {actualDate} is still not same as expected date: {expectedDate}" + ) squish.waitFor( lambda: (test.vp("publicLinkExpirationProgressIndicatorInvisible")) ) @@ -193,8 +215,7 @@ class PublicLinkDialog: ) PublicLinkDialog.setDefaultExpiryDate(defaultDate) - # This workaround is needed because the above function 'setExpirationDate' - # will not work while creating new public link + # This workaround is needed because the above function 'setExpirationDate' can not set the month field sometime. # See for more details: https://github.com/owncloud/client/issues/9218 def setExpirationDateWithWorkaround(self, year, month, day): squish.mouseClick( @@ -205,20 +226,15 @@ class PublicLinkDialog: squish.Qt.LeftButton, ) - # date can be edited from backward only - # date format is 'mm/dd/yy', so we have to edit 'year' first - # then 'day' and then 'month'. - # Move the cursor to year field - squish.nativeType("<Ctrl+Right>") - squish.nativeType("<Ctrl+Right>") - squish.nativeType(year) - # Move the cursor to day field - squish.nativeType("<Ctrl+Left>") - squish.nativeType(day) - # Move the cursor to month field - squish.nativeType("<Ctrl+Left>") - squish.nativeType("<Ctrl+Left>") + # date can only be set to future date. But sometimes it can not modify the month field in first attempt. + # date format is 'm/d/yy', so we have to edit 'month' first + # then 'day' and then 'year'. + # Delete data from month field + squish.nativeType("<Delete>") + squish.nativeType("<Delete>") squish.nativeType(month) + squish.nativeType(day) + squish.nativeType(year) squish.nativeType("<Return>") def getRadioObjectForPermssion(self, permissions): diff --git a/test/gui/tst_sharing/test.feature b/test/gui/tst_sharing/test.feature index 72830ec16..53d662cea 100644 --- a/test/gui/tst_sharing/test.feature +++ b/test/gui/tst_sharing/test.feature @@ -483,7 +483,7 @@ Feature: Sharing Then the expiration date of the last public link of file "textfile.txt" should be "%default%" And as user "Alice" the file "textfile.txt" should have a public link on the server - @skip @issue-9321 + @issue-9321 Scenario: simple sharing of file and folder by public link with expiration date Given user "Alice" has set up a client with default settings And user "Alice" has created folder "FOLDER" on the server @@ -492,17 +492,17 @@ Feature: Sharing | path | textfile.txt | | expireDate | 2031-10-14 | Then as user "Alice" the file "textfile.txt" should have a public link on the server - And the fields of the last public link share response of user "Alice" should include on the server + And the last public link share response of user "Alice" should include the following fields on the server | expireDate | 2031-10-14 | When the user closes the sharing dialog And the user creates a new public link with following settings using the client-UI: | path | FOLDER | | expireDate | 2031-12-30 | Then as user "Alice" the file "FOLDER" should have a public link on the server - And the fields of the last public link share response of user "Alice" should include on the server + And the last public link share response of user "Alice" should include the following fields on the server | expireDate | 2031-12-30 | - @skip @issue-9321 + @issue-9321 Scenario: simple sharing of a file by public link with password and expiration date Given user "Alice" has set up a client with default settings And user "Alice" has uploaded file with content "ownCloud test text file" to "/textfile.txt" on the server @@ -541,7 +541,7 @@ Feature: Sharing When the user opens the public links dialog of "simple-folder" using the client-UI And the user edits the public link named "Public link" of file "simple-folder" changing following | expireDate | 2038-07-21 | - Then the fields of the last public link share response of user "Alice" on the server should include + Then the last public link share response of user "Alice" should include the following fields on the server | expireDate | 2038-07-21 | |