Skip to content

Commit

Permalink
use better steps to check for empty file list
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed Oct 28, 2020
1 parent 0c4c907 commit 4ab5a8b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Feature: deleting files and folders
Then as "user1" file "data.zip" should not exist
And as "user1" file "lorem.txt" should not exist
And as "user1" folder "simple-folder" should not exist
And the folder should be empty on the webUI
And the folder should be empty on the webUI after a page reload
And there should be no resources listed on the webUI
And there should be no resources listed on the webUI after a page reload
And no message should be displayed on the webUI

@ocis-reva-issue-106 @skipOnOCIS @ocis-reve-issue-442
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Feature: files and folders can be deleted from the trashbin
Scenario: Select all files and delete from trashbin in a batch
When the user marks all files for batch action using the webUI
And the user batch deletes the marked files using the webUI
Then the folder should be empty on the webUI
Then there should be no resources listed on the webUI

@skipOnOC10
@issue-product-188
Expand All @@ -120,7 +120,7 @@ Feature: files and folders can be deleted from the trashbin
Scenario: Clear trashbin
When the user clears the trashbin
Then the success message with header "All deleted files were removed" should be displayed on the webUI
And the trashbin should be empty on the webUI
And there should be no resources listed on the webUI

@skipOnOC10
@issue-product-139
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ Feature: Restore deleted files/folders
| lorem-big.txt |
| simple-folder |
And the user has browsed to the trashbin page
And the user marks all files for batch action using the webUI
When the user marks all files for batch action using the webUI
And the user batch restores the marked files using the webUI
Then the folder should be empty on the webUI after a page reload
Then there should be no resources listed on the webUI
And there should be no resources listed on the webUI after a page reload
When the user browses to the files page
Then file "lorem.txt" should be listed on the webUI
And file "lorem-big.txt" should be listed on the webUI
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ module.exports = {
let visible = false
let elementId = null
await this.waitForElementNotPresent('@filesListProgressBar')
await this.waitForElementVisible('@filesListNoContentMessage')
await this.api.element('@filesListNoContentMessage', result => {
if (result.status !== -1) {
elementId = result.value.ELEMENT
Expand Down
31 changes: 12 additions & 19 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,16 @@ When('the user unmarks the favorited file/folder {string} using the webUI sideba
return client
})

Then('there should be no files/folders/resources listed on the webUI', async function() {
Then('there should be no files/folders/resources listed on the webUI', assertNoResourcesListed)
Then(
'there should be no files/folders/resources listed on the webUI after a page reload',
async function() {
await client.refresh()
return assertNoResourcesListed()
}
)

async function assertNoResourcesListed() {
let currentUrl = null
await client.url(result => {
currentUrl = result.value
Expand All @@ -382,11 +391,11 @@ Then('there should be no files/folders/resources listed on the webUI', async fun

const allRowsResult = await client.page.FilesPageElement.filesList().allFileRows()

assert.ok(
return assert.ok(
allRowsResult.value.length === 0,
`No resources are listed, ${allRowsResult.length} found`
)
})
}

Then('file {string} should be listed on the webUI', function(folder) {
return client.page.FilesPageElement.filesList().waitForFileVisible(folder, 'file')
Expand Down Expand Up @@ -527,16 +536,6 @@ When('the user switches to {string} tab in details panel using the webUI', funct
return client.page.filesPage().selectTabInSidePanel(tab)
})

Then('the folder should be empty on the webUI', async function() {
const allFileRows = await client.page.FilesPageElement.filesList().allFileRows()
return client.assert.equal(allFileRows.value.length, 0)
})

Then('the trashbin should be empty on the webUI', async function() {
const allFileRows = await client.page.FilesPageElement.filesList().allFileRows()
return client.assert.strictEqual(allFileRows.value.length, 0)
})

const theseResourcesShouldNotBeListed = async function(table) {
for (const entry of table.rows()) {
const state = await client.page.FilesPageElement.filesList().isElementListed(
Expand Down Expand Up @@ -761,12 +760,6 @@ Then(/the count of files and folders shown on the webUI should be (\d+)/, async
return client.assert.equal(itemsCount, noOfItems)
})

Then('the folder should be empty on the webUI after a page reload', async function() {
await client.refresh()
const allFileRows = await client.page.FilesPageElement.filesList().allFileRows()
return client.assert.equal(allFileRows.value.length, 0)
})

Then('the app-sidebar should be visible', function() {
return client.page.filesPage().isSidebarVisible(value => {
assert.strictEqual(value, true, 'side-bar should be visible, but is not')
Expand Down

0 comments on commit 4ab5a8b

Please sign in to comment.