Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/e2e/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ export const config = {
parallel: parseInt(process.env.PARALLEL) || 1,
// playwright
slowMo: parseInt(process.env.SLOW_MO) || 0,
timeout: parseInt(process.env.TIMEOUT) || 120,
// timeout for a whole test scenario
testTimeout: parseInt(process.env.TEST_TIMEOUT) || 120,
// timeout used for test actions
get timeout() {
return this.testTimeout / 2
},
// double the timeout for large file uploads
get largeUploadTimeout() {
return this.timeout * 2
return this.testTimeout * 2
},
minTimeout: parseInt(process.env.MIN_TIMEOUT) || 5,
tokenTimeout: parseInt(process.env.TOKEN_TIMEOUT) || 40,
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ interface Config {
parallel: number

slowMo: number
timeout: number
testTimeout: number
readonly timeout: number
readonly largeUploadTimeout: number
minTimeout: number
tokenTimeout: number
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cucumber/environment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const logger = pino({
}
})

setDefaultTimeout(config.debug ? -1 : config.timeout * 1000)
setDefaultTimeout(config.debug ? -1 : config.testTimeout * 1000)
setWorldConstructor(World)

Before(async function (this: World, { pickle }: ITestCaseHookParameter) {
Expand Down
33 changes: 16 additions & 17 deletions tests/e2e/cucumber/features/search/search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,21 @@ Feature: Search
| resource |
| folder |
| FolDer |
| PARENT |
| new-lorem-big.txt |

# subfolder search
And "Alice" searches "child" using the global search and the "all files" filter
Then following resources should be displayed in the search list for user "Alice"
| resource |
| child-one |
| child-two |
| resource |
| FolDer/child-one |
| FolDer/child-one/child-two |
But following resources should not be displayed in the search list for user "Alice"
| resource |
| folder |
| FolDer |
| folder_from_brian |
| .hidden-file.txt |
| new-lorem-big.txt |
| resource |
| folder |
| FolDer |
| new_share_from_brian |
| .hidden-file.txt |
| new-lorem-big.txt |

# received shares search
And "Alice" searches "NEW" using the global search and the "all files" filter
Expand Down Expand Up @@ -136,16 +135,16 @@ Feature: Search
When "Alice" opens folder "mainFolder"
And "Alice" searches "example" using the global search and the "all files" filter
Then following resources should be displayed in the search list for user "Alice"
| resource |
| exampleInsideThePersonalSpace.txt |
| exampleInsideTheMainFolder.txt |
| exampleInsideTheSubFolder.txt |
| resource |
| exampleInsideThePersonalSpace.txt |
| mainFolder/exampleInsideTheMainFolder.txt |
| mainFolder/subFolder/exampleInsideTheSubFolder.txt |

When "Alice" searches "example" using the global search and the "current folder" filter
Then following resources should be displayed in the search list for user "Alice"
| resource |
| exampleInsideTheMainFolder.txt |
| exampleInsideTheSubFolder.txt |
| resource |
| mainFolder/exampleInsideTheMainFolder.txt |
| mainFolder/subFolder/exampleInsideTheSubFolder.txt |
But following resources should not be displayed in the search list for user "Alice"
| resource |
| exampleInsideThePersonalSpace.txt |
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/cucumber/features/search/searchProjectSpace.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Feature: Search in the project space
# search for project space objects
When "Alice" searches "-'s" using the global search and the "all files" filter
Then following resources should be displayed in the search list for user "Alice"
| resource |
| new-'single'quotes.txt |
| resource |
| folder(WithSymbols:!;_+-&)/new-'single'quotes.txt |
But following resources should not be displayed in the search list for user "Alice"
| resource |
| folder(WithSymbols:!;_+-&) |
Expand All @@ -33,6 +33,6 @@ Feature: Search in the project space
| resource |
| folder(WithSymbols:!;_+-&) |
But following resources should not be displayed in the search list for user "Alice"
| resource |
| new-'single'quotes.txt |
| resource |
| folder(WithSymbols:!;_+-&)/new-'single'quotes.txt |
And "Alice" logs out
9 changes: 8 additions & 1 deletion tests/e2e/cucumber/features/smoke/trashbinDelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,24 @@ Feature: Trashbin delete
Given "Alice" creates the following folders in personal space using API
| name |
| folderToShare |
| empty-folder |
| empty-folder |
And "Alice" creates the following files into personal space using API
| pathToFile | content |
| folderToShare/lorem.txt | lorem ipsum |
| sample.txt | sample |
And "Alice" opens the "files" app
And following resources should be displayed in the files list for user "Alice"
| resource |
| sample.txt |
And "Alice" shares the following resource using the sidebar panel
| resource | recipient | type | role | resourceType |
| folderToShare | Brian | user | Can edit | folder |
And "Brian" logs in
And "Brian" navigates to the shared with me page
And "Brian" opens folder "folderToShare"
And following resources should be displayed in the files list for user "Brian"
| resource |
| lorem.txt |
When "Brian" deletes the following resources using the sidebar panel
| resource |
| lorem.txt |
Expand Down
39 changes: 32 additions & 7 deletions tests/e2e/cucumber/steps/ui/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { expect } from '@playwright/test'
import { config } from '../../../config'
import {
createResourceTypes,
displayedResourceType,
shortcutType,
ActionViaType,
PanelType
Expand All @@ -16,6 +15,7 @@ import { Resource } from '../../../support/objects/app-files'
import * as runtimeFs from '../../../support/utils/runtimeFs'
import { searchFilter } from '../../../support/objects/app-files/resource/actions'
import { File } from '../../../support/types'
import { waitProcessingToFinish } from '../../../support/objects/app-files/fileEvents'

When(
'{string} creates the following resource(s)',
Expand Down Expand Up @@ -365,21 +365,44 @@ When(
)

Then(
/^following resources (should|should not) be displayed in the (search list|files list|Shares|trashbin) for user "([^"]*)"$/,
/^following resources (should|should not) be displayed in the (?:files list|Shares|trashbin) for user "([^"]*)"$/,
async function (
this: World,
actionType: string,
stepUser: string,
stepTable: DataTable
): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const resourceObject = new objects.applicationFiles.Resource({ page })
for (const info of stepTable.hashes()) {
if (actionType === 'should') {
await expect(resourceObject.getResourceLocator(info.resource)).toBeVisible({
timeout: config.timeout * 1000
})
await waitProcessingToFinish(page, info.resource)
return
}
await expect(resourceObject.getResourceLocator(info.resource)).not.toBeVisible()
}
}
)

