File size: 2,085 Bytes
6a7089a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# 33-upload-errors.sh β€” Upload error cases
# Migrated from: tests/integration/upload_test.go (UP6-UP9, UP11)

source "$(dirname "$0")/common.sh"

pt_post /navigate "{\"url\":\"${FIXTURES_URL}/upload.html\"}"
assert_ok "navigate"
sleep 1

# ─────────────────────────────────────────────────────────────────
start_test "upload: default selector"

FILE_CONTENT="data:text/plain;base64,SGVsbG8="
pt_post /upload "{\"files\":[\"${FILE_CONTENT}\"]}"
assert_ok "upload with default selector"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "upload: invalid selector β†’ error"

pt_post /upload '{"selector":"#nonexistent","files":["data:text/plain;base64,SGVsbG8="]}'
assert_not_ok "rejects invalid selector"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "upload: missing files β†’ error"

pt_post /upload '{"selector":"#single-file"}'
assert_not_ok "rejects missing files"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "upload: bad JSON β†’ error"

pt_post_raw /upload "{broken"
assert_http_status "400" "rejects bad JSON"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "upload: nonexistent file path β†’ error"

pt_post /upload '{"selector":"#single-file","paths":["/tmp/nonexistent_file_xyz_12345.jpg"]}'
assert_not_ok "rejects missing file"

end_test