Skip to content

Commit

Permalink
check file openning
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Feb 5, 2024
1 parent c6e8a9f commit 821933a
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice
| OpenDocument.odt | OpenDocument | OpenDocument Content |
And "Alice" creates a public link creates a public link of following resource using the sidebar panel
| resource | role | password |
| OpenDocument.odt | Can edit | %public% |

# Check that the file can be opened in collabora using the url. https://github.com/owncloud/web/issues/9897
When "Alice" opens the file "OpenDocument.odt" of space "personal" in collabora through the URL
Then "Alice" should see the content "OpenDocument Content" in editor "Collabora"
| OpenDocument.odt | Can edit | %public% |
And "Alice" logs out
And "Anonymous" opens the public link "Link"
And "Anonymous" unlocks the public link with password "%public%"
Expand All @@ -36,9 +32,6 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice
And "Alice" creates a public link creates a public link of following resource using the sidebar panel
| resource | role | password |
| MicrosoftWord.docx | Can edit | %public% |

# Check that the file can be opened in collabora using the url. https://github.com/owncloud/web/issues/9897
When "Alice" opens the file "MicrosoftWord.docx" of space "personal" in OnlyOffice through the URL
And "Alice" logs out
And "Anonymous" opens the public link "Link"
And "Anonymous" unlocks the public link with password "%public%"
Expand Down
45 changes: 45 additions & 0 deletions tests/e2e/cucumber/features/smoke/app-provider/urlJourneys.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Feature: url stability for mobile and desktop client
As a user
I want to work on different docs, sheets, slides etc.., using online office suites like Collabora or OnlyOffice
To make sure that opening the file from the mobile and desktop client happens without problems
# To run this feature we need to run the external app-provider service along with wopi, OnlyOffice, Collabora services
# This is a minimal test for the integration of ocis with different online office suites like Collabora and OnlyOffice

Background:
Given "Admin" creates following users using API
| id |
| Alice |
And "Alice" logs in
And "Alice" opens the "files" app

Scenario: create an OpenDocument file with Collabora
When "Alice" creates the following resources
| resource | type | content |
| OpenDocument.odt | OpenDocument | OpenDocument Content |

# Check that the file can be opened in collabora using the url. https://github.com/owncloud/web/issues/9897
# desktop feature
When "Alice" opens the file "OpenDocument.odt" of space "personal" in collabora through the URL for desktop client
Then "Alice" should see the content "OpenDocument Content" in editor "Collabora"

# mobile feature
When "Alice" opens the file "OpenDocument.odt" of space "personal" in collabora through the URL for mobile client
Then "Alice" should see the content "OpenDocument Content" in editor "Collabora"
And "Alice" logs out


Scenario: create a Microsoft Word file with OnlyOffice
When "Alice" creates the following resources
| resource | type | content |
| MicrosoftWord.docx | Microsoft Word | Microsoft Word Content |

# Check that the file can be opened in collabora using the url. https://github.com/owncloud/web/issues/9897
# desktop feature
When "Alice" opens the file "MicrosoftWord.docx" of space "personal" in OnlyOffice through the URL for desktop client
Then "Alice" should see the content "Microsoft Word Content" in editor "OnlyOffice"

# mobile feature
When "Alice" opens the file "MicrosoftWord.docx" of space "personal" in OnlyOffice through the URL for mobile client
Then "Alice" should see the content "Microsoft Word Content" in editor "OnlyOffice"
And "Alice" logs out

7 changes: 4 additions & 3 deletions tests/e2e/cucumber/steps/ui/navigateByUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ When(
)

When(
/^"([^"]*)" opens the file "([^"]*)" of space "([^"]*)" in (collabora|OnlyOffice) through the URL$/,
/^"([^"]*)" opens the file "([^"]*)" of space "([^"]*)" in (collabora|OnlyOffice) through the URL for (mobile|desktop) client$/,
async function (
this: World,
stepUser: string,
resource: string,
space: string,
editorName: string
editorName: string,
client: string
): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const user = this.usersEnvironment.getUser({ key: stepUser })
const urlNavObject = new objects.urlNavigation.URLNavigation({ page })
await urlNavObject.openResourceViaUrl({ resource, user, space, editorName })
await urlNavObject.openResourceViaUrl({ resource, user, space, editorName, client })
}
)

Expand Down
1 change: 1 addition & 0 deletions tests/e2e/support/api/external/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './openWithWeb'
22 changes: 22 additions & 0 deletions tests/e2e/support/api/external/openWithWeb.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import join from 'join-path'
import { checkResponseStatus, request } from '../http'
import { User } from '../../types'

export const getUrl = async ({
user,
fileId,
editorName
}: {
user: User
fileId: string
editorName: string
}): Promise<string> => {
const response = await request({
method: 'POST',
path: join('app', 'open-with-web', `?file_id=${fileId}`, `&app_name=${editorName}`),
user: user
})
checkResponseStatus(response, 'Failed while getting url')
const respBody = await response.json()
return respBody.uri
}
21 changes: 17 additions & 4 deletions tests/e2e/support/objects/url-navigation/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { config } from '../../../config'
import { getIdOfFileInsideSpace } from '../../api/davSpaces'
import { User } from '../../types'
import { getSpaceIdBySpaceName } from '../../api/graph'
import { getUrl } from '../../api/external'

export interface navigateToDetailsPanelOfResourceArgs {
page: Page
Expand All @@ -18,6 +19,7 @@ export interface openResourceViaUrlArgs {
user: User
space?: string
editorName?: string
client?: string
}

export const navigateToDetailsPanelOfResource = async (
Expand All @@ -30,12 +32,23 @@ export const navigateToDetailsPanelOfResource = async (
}

export const openResourceViaUrl = async (args: openResourceViaUrlArgs) => {
const { page, resource, user, space, editorName } = args
const { page, resource, user, space, editorName, client = '' } = args
const fileId = await getTheFileIdOfSpaceFile(user, space, resource)
let fullUrl

const fullUrl = editorName
? `${config.backendUrl}/external/open-with-web/?appName=${editorName}&fileId=${fileId}`
: `${config.backendUrl}/f/${fileId}`
switch (client) {
case 'desktop':
fullUrl = `${config.backendUrl}/external/open-with-web/?appName=${editorName}&fileId=${fileId}`
break
case 'mobile':
fullUrl = await getUrl({ user, fileId, editorName })
break
case '':
fullUrl = `${config.backendUrl}/f/${fileId}`
break
default:
throw new Error(`${client} not found`)
}
await page.goto(fullUrl)
}

Expand Down

0 comments on commit 821933a

Please sign in to comment.