Then(
/^following resources (should|should not) be displayed in the search list for user "([^"]*)"$/,
async function (
this: World,
actionType: string,
listType: string,
stepUser: string,
stepTable: DataTable
): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const resourceObject = new objects.applicationFiles.Resource({ page })
const actualList = await resourceObject.getDisplayedResources({
keyword: listType as displayedResourceType
})
for (const info of stepTable.hashes()) {
expect(actualList.includes(info.resource)).toBe(actionType === 'should')
if (actionType === 'should') {
await expect(resourceObject.getResourceSearchItemLocator(info.resource)).toBeVisible()
return
}
await expect(resourceObject.getResourceSearchItemLocator(info.resource)).not.toBeVisible()
}
}
)
Expand Down Expand Up @@ -988,6 +1011,8 @@ Then(
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const resourceObject = new objects.applicationFiles.Resource({ page })
if (actionType === 'should') {
await resourceObject.getResourceLocator(resource).waitFor()
await waitProcessingToFinish(page, resource)
action === 'thumbnail and preview' &&
(await expect(resourceObject.getFileThumbnailLocator(resource)).toBeVisible())
await resourceObject.shouldSeeFilePreview({ resource })
Expand Down
29 changes: 29 additions & 0 deletions tests/e2e/support/objects/app-files/fileEvents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Page, Locator, expect } from '@playwright/test'
import util from 'util'
import { config } from '../../../config'

const resourceProcessingIcon =
'//*[@data-test-resource-name="%s"]/ancestor::*[self::li or self::tr]//span[@data-test-indicator-type="resource-processing"]'
const resourceLockIcon =
'//*[@data-test-resource-name="%s"]/ancestor::*[self::li or self::tr]//span[@data-test-indicator-type="resource-locked"]'

const getProcessingLocator = (page: Page, resource: string): Locator => {
return page.locator(util.format(resourceProcessingIcon, resource))
}

export const getLockLocator = (page: Page, resource: string): Locator => {
return page.locator(util.format(resourceLockIcon, resource))
}

export const waitProcessingToFinish = async (page: Page, resource: string): Promise<void> => {
await expect(
getProcessingLocator(page, resource),
'Waiting for file processing to finish'
).toBeHidden({ timeout: config.timeout * 1000 })
}

export const waitForLockToDisappear = async (page: Page, resource: string): Promise<void> => {
await expect(getLockLocator(page, resource), 'Waiting for file lock to be removed').toBeHidden({
timeout: config.timeout * 1000
})
}
1 change: 1 addition & 0 deletions tests/e2e/support/objects/app-files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { Share } from './share'
export { Spaces } from './spaces'
export { Trashbin } from './trashbin'
export { Search } from './search'
export * as fileEvents from './fileEvents'
Loading