From fb6fd97bcb2dee37d4679e33e773cc5e1f707ca7 Mon Sep 17 00:00:00 2001 From: swoichha Date: Tue, 18 Feb 2020 14:19:47 +0545 Subject: [PATCH] seperate steps used to check file/folder listed in trashbin --- .../createFolderEdgeCases.feature | 7 ------- .../webUITrashbin/trashbinRestore.feature | 16 ++++++++-------- .../pageObjects/FilesPageElement/filesList.js | 1 + .../acceptance/stepDefinitions/filesContext.js | 18 ++++++++++++++++-- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/acceptance/features/webUICreateFilesFolders/createFolderEdgeCases.feature b/tests/acceptance/features/webUICreateFilesFolders/createFolderEdgeCases.feature index 5c2e16e339d..656093eb772 100644 --- a/tests/acceptance/features/webUICreateFilesFolders/createFolderEdgeCases.feature +++ b/tests/acceptance/features/webUICreateFilesFolders/createFolderEdgeCases.feature @@ -8,13 +8,6 @@ Feature: create folder And user "user1" has logged in using the webUI And the user has browsed to the files page - Scenario: Create a folder using special characters - When the user creates a folder with the name '"somequotes1"' using the webUI - Then folder '"somequotes1"' should be listed on the webUI - When the user reloads the current page of the webUI - Then folder '"somequotes1"' should be listed on the webUI - - Scenario Outline: Create a folder using special characters When the user creates a folder with the name using the webUI Then folder should be listed on the webUI diff --git a/tests/acceptance/features/webUITrashbin/trashbinRestore.feature b/tests/acceptance/features/webUITrashbin/trashbinRestore.feature index fa97ac86dd0..a8cb0e23d2c 100644 --- a/tests/acceptance/features/webUITrashbin/trashbinRestore.feature +++ b/tests/acceptance/features/webUITrashbin/trashbinRestore.feature @@ -128,11 +128,11 @@ Feature: Restore deleted files/folders When the user browses to the trashbin page And the user restores file "lorem.txt" from the trashbin using the webUI Then the success message "lorem.txt was restored successfully" should be displayed on the webUI - And file "lorem.txt" should not be listed on the webUI - And folder "lorem.txt" should be listed on the webUI + And "file" "lorem.txt" should not be listed on the webUI + And "folder" "lorem.txt" should be listed on the webUI When the user browses to the files page using the webUI - Then file "lorem.txt" should be listed on the webUI - And folder "lorem.txt" should not be listed on the webUI + Then "file" "lorem.txt" should be listed on the webUI + And "folder" "lorem.txt" should not be listed on the webUI Scenario: Delete and restore a folder that has the same name like a deleted file Given the user has created file "lorem.txt" @@ -146,8 +146,8 @@ Feature: Restore deleted files/folders When the user browses to the trashbin page And the user restores folder "lorem.txt" from the trashbin using the webUI Then the success message "lorem.txt was restored successfully" should be displayed on the webUI - And folder "lorem.txt" should not be listed on the webUI - And file "lorem.txt" should be listed on the webUI + And "folder" "lorem.txt" should not be listed on the webUI + And "file" "lorem.txt" should be listed on the webUI When the user browses to the files page using the webUI - Then folder "lorem.txt" should be listed on the webUI - And file "lorem.txt" should not be listed on the webUI + Then "folder" "lorem.txt" should be listed on the webUI + And "file" "lorem.txt" should not be listed on the webUI diff --git a/tests/acceptance/pageObjects/FilesPageElement/filesList.js b/tests/acceptance/pageObjects/FilesPageElement/filesList.js index 873cc074212..37a2898fbc7 100644 --- a/tests/acceptance/pageObjects/FilesPageElement/filesList.js +++ b/tests/acceptance/pageObjects/FilesPageElement/filesList.js @@ -391,6 +391,7 @@ module.exports = { */ waitForFileVisible: async function (fileName, elementType = 'file') { const linkSelector = this.getFileLinkSelectorByFileName(fileName, elementType) + await this.waitForElementPresent('@filesTableContainer') await this.filesListScrollToTop() await this.findItemInFilesList(fileName) diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index 00a599e6016..5480d906843 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -340,7 +340,14 @@ Then('there should be no files/folders/resources listed on the webUI', async fun assert.ok(allRowsResult.value.length === 0, `No resources are listed, ${allRowsResult.length} found`) }) -Then(/^(file|folder) ("([^"]*)"|'([^"]*)') should be listed on the webUI$/, (elementType, folder) => { +Then('file/folder {string} should be listed on the webUI', function (folder) { + return client + .page + .FilesPageElement.filesList() + .waitForFileVisible(folder) +}) + +Then('{string} {string} should be listed on the webUI', (elementType, folder) => { return client .page .FilesPageElement.filesList() @@ -364,7 +371,14 @@ Then('the last uploaded folder should be listed on the webUI', async function () return client }) -Then(/^(file|folder) "([^"]*)" should not be listed on the webUI$/, async (elementType, folder) => { +Then('file/folder {string} should not be listed on the webUI', async function (folder) { + const state = await client.page.FilesPageElement.filesList().isElementListed(folder) + return client.assert.ok( + !state, `Error: Resource ${folder} is listed on the filesList` + ) +}) + +Then('{string} {string} should not be listed on the webUI', async (elementType, folder) => { const state = await client.page.FilesPageElement.filesList().isElementListed(folder, elementType) return client.assert.ok( !state, `Error: Resource ${folder} is listed on the filesList`