Skip to content

Commit

Permalink
url stability. open file through Collabora (#10420)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor authored and saw-jan committed Mar 4, 2024
1 parent 40018f2 commit 0c06b30
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ 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 |
| 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"
And "Alice" logs out
And "Anonymous" opens the public link "Link"
And "Anonymous" unlocks the public link with password "%public%"
Expand All @@ -32,6 +36,9 @@ 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
16 changes: 16 additions & 0 deletions tests/e2e/cucumber/steps/ui/navigateByUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ When(
}
)

When(
/^"([^"]*)" opens the file "([^"]*)" of space "([^"]*)" in (collabora|OnlyOffice) through the URL$/,
async function (
this: World,
stepUser: string,
resource: string,
space: string,
editorName: 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 })
}
)

When(
'{string} opens space {string} through the URL',
async function (this: World, stepUser: string, space: string): Promise<void> {
Expand Down
12 changes: 9 additions & 3 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,18 @@ export const openAndGetContentOfDocument = async ({
editorToOpen: string
}): Promise<string> => {
await page.waitForLoadState()
await page.waitForURL('**/external/public/**')
await page.waitForURL('**/external/**')
const editorMainFrame = page.frameLocator(externalEditorIframe)
switch (editorToOpen) {
case 'Collabora':
await editorMainFrame.locator(collaboraWelcomeModalIframe).waitFor()
await page.keyboard.press('Escape')
try {
await editorMainFrame
.locator(collaboraWelcomeModalIframe)
.waitFor({ timeout: config.minTimeout * 1000 })
await page.keyboard.press('Escape')
} catch (e) {
console.log('No welcome modal found. Continue...')
}
await editorMainFrame.locator(collaboraCanvasEditorSelector).click()
break
case 'OnlyOffice':
Expand Down
8 changes: 6 additions & 2 deletions tests/e2e/support/objects/url-navigation/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface openResourceViaUrlArgs {
resource?: string
user: User
space?: string
editorName?: string
}

export const navigateToDetailsPanelOfResource = async (
Expand All @@ -29,9 +30,12 @@ export const navigateToDetailsPanelOfResource = async (
}

export const openResourceViaUrl = async (args: openResourceViaUrlArgs) => {
const { page, resource, user, space } = args
const { page, resource, user, space, editorName } = args
const fileId = await getTheFileIdOfSpaceFile(user, space, resource)
const fullUrl = `${config.backendUrl}/f/${fileId}`

const fullUrl = editorName
? `${config.backendUrl}/external/open-with-web/?appName=${editorName}&fileId=${fileId}`
: `${config.backendUrl}/f/${fileId}`
await page.goto(fullUrl)
}

Expand Down

0 comments on commit 0c06b30

Please sign in to comment.