Skip to content

Commit

Permalink
[full-ci]check file opening for mobile apps (#10442)
Browse files Browse the repository at this point in the history
* check file openning

* fix
  • Loading branch information
ScharfViktor authored Feb 6, 2024
1 parent ee0ff0c commit 5d0bfb7
Show file tree
Hide file tree
Showing 6 changed files with 76 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
34 changes: 34 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,34 @@
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 the file can be opened from the mobile and desktop client
# 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
# Check that the file can be opened in collabora or onlyoffice using the url. https://github.com/owncloud/web/issues/9897


Scenario: open office suite files with Collabora and onlyOffice
Given "Admin" creates following users using API
| id |
| Alice |
And "Alice" logs in
And "Alice" creates the following files into personal space using API
| pathToFile | content |
| OpenDocument.odt | OpenDocument Content |
And "Alice" creates the following resources
| resource | type | content |
| MicrosoftWord.docx | Microsoft Word | Microsoft Word Content |
And "Alice" opens the "files" app

# 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"
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 "OpenDocument.odt" of space "personal" in Collabora through the URL for mobile client
Then "Alice" should see the content "OpenDocument Content" in editor "Collabora"
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 getOpenWithWebUrl = 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
}
18 changes: 14 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 { getOpenWithWebUrl } 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,20 @@ 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 getOpenWithWebUrl({ user, fileId, editorName })
break
default:
fullUrl = `${config.backendUrl}/f/${fileId}`
}
await page.goto(fullUrl)
}

Expand Down

0 comments on commit 5d0bfb7

Please sign in to comment.