mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-24 02:00:04 +02:00
Cleaned the comments and used test.describe to nest the tests
This commit is contained in:
parent
795135e3c9
commit
77c248fa1e
2 changed files with 98 additions and 105 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// var fileNameComponentSanitizeRegexp = regexp.MustCompile(`(?i)\.\.|[<>:\"/\\|?*\x{0000}-\x{001F}]|^(con|prn|aux|nul|com\d|lpt\d)$`)
|
||||
var fileNameComponentSanitizeRegexp = regexp.MustCompile(`(?i)[<>:\"/\\|?*\x{0000}-\x{001F}]|^(con|prn|aux|nul|com\d|lpt\d)$`)
|
||||
|
||||
// SanitizePath cleans and validates a file path
|
||||
|
|
|
@ -8,19 +8,12 @@
|
|||
// services/repository/files/upload.go
|
||||
// @watch end
|
||||
|
||||
// https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md
|
||||
// lies. Don't use
|
||||
// make TAGS="sqlite sqlite_unlock_notify" backend
|
||||
// use
|
||||
// make TAGS="sqlite sqlite_unlock_notify" build
|
||||
// otherwise the test fails.
|
||||
|
||||
import {expect} from '@playwright/test';
|
||||
import {test, dynamic_id, save_visual} from './utils_e2e.ts';
|
||||
|
||||
test.use({user: 'user2'});
|
||||
|
||||
test('drag and drop upload normal and special characters', async ({page}) => {
|
||||
test.describe('Drag and Drop upload', () => {
|
||||
test('normal and special characters', async ({page}) => {
|
||||
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
||||
expect(response?.status()).toBe(200); // Status OK
|
||||
|
||||
|
@ -56,7 +49,7 @@ test('drag and drop upload normal and special characters', async ({page}) => {
|
|||
await expect(page.locator('#diff-file-boxes').getByRole('link', {name: 'root_file.txt'})).toBeVisible();
|
||||
});
|
||||
|
||||
test('drag and drop upload strange paths and spaces', async ({page}) => {
|
||||
test('strange paths and spaces', async ({page}) => {
|
||||
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
||||
expect(response?.status()).toBe(200); // Status OK
|
||||
|
||||
|
@ -90,7 +83,7 @@ test('drag and drop upload strange paths and spaces', async ({page}) => {
|
|||
await expect(page.locator('#diff-file-boxes').getByRole('link', {name: '..dots.txt'})).toBeVisible();
|
||||
});
|
||||
|
||||
test('drag and drop upload broken path slash in front', async ({page}) => {
|
||||
test('broken path slash in front', async ({page}) => {
|
||||
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
||||
expect(response?.status()).toBe(200); // Status OK
|
||||
|
||||
|
@ -117,7 +110,7 @@ test('drag and drop upload broken path slash in front', async ({page}) => {
|
|||
await save_visual(page);
|
||||
});
|
||||
|
||||
test('drag and drop upload broken path with traversal', async ({page}) => {
|
||||
test('broken path with traversal', async ({page}) => {
|
||||
const response = await page.goto(`/user2/file-uploads/_upload/main/`);
|
||||
expect(response?.status()).toBe(200); // Status OK
|
||||
|
||||
|
@ -143,3 +136,4 @@ test('drag and drop upload broken path with traversal', async ({page}) => {
|
|||
|
||||
await save_visual(page);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue