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

File upload testing #1401

Merged
merged 16 commits into from
Feb 7, 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
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ jobs:
include:
- smalltalk: Pharo64-12
experimental: true
- smalltalk: Squeak64-5.3
experimental: true
- smalltalk: Squeak-5.2
- smalltalk: Squeak64-6.0
experimental: true
- smalltalk: Squeak-5.1
- smalltalk: Squeak64-5.3
experimental: true
continue-on-error: ${{ matrix.experimental }}
name: ${{ matrix.smalltalk }}
Expand Down
6 changes: 3 additions & 3 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SmalltalkCISpec {
#baseline : 'Seaside3',
#directory : 'repository',
#load : [ 'CI' ],
#onConflict : #useLoaded,
#onConflict : #useIncoming,
#useLatestMetacello : false,
#onWarningLog : true,
#platforms : [ #pharo ]
Expand All @@ -13,7 +13,7 @@ SmalltalkCISpec {
#baseline : 'Seaside3',
#directory : 'repository',
#load : [ 'CI' ],
#onConflict : #useLoaded,
#onConflict : #useIncoming,
#useLatestMetacello : true,
#onWarningLog : true,
#platforms : [ #squeak ]
Expand All @@ -22,7 +22,7 @@ SmalltalkCISpec {
#baseline : 'Seaside3',
#directory : 'repository',
#onWarningLog : true,
#onConflict : #useLoaded,
#onConflict : #useIncoming,
#load : [ 'CI' ],
#platforms : [ #gemstone ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #BaselineOfSeaside3!
self packageOrganizer ensurePackage: #BaselineOfSeaside3 withTags: #()!
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ baseUrl

| parts url |
parts := self requestContext request host findTokens: ':'.
url := self requestContext request url withoutSeasideQueryFields
path: OrderedCollection new.

url := self requestContext request url withoutSeasideQueryFields path: OrderedCollection new.
url host: parts first.
parts size > 1 ifTrue: [ url port: parts last asInteger ].

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-Tests-Functional'!
self packageOrganizer ensurePackage: #'Seaside-Tests-Functional' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
running
testing
expectedFailures
| todo |
todo := #(testExpiryFunctionalTest testFilterFunctionalTest testUploadFunctionalTest).
todo := #(testExpiryFunctionalTest testFilterFunctionalTest).
^ (GRPlatform current class == (Smalltalk at: #GRGemStonePlatform ifAbsent:[ nil ]))
ifTrue: [ #(testContextFunctionalTest), todo "requires https://github.com/GsDevKit/Grease/pull/17 to be merged" ]
ifTrue: [ #(testUploadFunctionalTestWithStreamingUploads testContextFunctionalTest), todo ]
ifFalse:[ todo ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
testing
testUploadFunctionalTest

| filePathString |
self selectTest: 'WAUploadFunctionalTest'.

self fail.

[
filePathString := GRPlatform current newTemporaryFileNamed: 'testfile.txt'.
GRPlatform current
writeFileStreamOn: filePathString
do: [ :stream | stream nextPutAll: 'blabla' ]
binary: false.

(driver findElementByCSSSelector: 'input[type=file]') sendKeys: filePathString.
(driver findElementByCSSSelector: 'input[value=Load]') click.

self assert: (driver findElementByCSSSelector: 'pre') getText equals: 'blabla'
] ensure: [ GRPlatform current deleteFile: filePathString ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
testing
testUploadFunctionalTestWithStreamingUploads

| originalStreamUploadsSetting |
originalStreamUploadsSetting := self zincServer streamUploads.
[
self zincServer streamUploads: true.
self testUploadFunctionalTest
] ensure: [ self zincServer streamUploads: originalStreamUploadsSetting. ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
zincServer

^ (Smalltalk at: #GemServer ifAbsent: [ nil ])
ifNil: [ WAAdmin serverAdaptors first server ]
ifNotNil: [ ((Smalltalk at: #GemServer) gemServerNamed: 'Seaside') serverInstance ]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-Tests-Parasol'!
self packageOrganizer ensurePackage: #'Seaside-Tests-Parasol' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
private
parseMultiPartFileFieldWithMimePart: aMimePart boundary: aBoundary decodeWith: aBlock
| fullBoundary file |
| fullBoundary filePathString |

Check warning on line 3 in repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st#L3

Added line #L3 was not covered by tests
fullBoundary := String crlf asByteArray, aBoundary.
file := GRPlatform current newTemporaryFileReference.
filePathString := GRPlatform current newTemporaryFile.

Check warning on line 5 in repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st#L5

Added line #L5 was not covered by tests
GRPlatform current
writeFileStreamOn: file pathString
writeFileStreamOn: filePathString

Check warning on line 7 in repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st#L7

Added line #L7 was not covered by tests
do: [ :writer |
self
parseMultiPartFieldWithoutLengthWithBoundary: fullBoundary
Expand All @@ -13,4 +13,4 @@

aBlock
value: aMimePart
value: file pathString
value: filePathString

Check warning on line 16 in repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFileFieldWithMimePart.boundary.decodeWith..st#L16

Added line #L16 was not covered by tests
Loading