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][full-ci][backport] move upload file exceeding quota test to e2e (#10428) #10536

Merged
merged 1 commit into from
Mar 5, 2024
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
Expand Up @@ -18,9 +18,6 @@ Other free text and markdown formatting can be used elsewhere in the document if

### [Different path for shares inside folder](https://github.com/owncloud/ocis/issues/1231)

### [Conflict / overwrite issues with TUS](https://github.com/owncloud/ocis/issues/1294)
- [webUIUpload/uploadFileGreaterThanQuotaSize.feature:11](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIUpload/uploadFileGreaterThanQuotaSize.feature#L11)

### [restoring a file deleted from a received shared folder is not possible](https://github.com/owncloud/ocis/issues/1124)
- [webUITrashbinRestore/trashbinRestore.feature:176](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinRestore/trashbinRestore.feature#L176)

Expand Down

This file was deleted.

9 changes: 8 additions & 1 deletion tests/e2e/cucumber/features/smoke/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ Feature: Upload
So that I can store them in owncloud

Background:
Given "Admin" creates following user using API
Given "Admin" logs in
And "Admin" creates following user using API
| id |
| Alice |
And "Alice" logs in
And "Admin" opens the "admin-settings" app
And "Admin" navigates to the users management page
When "Admin" changes the quota of the user "Alice" to "0.00001" using the sidebar panel
And "Alice" opens the "files" app


Expand All @@ -30,6 +34,9 @@ Feature: Upload
| resource |
| simple.pdf |
| testavatar.jpg |
And "Alice" tries to upload the following resource
| resource | error |
| lorem-big.txt | Not enough quota |
# currently upload folder feature is not available in playwright
# And "Alice" uploads the following resources
# | resource |
Expand Down
15 changes: 15 additions & 0 deletions tests/e2e/cucumber/steps/ui/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ When(
}
)

When(
'{string} tries to upload the following resource',
async function (this: World, stepUser: string, stepTable: DataTable): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const resourceObject = new objects.applicationFiles.Resource({ page })
for (const info of stepTable.hashes()) {
await resourceObject.tryToUpload({
to: info.to,
resources: [this.filesEnvironment.getFile({ name: info.resource })],
error: info.error
})
}
}
)

When(
'{string} starts uploading the following large resource(s) from the temp upload directory',
async function (this: World, stepUser: string, stepTable: DataTable): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/support/objects/app-admin-settings/users/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const userFilter = '.item-filter-%s'
const userFilterOption = '//ul[contains(@class, "item-filter-list")]//button[@data-test-value="%s"]'
const usersTable = '.users-table'
const quotaInput = '#quota-select-form .vs__search'
const quotaValueDropDown = `.vs__dropdown-option :text-is("%s")`
const quotaValueDropDown = 'ul.vs__dropdown-menu'
const userCheckboxSelector = `[data-item-id="%s"] input[type=checkbox]`
const editQuotaBtn = '.oc-users-actions-edit-quota-trigger'
const quotaInputBatchAction = '#quota-select-batch-action-form .vs__search'
Expand Down Expand Up @@ -102,7 +102,7 @@ export const changeQuota = async (args: {
}): Promise<void> => {
const { page, value, uuid } = args
await page.locator(quotaInput).pressSequentially(value)
await page.locator(util.format(quotaValueDropDown, `${value} GB`)).click()
await page.locator(quotaValueDropDown).first().click()

await Promise.all([
page.waitForResponse(
Expand Down
17 changes: 16 additions & 1 deletion tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const resourceNameInput = '.oc-modal input'
const resourceUploadButton = '#upload-menu-btn'
const fileUploadInput = '#files-file-upload-input'
const uploadInfoCloseButton = '#close-upload-info-btn'
const uploadErrorCloseButton = '.oc-notification-message-danger button[aria-label="Close"]'
const filesBatchAction = '.files-app-bar-actions .oc-files-actions-%s-trigger'
const pasteButton = '.paste-files-btn'
const breadcrumbRoot = '//nav[contains(@class, "oc-breadcrumb")]/ol/li[1]'
Expand Down Expand Up @@ -450,10 +451,12 @@ export interface uploadResourceArgs {
resources: File[]
to?: string
option?: string
error?: string
expectToFail?: boolean
}

const performUpload = async (args: uploadResourceArgs): Promise<void> => {
const { page, resources, to, option } = args
const { page, resources, to, option, error, expectToFail } = args
if (to) {
await clickResource({ page, path: to })
}
Expand Down Expand Up @@ -483,6 +486,12 @@ const performUpload = async (args: uploadResourceArgs): Promise<void> => {
}
}
}

if (expectToFail) {
expect(await page.locator(notificationMessageDialog).textContent()).toBe(error)
return
}

await Promise.all([
page.waitForResponse(
(resp) =>
Expand Down Expand Up @@ -517,6 +526,12 @@ export const uploadResource = async (args: uploadResourceArgs): Promise<void> =>
})
}

export const tryToUploadResource = async (args: uploadResourceArgs): Promise<void> => {
const { page } = args
await performUpload({ ...args, expectToFail: true })
await page.locator(uploadErrorCloseButton).click()
}

export const dropUploadFiles = async (args: uploadResourceArgs): Promise<void> => {
const { page, resources } = args

Expand Down
6 changes: 6 additions & 0 deletions tests/e2e/support/objects/app-files/resource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export class Resource {
await this.#page.goto(startUrl)
}

async tryToUpload(args: Omit<po.uploadResourceArgs, 'page'>): Promise<void> {
const startUrl = this.#page.url()
await po.tryToUploadResource({ ...args, page: this.#page })
await this.#page.goto(startUrl)
}

async uploadLargeNumberOfResources(args: Omit<po.uploadResourceArgs, 'page'>): Promise<void> {
const startUrl = this.#page.url()
await po.uploadLargeNumberOfResources({ ...args, page: this.#page })
Expand Down