Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] Fix flaky 'create-space-from-resource'-e2e test #8781

Merged
merged 3 commits into from
Apr 12, 2023
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
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
Feature: create Space shortcut
#
# FIXME: skipped because of oCIS pipeline, un-skip and check if https://github.com/owncloud/web/pull/8781 solves the issue
# Scenario: create Space from folder
# Given "Admin" creates following users using API
# | id |
# | Alice |
# And "Admin" assigns following roles to the users using API
# | id | role |
# | Alice | Space Admin |
# And "Alice" creates the following folder in personal space using API
# | name |
# | spaceFolder |
# | spaceFolder/test |
# When "Alice" logs in
# And "Alice" navigates to the personal space page
# And "Alice" uploads the following resources
# | resource | to |
# | data.zip | spaceFolder |
# | lorem.txt | spaceFolder |
# And "Alice" navigates to the personal space page
# And "Alice" creates space "folderSpace" from folder "spaceFolder" using the context menu
# And "Alice" navigates to the projects space page
# And "Alice" navigates to the project space "folderSpace"
# Then following resources should be displayed in the files list for user "Alice"
# | resource |
# | data.zip |
# | lorem.txt |
# And "Alice" logs out
#
# Scenario: create space from resources
# Given "Admin" creates following users using API
# | id |
# | Alice |
# And "Admin" assigns following roles to the users using API
# | id | role |
# | Alice | Space Admin |
# And "Alice" creates the following folder in personal space using API
# | name |
# | resourceFolder |
# When "Alice" logs in
# And "Alice" navigates to the personal space page
# And "Alice" uploads the following resources
# | resource | to |
# | data.zip | resourceFolder |
# | lorem.txt | |
# And "Alice" navigates to the personal space page
# And "Alice" creates space "resourceSpace" from resources using the context menu
# | resource |
# | resourceFolder |
# | lorem.txt |
# And "Alice" navigates to the projects space page
# And "Alice" navigates to the project space "resourceSpace"
# Then following resources should be displayed in the files list for user "Alice"
# | resource |
# | resourceFolder |
# | lorem.txt |
# And "Alice" logs out

Scenario: create Space from folder
Given "Admin" creates following users using API
| id |
| Alice |
And "Admin" assigns following roles to the users using API
| id | role |
| Alice | Space Admin |
And "Alice" creates the following folder in personal space using API
| name |
| spaceFolder |
| spaceFolder/test |
When "Alice" logs in
And "Alice" navigates to the personal space page
And "Alice" uploads the following resources
| resource | to |
| data.zip | spaceFolder |
| lorem.txt | spaceFolder |
And "Alice" navigates to the personal space page
And "Alice" creates space "folderSpace" from folder "spaceFolder" using the context menu
And "Alice" navigates to the projects space page
And "Alice" navigates to the project space "folderSpace"
Then following resources should be displayed in the files list for user "Alice"
| resource |
| data.zip |
| lorem.txt |
And "Alice" logs out

Scenario: create space from resources
Given "Admin" creates following users using API
| id |
| Alice |
And "Admin" assigns following roles to the users using API
| id | role |
| Alice | Space Admin |
And "Alice" creates the following folder in personal space using API
| name |
| resourceFolder |
When "Alice" logs in
And "Alice" navigates to the personal space page
And "Alice" uploads the following resources
| resource | to |
| data.zip | resourceFolder |
| lorem.txt | |
And "Alice" navigates to the personal space page
And "Alice" creates space "resourceSpace" from resources using the context menu
| resource |
| resourceFolder |
| lorem.txt |
And "Alice" navigates to the projects space page
And "Alice" navigates to the project space "resourceSpace"
Then following resources should be displayed in the files list for user "Alice"
| resource |
| resourceFolder |
| lorem.txt |
And "Alice" logs out
45 changes: 27 additions & 18 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const downloadFolderButtonSidedBar =
'#oc-files-actions-sidebar .oc-files-actions-download-archive-trigger'
const downloadButtonBatchAction = '.oc-files-actions-download-archive-trigger'
const deleteButtonBatchAction = '.oc-files-actions-delete-trigger'
const createSpaceFromResourceAction = '.oc-files-actions-create-space-from-resource-trigger'
const checkBox = `//*[@data-test-resource-name="%s"]//ancestor::tr//input`
const checkBoxForTrashbin = `//*[@data-test-resource-path="%s"]//ancestor::tr//input`
export const fileRow =
Expand Down Expand Up @@ -43,6 +44,7 @@ const versionRevertButton = '//*[@data-testid="file-versions-revert-button"]'
const actionButton = '//*[contains(@data-testid, "action-handler")]/span[text()="%s"]'
const emptyTrashBinButton = '.oc-files-actions-empty-trash-bin-trigger'
const notificationMessageDialog = '.oc-notification-message-title'
const notificationMessage = '.oc-notification-message'
const permanentDeleteButton = '.oc-files-actions-delete-permanent-trigger'
const restoreResourceButton = '.oc-files-actions-restore-trigger'
const globalSearchInput = '.oc-search-input'
Expand Down Expand Up @@ -108,15 +110,19 @@ export const createSpaceFromFolder = async ({
spaceName: string
}): Promise<Space> => {
await page.locator(util.format(resourceNameSelector, folderName)).click({ button: 'right' })
await page.locator('text=Create Space from selection').first().click()
await page.locator('.oc-text-input').first().fill(spaceName)
await page.locator(util.format(actionConfirmationButton, 'Create')).click()
const response = await page.waitForResponse(
(resp) =>
resp.status() === 201 && resp.request().method() === 'POST' && resp.url().endsWith('/drives')
)
await page.waitForSelector('#oc-loading-indicator')
await page.waitForSelector('#oc-loading-indicator', { state: 'detached' })
await page.locator(createSpaceFromResourceAction).click()
await page.locator(resourceNameInput).fill(spaceName)
const [response] = await Promise.all([
page.waitForResponse(
(resp) =>
resp.status() === 201 &&
resp.request().method() === 'POST' &&
resp.url().endsWith('/drives')
),
page.locator(util.format(actionConfirmationButton, 'Create')).click()
])

await page.waitForSelector(notificationMessage)
return (await response.json()) as Space
}

Expand All @@ -136,15 +142,18 @@ export const createSpaceFromSelection = async ({
})
await page.locator(util.format(resourceNameSelector, resources[0])).click({ button: 'right' })

await page.locator('text=Create Space from selection').first().click()
await page.locator('.oc-text-input').first().fill(spaceName)
await page.locator(util.format(actionConfirmationButton, 'Create')).click()
const response = await page.waitForResponse(
(resp) =>
resp.status() === 201 && resp.request().method() === 'POST' && resp.url().endsWith('/drives')
)
await page.waitForSelector('#oc-loading-indicator')
await page.waitForSelector('#oc-loading-indicator', { state: 'detached' })
await page.locator(createSpaceFromResourceAction).click()
await page.locator(resourceNameInput).fill(spaceName)
const [response] = await Promise.all([
page.waitForResponse(
(resp) =>
resp.status() === 201 &&
resp.request().method() === 'POST' &&
resp.url().endsWith('/drives')
),
page.locator(util.format(actionConfirmationButton, 'Create')).click()
])
await page.waitForSelector(notificationMessage)
return (await response.json()) as Space
}

Expand Down