mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-29 00:00:05 +02:00
fix lint
Some checks failed
Integration tests for the release process / release-simulation (push) Has been cancelled
Some checks failed
Integration tests for the release process / release-simulation (push) Has been cancelled
This commit is contained in:
parent
cf868695f5
commit
b9f3138e08
2 changed files with 14 additions and 25 deletions
|
@ -104,17 +104,6 @@ func GetUploadByUUID(ctx context.Context, uuid string) (*Upload, error) {
|
||||||
return upload, nil
|
return upload, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUploadsByUUIDs returns multiple uploads by UUIDS
|
|
||||||
func GetUploadsByUUIDs(ctx context.Context, uuids []string) ([]*Upload, error) {
|
|
||||||
if len(uuids) == 0 {
|
|
||||||
return []*Upload{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Silently drop invalid uuids.
|
|
||||||
uploads := make([]*Upload, 0, len(uuids))
|
|
||||||
return uploads, db.GetEngine(ctx).In("uuid", uuids).Find(&uploads)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteUploads deletes multiple uploads
|
// DeleteUploads deletes multiple uploads
|
||||||
func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error) {
|
func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error) {
|
||||||
if len(uploads) == 0 {
|
if len(uploads) == 0 {
|
||||||
|
|
|
@ -7,40 +7,40 @@
|
||||||
|
|
||||||
/// <reference lib="dom"/>
|
/// <reference lib="dom"/>
|
||||||
|
|
||||||
import { expect } from '@playwright/test';
|
import {expect} from '@playwright/test';
|
||||||
import { test, dynamic_id, save_visual } from './utils_e2e.ts';
|
import {test, dynamic_id, save_visual} from './utils_e2e.ts';
|
||||||
|
|
||||||
test.use({ user: 'user2' });
|
test.use({user: 'user2'});
|
||||||
|
|
||||||
test('drap and drop upload', async ({ page }, workerInfo) => {
|
test('drap and drop upload', async ({page}) => {
|
||||||
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
||||||
expect(response?.status()).toBe(200); // Status OK
|
expect(response?.status()).toBe(200); // Status OK
|
||||||
|
|
||||||
const testID = dynamic_id();
|
const testID = dynamic_id();
|
||||||
const dropzone = page.getByRole('button', { name: 'Drop files or click here to upload.' });
|
const dropzone = page.getByRole('button', {name: 'Drop files or click here to upload.'});
|
||||||
|
|
||||||
// create the virtual files
|
// create the virtual files
|
||||||
const dataTransfer = await page.evaluateHandle(() => {
|
const dataTransfer = await page.evaluateHandle(() => {
|
||||||
const dt = new DataTransfer();
|
const dt = new DataTransfer();
|
||||||
|
|
||||||
// add items in different folders
|
// add items in different folders
|
||||||
dt.items.add(new File(["Filecontent (dir1/file1.txt)"], 'dir1/file1.txt', { type: 'text/plain' }));
|
dt.items.add(new File(['Filecontent (dir1/file1.txt)'], 'dir1/file1.txt', {type: 'text/plain'}));
|
||||||
dt.items.add(new File(["Another file's content (double/nested/file.txt)"], 'double/nested/file.txt', { type: 'text/plain' }));
|
dt.items.add(new File(["Another file's content (double/nested/file.txt)"], 'double/nested/file.txt', {type: 'text/plain'}));
|
||||||
dt.items.add(new File(["Root file (root_file.txt)"], 'root_file.txt', { type: 'text/plain' }));
|
dt.items.add(new File(['Root file (root_file.txt)'], 'root_file.txt', {type: 'text/plain'}));
|
||||||
|
|
||||||
return dt;
|
return dt;
|
||||||
});
|
});
|
||||||
// and drop them to the upload area
|
// and drop them to the upload area
|
||||||
await dropzone.dispatchEvent('drop', { dataTransfer });
|
await dropzone.dispatchEvent('drop', {dataTransfer});
|
||||||
|
|
||||||
await page.getByText('new branch').click();
|
await page.getByText('new branch').click();
|
||||||
await save_visual(page);
|
await save_visual(page);
|
||||||
await page.getByRole('textbox', { name: 'Name the new branch for this' }).fill(testID);
|
await page.getByRole('textbox', {name: 'Name the new branch for this'}).fill(testID);
|
||||||
await page.getByRole('button', { name: 'Propose file change' }).click();
|
await page.getByRole('button', {name: 'Propose file change'}).click();
|
||||||
|
|
||||||
// check that nested file structure is preserved
|
// check that nested file structure is preserved
|
||||||
await expect(page.getByRole('link', { name: 'dir1/file1.txt' })).toBeVisible();
|
await expect(page.getByRole('link', {name: 'dir1/file1.txt'})).toBeVisible();
|
||||||
await expect(page.getByRole('link', { name: 'double/nested/file.txt' })).toBeVisible();
|
await expect(page.getByRole('link', {name: 'double/nested/file.txt'})).toBeVisible();
|
||||||
await expect(page.locator('#diff-file-boxes').getByRole('link', { name: 'root_file.txt', exact: true })).toBeVisible();
|
await expect(page.locator('#diff-file-boxes').getByRole('link', {name: 'root_file.txt', exact: true})).toBeVisible();
|
||||||
await save_visual(page);
|
await save_visual(page);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue