Skip to content

Commit

Permalink
Tika version is fixed, adding tag using API
Browse files Browse the repository at this point in the history
  • Loading branch information
grgprarup committed Jun 20, 2023
1 parent d83ee28 commit 3b816c3
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FEDERATED = 2
NOTIFICATIONS = 3

ALPINE_GIT = "alpine/git:latest"
APACHE_TIKA = "apache/tika:latest"
APACHE_TIKA = "apache/tika:2.8.0.0"
DEEPDIVER_DOCKER_ORACLE_XE_11G = "deepdiver/docker-oracle-xe-11g:latest"
DRONE_CLI_ALPINE = "drone/cli:alpine"
MINIO_MC = "minio/mc:RELEASE.2021-10-07T04-19-58Z"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ services:
command: tika:9998

tika:
image: apache/tika:latest
image: apache/tika:2.8.0.0
container_name: web_tika
ports:
- 9998:9998
Expand Down
15 changes: 3 additions & 12 deletions tests/e2e/cucumber/features/smoke/fullTextSearch.ocis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Feature: Search
And "Admin" assigns following roles to the users using API
| id | role |
| Brian | Space Admin |

And "Alice" logs in
And "Alice" creates the following folder in personal space using API
| name |
Expand All @@ -24,7 +23,6 @@ Feature: Search
And "Alice" shares the following resource using API
| resource | recipient | type | role |
| folderToShare | Brian | user | Can edit |

And "Brian" logs in
And "Brian" accepts the following share using API
| name |
Expand All @@ -38,7 +36,6 @@ Feature: Search
| filesForUpload/textfile.txt | fileWithTag.txt |
| filesForUpload/textfile.txt | withTag.txt |
| filesForUpload/textfile.txt | testFolder/innerTextfile.txt |

And "Brian" creates the following project spaces using API
| name | id |
| FullTextSearch | fulltextsearch.1 |
Expand All @@ -48,20 +45,14 @@ Feature: Search
And "Brian" creates the following file in space "FullTextSearch" using API
| name | content |
| spaceFolder/spaceTextfile.txt | This is test file. |

And "Brian" opens the "files" app
# And "Brian" adds the following tags for the following resources using API
# | resource | tags |
# | fileWithTag.txt | tag 1 |
# | withTag.txt | tag 1 |
And "Brian" adds the following tags for the following resources using the sidebar panel
And "Brian" adds the following tags for the following resources using API
| resource | tags |
| fileWithTag.txt | tag 1 |
| withTag.txt | tag 1 |

Scenario: Search for content of file
And "Brian" opens the "files" app

Scenario: Search for content of file
Given "Brian" opens the "files" app
When "Brian" searches "" using the global search bar
Then "Brian" should see the message "Search for files" on the webUI

Expand Down
31 changes: 13 additions & 18 deletions tests/e2e/cucumber/steps/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,21 +299,16 @@ Given(
}
)

// Given(
// '{string} adds the following tags for the following resources using API',
// async function (
// this: World,
// stepUser: string,
// stepTable: DataTable
// ): Promise<void> {
// const user = this.usersEnvironment.getUser({ key: stepUser })
// for (const info of stepTable.hashes()) {
// await api.graph.addTagsToTheResource({
// user,
// shareWith: info.user,
// shareType: info.shareType,
// role: info.role
// })
// }
// }
// )
Given(
'{string} adds the following tags for the following resources using API',
async function (this: World, stepUser: string, stepTable: DataTable): Promise<void> {
const user = this.usersEnvironment.getUser({ key: stepUser })
for (const info of stepTable.hashes()) {
await api.graph.addTagsToTheResource({
user,
resourceName: info.resource,
tag: info.tags
})
}
}
)
14 changes: 10 additions & 4 deletions tests/e2e/support/api/davSpaces/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const uploadFileInPersonalSpace = async ({
const webDavEndPathToRoot = config.ocis
? 'spaces/' + (await getPersonalSpaceId({ user }))
: 'files/' + user.id
console.log('User id:: ', await getPersonalSpaceId({ user }))
await createFile({ user, pathToFile, content, webDavEndPathToRoot })
}

Expand Down Expand Up @@ -138,11 +139,13 @@ export const uploadFileInsideSpaceBySpaceName = async ({
export const getDataOfFileInsideSpace = async ({
user,
pathToFileName,
spaceName
spaceName,
spaceType = 'project'
}: {
user: User
pathToFileName: string
spaceName: string
spaceType?: string
}): Promise<Response> => {
const body =
'<?xml version="1.0"?>\n' +
Expand Down Expand Up @@ -174,7 +177,7 @@ export const getDataOfFileInsideSpace = async ({
'remote.php',
'dav',
'spaces',
await getSpaceIdBySpaceName({ user, spaceType: 'project', spaceName }),
await getSpaceIdBySpaceName({ user, spaceType: spaceType, spaceName }),
pathToFileName
),
body: body,
Expand All @@ -188,16 +191,19 @@ export const getDataOfFileInsideSpace = async ({
export const getIdOfFileInsideSpace = async ({
user,
pathToFileName,
spaceName
spaceName,
spaceType
}: {
user: User
pathToFileName: string
spaceName: string
spaceType?: string
}): Promise<string> => {
const fileDataResponse = await getDataOfFileInsideSpace({
user,
pathToFileName,
spaceName
spaceName,
spaceType
})
// extract file id form the response
return _.get(fileDataResponse, '[0][d:prop][oc:fileid]')._text
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/support/api/graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export {
createSpace,
getSpaceIdBySpaceName,
disableSpace,
deleteSpace
deleteSpace,
addTagsToTheResource
} from './spaces'
28 changes: 28 additions & 0 deletions tests/e2e/support/api/graph/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,31 @@ export const deleteSpace = ({ user, space }: { user: User; space: Space }): Prom
header: { Purge: 'T' }
})
}

export const addTagsToTheResource = async ({
user,
resourceName,
tag
}: {
user: User
resourceName: string
tag: string
}): Promise<Response> => {
const resourceId = await getIdOfFileInsideSpace({
user: user,
pathToFileName: resourceName,
spaceName: user.displayName,
spaceType: 'personal'
})
const body = JSON.stringify({
resourceId: resourceId,
tags: [tag]
})

return request({
method: 'PUT',
path: join('graph', 'v1.0', 'extensions', 'org.libregraph', 'tags'),
body: body,
user: user
})
}
3 changes: 2 additions & 1 deletion tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,11 @@ export const getDisplayedResourcesFromFilesList = async (page): Promise<string[]
const result = await page.locator('[data-test-resource-path]')

const count = await result.count()
console.log('Count: ', count)
for (let i = 0; i < count; i++) {
files.push(await result.nth(i).getAttribute('data-test-resource-name'))
}

console.log('Files: ', files)
return files
}

Expand Down

0 comments on commit 3b816c3

Please sign in to comment.