Skip to content

Commit

Permalink
Minimize CI failures for copy, cut, paste feature
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Aug 2, 2022
1 parent 0aae8d5 commit c372d42
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ Feature: deleting files and folders
| lorem.txt |
| simple-folder |
When the user deletes file "lorem.txt" using the webUI
Then the error message with header 'Failed to delete "lorem.txt"' should be displayed on the webUI
Then the "error" message with header 'Failed to delete "lorem.txt"' should be displayed on the webUI
When the user clears all error message from the webUI
And the user deletes folder "simple-folder" using the webUI
Then the error message with header 'Failed to delete "simple-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to delete "simple-folder"' should be displayed on the webUI
When the user reloads the current page of the webUI
Then file "lorem.txt" should not be listed on the webUI
And folder "simple-folder" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ Feature: Mark file as favorite
| lorem.txt |
| simple-folder |
When the user marks file "lorem.txt" as favorite using the webUI
Then the error message with header 'Failed to change favorite state of "lorem.txt"' should be displayed on the webUI
Then the "error" message with header 'Failed to change favorite state of "lorem.txt"' should be displayed on the webUI
And file "lorem.txt" should not be marked as favorite on the webUI
When the user clears all error message from the webUI
And the user marks folder "simple-folder" as favorite using the webUI
Then the error message with header 'Failed to change favorite state of "simple-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to change favorite state of "simple-folder"' should be displayed on the webUI
And folder "simple-folder" should not be marked as favorite on the webUI
And as "Alice" file "lorem.txt" should not exist in the server
And as "Alice" folder "simple-folder" should not exist in the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ Feature: Unmark file/folder as favorite
| lorem.txt |
| simple-folder |
When the user unmarks the favorited file "lorem.txt" using the webUI
Then the error message with header 'Failed to change favorite state of "lorem.txt"' should be displayed on the webUI
Then the "error" message with header 'Failed to change favorite state of "lorem.txt"' should be displayed on the webUI
And file "lorem.txt" should be marked as favorite on the webUI
When the user clears all error message from the webUI
And the user unmarks the favorited folder "simple-folder" using the webUI
Then the error message with header 'Failed to change favorite state of "simple-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to change favorite state of "simple-folder"' should be displayed on the webUI
And folder "simple-folder" should be marked as favorite on the webUI
And as "Alice" file "lorem.txt" should not exist in the server
And as "Alice" folder "simple-folder" should not exist in the server
10 changes: 5 additions & 5 deletions tests/acceptance/features/webUIFiles/batchAction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Visibility of the batch actions menu
When the user marks the folder "simple-folder" using the webUI
Then the following batch action buttons should be visible
| buttonName |
| Move |
| Cut |
| Copy |
| Delete |

Expand All @@ -29,7 +29,7 @@ Feature: Visibility of the batch actions menu
| buttonName |
| Download |
| Delete |
| Move |
| Cut |
| Copy |


Expand All @@ -43,7 +43,7 @@ Feature: Visibility of the batch actions menu
Then the following batch action buttons should be visible
| buttonName |
| Delete |
| Move |
| Cut |
| Copy |

@skipOnOCIS
Expand Down Expand Up @@ -93,7 +93,7 @@ Feature: Visibility of the batch actions menu
Then the following batch action buttons should not be visible
| buttonName |
| Delete |
| Move |
| Cut |
| Copy |


Expand All @@ -106,7 +106,7 @@ Feature: Visibility of the batch actions menu
Then the following batch action buttons should not be visible
| buttonName |
| Delete |
| Move |
| Cut |
| Copy |


Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/webUIFiles/download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: download files
| name |
| lorem.txt |
When the user downloads file "lorem.txt" using the webUI
Then the error message with header 'Download failed' should be displayed on the webUI
Then the "error" message with header 'Download failed' should be displayed on the webUI
When the user reloads the current page of the webUI
Then file "lorem.txt" should not be listed on the webUI
And as "Alice" file "lorem.txt" should not exist in the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Feature: User can see the file or folder actions menu options
When the user opens the actions sidebar panel of file "lorem.txt" on the webUI
Then the app-sidebar for file "lorem.txt" should be visible on the webUI
And only the following items with default items should be visible in the actions menu on the webUI
| items |
| items |
| open in text editor |
| download |
| download |
When the user opens the actions sidebar panel of file "lorem.pdf" on the webUI
Then the app-sidebar for file "lorem.pdf" should be visible on the webUI
And only the following items with default items should be visible in the actions menu on the webUI
Expand All @@ -29,9 +29,9 @@ Feature: User can see the file or folder actions menu options
When the user opens the actions sidebar panel of file "testavatar.png" on the webUI
Then the app-sidebar for file "testavatar.png" should be visible on the webUI
And only the following items with default items should be visible in the actions menu on the webUI
| items |
| preview |
| download |
| items |
| preview |
| download |


Scenario: observe different actions menu options on selecting a folder
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/webUIFilesCopy/copy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Feature: copy files and folders
And user "Alice" has logged in using the webUI
And the user has browsed to the personal page
When the user tries to copy file "strängé filename (duplicate #2 &).txt" into folder "strängé नेपाली folder" using the webUI
Then the error message with header 'Failed to copy "strängé filename (duplicate #2 &).txt"' should be displayed on the webUI
Then the "modal error" message with header 'File with name strängé filename (duplicate #2 &).txt already exists.' should be displayed on the webUI

@smokeTest @ocisSmokeTest
Scenario: Copy multiple files at once
Expand Down Expand Up @@ -78,7 +78,7 @@ Feature: copy files and folders
And user "Alice" has created folder "simple-folder/simple-empty-folder" in the server
And user "Alice" has uploaded file "data.zip" to "simple-folder/data.zip" in the server
And user "Alice" has shared folder "simple-folder" with link with "read, update, create, delete" permissions in the server
And the public uses the webUI to access the last public link created by user "Alice" in a new session
When the public uses the webUI to access the last public link created by user "Alice" in a new session
And the user copies file "data.zip" into folder "simple-empty-folder" using the webUI
Then breadcrumb for folder "simple-empty-folder" should be displayed on the webUI
And file "data.zip" should be listed on the webUI
Expand Down Expand Up @@ -113,7 +113,7 @@ Feature: copy files and folders
Given user "Alice" has created folder "simple-empty-folder" in the server
And user "Alice" has logged in using the webUI
When the user tries to copy folder "simple-empty-folder" into folder "simple-empty-folder" using the webUI
Then the error message with header 'Failed to copy "simple-empty-folder"' should be displayed on the webUI
Then the "error" message with header "You can't paste the selected file at this location because you can't paste an item into itself." should be displayed on the webUI
And as "Alice" file "simple-empty-folder/simple-empty-folder" should not exist in the server


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Feature: move files
And user "Alice" has uploaded file "lorem.txt" to "simple-folder/lorem.txt" in the server
And the user has browsed to the personal page
When the user tries to move file "lorem.txt" into folder "simple-folder" using the webUI
Then the error message with header 'Failed to move "lorem.txt"' should be displayed on the webUI
Then the "modal error" message with header 'File with name lorem.txt already exists.' should be displayed on the webUI

@smokeTest @ocisSmokeTest @disablePreviews
Scenario: Move multiple files at once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Feature: move folders
And user "Alice" has logged in using the webUI
And the user has browsed to the personal page
When the user tries to move folder "simple-empty-folder" into folder "simple-folder" using the webUI
Then the error message with header 'Failed to move "simple-empty-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to move "simple-empty-folder"' should be displayed on the webUI

@smokeTest
Scenario: Move multiple folders at once
Expand Down Expand Up @@ -81,7 +81,7 @@ Feature: move folders
Scenario: move a folder into the same folder
Given user "Alice" has logged in using the webUI
When the user tries to move folder "simple-empty-folder" into folder "simple-empty-folder" using the webUI
Then the error message with header 'Failed to move "simple-empty-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to move "simple-empty-folder"' should be displayed on the webUI
And as "Alice" folder "simple-empty-folder/simple-empty-folder" should not exist in the server


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Feature: rename files
Scenario Outline: Try to rename a file using forbidden characters
Given user "Alice" has logged in using the webUI
When the user tries to rename file "data.zip" to "<filename>" using the webUI
Then the error message with header 'Failed to rename "data.zip" to "<filename>"' should be displayed on the webUI
Then the "error" message with header 'Failed to rename "data.zip" to "<filename>"' should be displayed on the webUI
And file "data.zip" should be listed on the webUI
And file "<filename>" should not be listed on the webUI
Examples:
Expand Down Expand Up @@ -182,7 +182,7 @@ Feature: rename files
Scenario: Rename a file to .part (on oc10)
Given user "Alice" has logged in using the webUI
When the user tries to rename file "data.zip" to "data.part" using the webUI
Then the error message with header 'Failed to rename "data.zip" to "data.part"' should be displayed on the webUI
Then the "error" message with header 'Failed to rename "data.zip" to "data.part"' should be displayed on the webUI

@skipOnOC10
Scenario: Rename a file to .part
Expand Down Expand Up @@ -272,7 +272,7 @@ Feature: rename files
| name |
| lorem.txt |
When the user tries to rename file "lorem.txt" to "new-lorem.txt" using the webUI
Then the error message with header 'Failed to rename "lorem.txt" to "new-lorem.txt"' should be displayed on the webUI
Then the "error" message with header 'Failed to rename "lorem.txt" to "new-lorem.txt"' should be displayed on the webUI
When the user reloads the current page of the webUI
Then file "lorem.txt" should not be listed on the webUI
And file "new-lorem.txt" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Feature: rename folders
Scenario Outline: Rename a folder using forbidden characters
Given user "Alice" has logged in using the webUI
When the user tries to rename folder <from_name> to <to_name> using the webUI
Then the error message with header '<alert_message>' should be displayed on the webUI
Then the "error" message with header '<alert_message>' should be displayed on the webUI
And folder "simple-folder" should be listed on the webUI
Examples:
| from_name | to_name | alert_message |
Expand Down Expand Up @@ -140,7 +140,7 @@ Feature: rename folders
Scenario: Rename a folder to .part (on oc10)
Given user "Alice" has logged in using the webUI
When the user tries to rename folder "simple-folder" to "simple.part" using the webUI
Then the error message with header 'Failed to rename "simple-folder" to "simple.part"' should be displayed on the webUI
Then the "error" message with header 'Failed to rename "simple-folder" to "simple.part"' should be displayed on the webUI

