Skip to content

Commit

Permalink
Discard new tab wait for file creation and public link open
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Sep 8, 2023
1 parent 4b23bbc commit 453352a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ def e2eTests(ctx):
# oCIS specific steps
steps += copyFilesForUpload() + \
(tikaService() if params["tikaNeeded"] else []) + \
ocisService("e2e-tests", tika_enabled = params["tikaNeeded"]) + \
getSkeletonFiles()
ocisService("e2e-tests", tika_enabled = params["tikaNeeded"])

steps += [{
steps += getSkeletonFiles() + \
[{
"name": "e2e-tests",
"image": OC_CI_NODEJS,
"environment": environment,
Expand Down
31 changes: 13 additions & 18 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'
import util from 'util'
import path from 'path'
import { resourceExists, waitForResources } from './utils'
import { sidebar, editor } from '../utils'
import { editor, sidebar } from '../utils'
import { File, Space } from '../../../types'
import { dragDropFiles } from '../../../utils/dragDrop'

Expand Down Expand Up @@ -281,18 +281,17 @@ const createDocumentFile = async (
}
await page.locator(util.format(createNewOfficeDocumentFileBUtton, type)).click()
await page.locator(resourceNameInput).fill(name)
const [editorPage] = await Promise.all([
page.waitForEvent('popup'),
await Promise.all([
page.waitForLoadState(),
page.waitForURL('**/external/personal/**'),
page.waitForResponse((resp) => resp.status() === 200 && resp.request().method() === 'POST'),
page.locator(util.format(actionConfirmationButton, 'Create')).click()
])
await editorPage.waitForLoadState()
await editorPage.waitForURL('**/external/personal/**')
const editorMainFrame = await editorPage.frameLocator(externalEditorIframe)
const editorMainFrame = await page.frameLocator(externalEditorIframe)
switch (editorToOpen) {
case 'Collabora':
await editorMainFrame.locator(collaboraWelcomeModalIframe).waitFor()
await editorPage.keyboard.press('Escape')
await page.keyboard.press('Escape')
await editorMainFrame.locator(collaboraDocTextAreaSelector).type(content)
const saveModified = await editorMainFrame.locator(collaboraEditorSaveSelector)
await expect(saveModified).toBeVisible()
Expand All @@ -310,7 +309,6 @@ const createDocumentFile = async (
"Editor should be either 'Collabora' or 'OnlyOffice' but found " + editorToOpen
)
}
await editorPage.close()
}

export const openAndGetContentOfDocument = async ({
Expand All @@ -320,14 +318,13 @@ export const openAndGetContentOfDocument = async ({
page: Page
editorToOpen: string
}): Promise<string> => {
const editorPage = await page.waitForEvent('popup')
await editorPage.waitForLoadState()
await editorPage.waitForURL('**/external/public/**')
const editorMainFrame = await editorPage.frameLocator(externalEditorIframe)
await page.waitForLoadState()
await page.waitForURL('**/external/public/**')
const editorMainFrame = await page.frameLocator(externalEditorIframe)
switch (editorToOpen) {
case 'Collabora':
await editorMainFrame.locator(collaboraWelcomeModalIframe).waitFor()
await editorPage.keyboard.press('Escape')
await page.keyboard.press('Escape')
await editorMainFrame.locator(collaboraCanvasEditorSelector).click()
break
case 'OnlyOffice':
Expand All @@ -341,11 +338,9 @@ export const openAndGetContentOfDocument = async ({
)
}
// copying and getting the value with keyboard requires some
await editorPage.keyboard.press('Control+A', { delay: 200 })
await editorPage.keyboard.press('Control+C', { delay: 200 })
const actualContentOfEditor = await editorPage.evaluate(() => navigator.clipboard.readText())
await editorPage.close()
return actualContentOfEditor
await page.keyboard.press('Control+A', { delay: 200 })
await page.keyboard.press('Control+C', { delay: 200 })
return await page.evaluate(() => navigator.clipboard.readText())
}

const isAppProviderServiceForOfficeSuitesReadyInWebUI = async (page, type) => {
Expand Down

0 comments on commit 453352a

Please sign in to comment.