Skip to content

Commit

Permalink
backport from master to stable
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Feb 26, 2024
1 parent adb5b34 commit c198fc1
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 26 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
21 changes: 0 additions & 21 deletions tests/e2e/cucumber/features/smoke/languageChange.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,3 @@ Feature: language settings
| message |
| Brian Murphy hat check_message mit Ihnen geteilt |
And "Alice" logs out


Scenario: anonymous user language change
When "Alice" logs in
And "Alice" creates the following folder in personal space using API
| name |
| folderPublic |
And "Alice" uploads the following local file into personal space using API
| localFile | to |
| filesForUpload/lorem.txt | lorem.txt |

And "Alice" opens the "files" app
And "Alice" creates a public link creates a public link of following resource using the sidebar panel
| resource | password |
| folderPublic | %public% |
And "Alice" logs out
When "Anonymous" opens the public link "Link"
And "Anonymous" unlocks the public link with password "%public%"
And "Anonymous" opens the user menu
And "Anonymous" changes the language to "Deutsch - German"
Then "Anonymous" should see the following account page title "Konto"
10 changes: 10 additions & 0 deletions tests/e2e/cucumber/steps/ui/accountMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ When(
expect(expectedLanguage).toBe(language)
}
)

Then(
'{string} should see the following account page title {string}',
async function (this: World, stepUser: string, title: string): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const accountObject = new objects.account.Account({ page })
const pageTitle = await accountObject.getTitle()
expect(pageTitle).toEqual(title)
}
)
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
7 changes: 7 additions & 0 deletions tests/e2e/support/objects/account/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const downloadExportButton = '[data-testid="download-export-btn"]'
const languageInput = '[data-testid="language"] .vs__search'
const languageValueDropDown = `.vs__dropdown-menu :text-is("%s")`
const languageValue = '[data-testid="language"] .vs__selected'
const accountPageTitle = '#account-page-title'

export const getQuotaValue = async (args: { page: Page }): Promise<string> => {
const { page } = args
Expand Down Expand Up @@ -82,6 +83,7 @@ export const downloadGdprExport = async (args: { page: Page }): Promise<string>
export const changeLanguage = async (args: { page: Page; language: string }): Promise<string> => {
const { page, language } = args
await page.locator(languageInput).waitFor()
await page.locator(languageInput).click()
await page.locator(languageInput).pressSequentially(language)
await Promise.all([
page.waitForResponse(
Expand All @@ -94,3 +96,8 @@ export const changeLanguage = async (args: { page: Page; language: string }): Pr
])
return (await page.locator(languageValue).textContent()).trim()
}

export const getTitle = (args: { page: Page }): Promise<string> => {
const { page } = args
return page.locator(accountPageTitle).textContent()
}
4 changes: 4 additions & 0 deletions tests/e2e/support/objects/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ export class Account {
changeLanguage(language): Promise<string> {
return po.changeLanguage({ page: this.#page, language })
}

getTitle(): Promise<string> {
return po.getTitle({ page: this.#page })
}
}
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 c198fc1

Please sign in to comment.