@skipOnOC10
Scenario: Rename a folder to .part (on ocis)
Expand All @@ -154,7 +154,7 @@ Feature: rename folders
| name |
| simple-folder |
When the user tries to rename folder "simple-folder" to "new-simple-folder" using the webUI
Then the error message with header 'Failed to rename "simple-folder" to "new-simple-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to rename "simple-folder" to "new-simple-folder"' should be displayed on the webUI
When the user reloads the current page of the webUI
Then folder "simple-folder" should not be listed on the webUI
And folder "new-simple-folder" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ Feature: Sharing files and folders with internal users
| lorem.txt |
| simple-folder |
When the user shares file "lorem.txt" with user "Brian Murphy" as "Editor" using the webUI
Then the error message with header 'Error while sharing.' should be displayed on the webUI
Then the "error" message with header 'Error while sharing.' should be displayed on the webUI
And user "Brian Murphy" should not be listed in the collaborators list on the webUI
When the user clears all error message from the webUI
And the user shares folder "simple-folder" with user "Brian Murphy" as "Editor" using the webUI
Then the error message with header 'Error while sharing.' should be displayed on the webUI
Then the "error" message with header 'Error while sharing.' should be displayed on the webUI
And user "Brian Murphy" should not be listed in the collaborators list on the webUI
When the user reloads the current page of the webUI
Then file "lorem.txt" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ Feature: Sharing files and folders with internal users
| lorem.txt |
| simple-folder |
When the user shares file "lorem.txt" with user "Brian Murphy" as "Editor" using the webUI
Then the error message with header 'Error while sharing.' should be displayed on the webUI
Then the "error" message with header 'Error while sharing.' should be displayed on the webUI
And user "UserTwo" should not be listed in the collaborators list on the webUI
When the user clears all error message from the webUI
And the user shares folder "simple-folder" with user "Brian Murphy" as "Editor" using the webUI
Then the error message with header 'Error while sharing.' should be displayed on the webUI
Then the "error" message with header 'Error while sharing.' should be displayed on the webUI
And user "UserTwo" should not be listed in the collaborators list on the webUI
When the user reloads the current page of the webUI
Then file "lorem.txt" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Feature: files and folders can be deleted from the trashbin
# after the issue is fixed delete this scenario and use the one above
Scenario: Delete folders and check that they are gone (ocis bug demonstration)
When the user deletes folder "simple-folder" using the webUI
Then the error message with header 'Failed to delete "simple-folder"' should be displayed on the webUI
Then the "error" message with header 'Failed to delete "simple-folder"' should be displayed on the webUI
And folder "simple-folder" should be listed on the webUI
When the user deletes folder "Folder,With,Comma" using the webUI
Then folder "Folder,With,Comma" should not be listed on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module.exports = {
return items
},
getActionsMenuItemsExceptDefaults: async function () {
const defaultItems = ['add to favorites', 'copy', 'move', 'rename', 'delete']
const defaultItems = ['add to favorites', 'copy', 'cut', 'rename', 'delete']
const items = []
let elements
await this.api.elements('@panelActionsItems', function (result) {
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/pageObjects/locationPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
locateStrategy: 'xpath'
},
confirmBtn: {
selector: '(//div[id="clipboard-btns"])[1]'
selector: '#clipboard-btns button:first-child'
}
}
}
6 changes: 6 additions & 0 deletions tests/acceptance/pageObjects/webPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ module.exports = {
let selector = titleOnly ? '@message' : '@messages'
if (type === 'error') {
selector = titleOnly ? '@errorMessage' : '@errorMessages'
} else if (type === 'modal error') {
selector = '@modalErrorMessage'
}
await this.waitForElementVisible(selector)
await this.api.element(selector, (result) => {
Expand Down Expand Up @@ -281,6 +283,10 @@ module.exports = {
'//*[contains(@class, "oc-notification-message-danger")]//div[contains(@class, "oc-notification-message-title")]',
locateStrategy: 'xpath'
},
modalErrorMessage: {
selector: '//div[@class=\'oc-modal-body\']/p[contains(@class, "oc-modal-body-message")]',
locateStrategy: 'xpath'
},
errorMessages: {
selector: '//*[contains(@class, "oc-notification-message-danger")]',
locateStrategy: 'xpath'
Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,6 @@ Then(
async function (table) {
const visibleItems =
await client.page.FilesPageElement.appSideBar().getActionsMenuItemsExceptDefaults()

const tableItems = table.rows()
const expectedVisibleItems = []
tableItems.forEach((element) => {
Expand Down
13 changes: 10 additions & 3 deletions tests/acceptance/stepDefinitions/generalContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,20 @@ Given('the property {string} has been deleted in web config file', function (key
})

Then(
'the {word} message with header {string} should be displayed on the webUI',
'the {string} message with header {string} should be displayed on the webUI',
async function (type, message) {
const text = await client.page.webPage().getDisplayedMessage(type, true)
assert.strictEqual(text, message)

const element = type === 'error' ? '@errorMessage' : '@message'
return await client.page.webPage().waitForElementNotPresent(element)
const element =
type === 'error'
? '@errorMessage'
: type === 'modal error'
? '@modalErrorMessage'
: '@message'
if (type === 'error') {
return await client.page.webPage().waitForElementNotPresent(element)
}
}
)

Expand Down

0 comments on commit c372d42

Please sign in to comment.