Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .woodpecker.star
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,15 @@ def e2eTests(ctx):
if "app-provider-onlyOffice" in suite:
environment["FAIL_ON_UNCAUGHT_CONSOLE_ERR"] = False
steps += onlyofficeService() + \
waitForService("onlyoffice", "443") + \
waitForWebOffice("https://onlyoffice") + \
openCloudService(params["extraServerEnvironment"]) + \
wopiCollaborationService("onlyoffice") + \
waitForService("wopi-onlyoffice", "9300")

elif "app-provider" in suite:
environment["FAIL_ON_UNCAUGHT_CONSOLE_ERR"] = False
steps += collaboraService() + \
waitForService("collabora", "9980") + \
waitForWebOffice("https://collabora:9980") + \
openCloudService(params["extraServerEnvironment"]) + \
wopiCollaborationService("collabora") + \
waitForService("wopi-collabora", "9300")
Expand Down Expand Up @@ -1670,3 +1670,18 @@ def restoreBrowsersCache(browser):
],
},
]

def waitForWebOffice(office_url = ""):
if office_url == "":
return []
office_url += "/hosting/discovery"
return [{
"name": "wait-for-weboffice",
"image": OC_CI_NODEJS,
"commands": [
"timeout 300 bash -c " +
"'while [ `curl %s" % office_url +
" -w \"%{http_code}\" -o /dev/null -sk` != \"200\" ]; do " +
"echo \"Waiting...\" && sleep 2; done'",
],
}]
10 changes: 9 additions & 1 deletion tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Download, Locator, Page, expect } from '@playwright/test'
import { setDefaultTimeout } from '@cucumber/cucumber'
import util from 'util'
import path from 'path'
import { waitForResources } from './utils'
Expand Down Expand Up @@ -109,7 +110,7 @@ const filesContextMenuAction = 'div[id^="context-menu-drop"] button.oc-files-act
const highlightedTileCardSelector = '.oc-tile-card-selected'
const emptyTrashbinButtonSelector = '.oc-files-actions-empty-trash-bin-trigger'
const resourceLockIcon =
'//*[@data-test-resource-name="%s"]/ancestor::tr//td//span[@data-test-indicator-type="resource-locked"]'
'//*[@data-test-resource-name="%s"]/ancestor::*[self::li or self::tr]//span[@data-test-indicator-type="resource-locked"]'
const sharesNavigationButtonSelector = '.oc-sidebar-nav [data-nav-name="files-shares"]'
const keepBothButton = '.oc-modal-body-actions-confirm'
const mediaNavigationButton = `//button[contains(@class, "preview-controls-%s")]`
Expand Down Expand Up @@ -456,6 +457,8 @@ const createDocumentFile = async (

await page.reload()
await page.locator(util.format(resourceNameSelector, name)).waitFor()
// wait for lock to be removed
expect(getLockLocator({ page, resource: name })).not.toBeVisible()
}

export const fillContentOfDocument = async ({
Expand Down Expand Up @@ -731,9 +734,14 @@ export const resumeResourceUpload = async (page: Page): Promise<void> => {
await pauseResumeUpload(page)
await page.locator(pauseUploadButton).waitFor()

// increase the test timeout for large uploads
setDefaultTimeout(config.largeUploadTimeout * 1000)
await page
.locator(uploadInfoSuccessLabelSelector)
.waitFor({ timeout: config.largeUploadTimeout * 1000 })
// revert to the default timeout
setDefaultTimeout(config.timeout * 1000)

await page.locator(uploadInfoCloseButton).click()
}

Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/support/objects/app-files/share/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ export const openSharingPanel = async function (
case 'SIDEBAR_PANEL':
await sidebar.open({ page, resource: item })
await sidebar.openPanel({ page, name: 'sharing' })
// NOTE: loader re-appears after panel is opened
await page.locator(invitePanel).waitFor()
await page.locator('div.oc-loader').waitFor({ state: 'detached' })
break
}

await page.locator(invitePanel).waitFor()
await page.locator('div.oc-loader').waitFor({ state: 'detached' })

// always click on the “Show more” button if it exists
const showMore = page.locator(showMoreBtn)
Expand Down
7 changes: 5 additions & 2 deletions tests/e2e/support/objects/app-files/utils/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export const openPanel = async ({ page, name }: { page: Page; name: string }): P
}
const panelSelector = page.locator(`#sidebar-panel-${name}-select`)
const nextPanel = page.locator(`#sidebar-panel-${name}`)
await panelSelector.click()
await page.locator('div.oc-loader').waitFor({ state: 'detached' })
await Promise.all([
page.locator('div.oc-loader').waitFor({ state: 'detached' }),
locatorUtils.waitForEvent(nextPanel, 'transitionend'),
panelSelector.click()
])
await nextPanel.waitFor()
}
14 changes: 12 additions & 2 deletions tests/e2e/support/utils/locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ import { config } from '../../config'
export const waitForEvent = (locator: Locator, type: keyof SVGElementEventMap): Promise<void> =>
locator.evaluate(
(element, arg) =>
new Promise<void>((resolve) => {
new Promise<void>((resolve, reject) => {
const timeoutId = setTimeout(() => {
clearTimeout(timeoutId)
reject(
new Error(
`locator.evaluate: Timeout ${arg.timeout}ms exceeded. Waiting for event: ${arg.type}`
)
)
}, arg.timeout)

const finalizer = () => {
element.removeEventListener(arg.type, finalizer)
clearTimeout(timeoutId)
resolve()
}

element.addEventListener(arg.type, finalizer)
}),
{ type }
{ type, timeout: config.timeout * 1000 }
)

export const buildXpathLiteral = (value: string) => {
Expand Down