Skip to content

Commit

Permalink
refactor test step
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Sep 7, 2022
1 parent 4280724 commit c1ffa2f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 65 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports.config = {
// cucumber
retry: process.env.RETRY || 0,
// playwright
slowMo: parseInt(process.env.SLOW_MO) || 1000,
slowMo: parseInt(process.env.SLOW_MO) || 0,
timeout: parseInt(process.env.TIMEOUT) || 60,
headless: process.env.HEADLESS === 'true',
acceptDownloads: process.env.DOWNLOADS !== 'false',
Expand Down
92 changes: 46 additions & 46 deletions tests/e2e/cucumber/features/integrations/search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,49 @@ Feature: link
# But following resource should not be listed in the search list for user "Alice"
# | resource |
# | public |
# When "Alice" creates the following resources
# | resource | type |
# | PARENT/child | folder |
# | PARENT/child-one | folder |
# | PARENT/child-two | folder |
# | PARENT/test-folder | folder |
# And "Alice" opens folder "PARENT"
# And "Alice" searches "child" using the global search
# Then following resources should be displayed in the search list for user "Alice"
# | resource |
# | child |
# | child-one |
# | child-two |
# But following resource should not be displayed in the search list for user "Alice"
# | resource |
# | test-folder |
# And "Alice" opens the "files" app
# And "Alice" searches "foldeR" using the global search
# Then following resources should be displayed in the search list for user "Alice"
# | resource |
# | folder |
# | new-folder |
# | FolDer |
# | folderPublic |
# And "Alice" opens the "files" app
# When "Alice" uploads the following resources
# | resource |
# | new-lorem.txt |
# | new-lorem-big.txt |
# | new-data.zip |
# And "Alice" searches "new" using the global search
# Then following resources should be displayed in the search list for user "Alice"
# | resource |
# | new-lorem.txt |
# | new-lorem-big.txt |
# | new-data.zip |
# | new-folder |
# And "Alice" opens the "files" app
# When "Alice" enables the option to display the hidden file
# When "Alice" uploads the following resources
# | resource |
# | .hidden-file.txt |
# And "Alice" searches "hidden" using the global search
# Then following resource should be displayed in the search list for user "Alice"
# | resource |
# | .hidden-file.txt |
When "Alice" creates the following resources
| resource | type |
| PARENT/child | folder |
| PARENT/child-one | folder |
| PARENT/child-two | folder |
| PARENT/test-folder | folder |
And "Alice" opens folder "PARENT"
And "Alice" searches "child" using the global search
Then following resources should be displayed in the search list for user "Alice"
| resource |
| child |
| child-one |
| child-two |
But following resources should not be displayed in the search list for user "Alice"
| resource |
| test-folder |
And "Alice" opens the "files" app
And "Alice" searches "foldeR" using the global search
Then following resources should be displayed in the search list for user "Alice"
| resource |
| folder |
| new-folder |
| FolDer |
| folderPublic |
And "Alice" opens the "files" app
When "Alice" uploads the following resources
| resource |
| new-lorem.txt |
| new-lorem-big.txt |
| new-data.zip |
And "Alice" searches "new" using the global search
Then following resources should be displayed in the search list for user "Alice"
| resource |
| new-lorem.txt |
| new-lorem-big.txt |
| new-data.zip |
| new-folder |
And "Alice" opens the "files" app
When "Alice" enables the option to display the hidden file
When "Alice" uploads the following resources
| resource |
| .hidden-file.txt |
And "Alice" searches "hidden" using the global search
Then following resources should be displayed in the search list for user "Alice"
| resource |
| .hidden-file.txt |
19 changes: 2 additions & 17 deletions tests/e2e/cucumber/steps/app-files/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,35 +221,20 @@ Then(
async function (
this: World,
actionType: string,
_: 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()
console.log(actionType)
for (const info of stepTable.hashes()) {
const found = actualList.includes(info.resource)
expect(found).toBe(true)
if (actionType === 'should') expect(found).toBe(true)
else expect(found).toBe(false)
}
}
)

// Then(
// 'following resource should not be displayed in the search list for user {string}',
// async function (this: World, 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()
// console.log(actualList)
// for (const info of stepTable.hashes()) {
// const found = actualList.includes(info.resource)
// expect(found).toBe(false)
// }
// }
// )

When(
'{string} opens folder {string}',
async function (this: World, stepUser: string, resource: string): Promise<void> {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/support/objects/app-files/resource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
searchResourceGlobalSearch,
searchResourceGlobalSearchArgs,
getDisplayedResourcesFromSearch,
clickResource, showHiddenResources
clickResource,
showHiddenResources
} from './actions'

export class Resource {
Expand Down

0 comments on commit c1ffa2f

Please sign in to comment.