Skip to content

Commit

Permalink
test: fix e2e move- and copy-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Jul 16, 2024
1 parent bcfa1de commit dfa4a9c
Showing 1 changed file with 8 additions and 36 deletions.
44 changes: 8 additions & 36 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,12 +830,7 @@ export const pasteResource = async (args: moveOrCopyResourceArgs): Promise<void>
}
if (option) {
await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(resource) &&
resp.ok &&
resp.request().method() === action.toUpperCase()
),
page.waitForResponse((resp) => resp.ok && resp.request().method() === action.toUpperCase()),
option === 'replace'
? page.locator(actionSecondaryConfirmationButton).click()
: page.locator(keepBothButton).click()
Expand All @@ -859,16 +854,11 @@ export const moveOrCopyMultipleResources = async (

const waitForMoveResponses = []
if (['drag-drop-breadcrumb', 'drag-drop'].includes(method)) {
for (const resource of resources) {
resources.forEach(() => {
waitForMoveResponses.push(
page.waitForResponse(
(resp) =>
resp.url().endsWith(resource) &&
resp.status() === 201 &&
resp.request().method() === 'MOVE'
)
page.waitForResponse((resp) => resp.status() === 201 && resp.request().method() === 'MOVE')
)
}
})
}

switch (method) {
Expand Down Expand Up @@ -985,10 +975,7 @@ export const moveOrCopyResource = async (args: moveOrCopyResourceArgs): Promise<
}
await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(resource) &&
resp.status() === 201 &&
resp.request().method() === action.toUpperCase()
(resp) => resp.status() === 201 && resp.request().method() === action.toUpperCase()
),
page.keyboard.press('ControlOrMeta+v')
])
Expand All @@ -999,12 +986,7 @@ export const moveOrCopyResource = async (args: moveOrCopyResourceArgs): Promise<
const target = page.locator(util.format(resourceNameSelector, newLocation))

await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(resource) &&
resp.status() === 201 &&
resp.request().method() === 'MOVE'
),
page.waitForResponse((resp) => resp.status() === 201 && resp.request().method() === 'MOVE'),
source.dragTo(target)
])

Expand All @@ -1022,12 +1004,7 @@ export const moveOrCopyResource = async (args: moveOrCopyResourceArgs): Promise<
)

await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(resource) &&
resp.status() === 201 &&
resp.request().method() === 'MOVE'
),
page.waitForResponse((resp) => resp.status() === 201 && resp.request().method() === 'MOVE'),
source.dragTo(target)
])

Expand Down Expand Up @@ -1073,12 +1050,7 @@ export const renameResource = async (args: renameResourceArgs): Promise<void> =>
await page.locator(util.format(filesContextMenuAction, 'rename')).click()
await page.locator(fileRenameInput).fill(newName)
await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(resourceBase) &&
resp.status() === 201 &&
resp.request().method() === 'MOVE'
),
page.waitForResponse((resp) => resp.status() === 201 && resp.request().method() === 'MOVE'),
page.locator(util.format(actionConfirmationButton, 'Rename')).click()
])
}
Expand Down

0 comments on commit dfa4a9c

Please sign in to comment.