Skip to content

Commit

Permalink
Merge pull request #1401 from SeasideSt/streaming-uploads-test
Browse files Browse the repository at this point in the history
File upload testing
  • Loading branch information
jbrichau authored Feb 7, 2024
2 parents 61d83eb + a8941d5 commit c8d2295
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 22 deletions.
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 |
fullBoundary := String crlf asByteArray, aBoundary.
file := GRPlatform current newTemporaryFileReference.
filePathString := GRPlatform current newTemporaryFile.
GRPlatform current
writeFileStreamOn: file pathString
writeFileStreamOn: filePathString
do: [ :writer |
self
parseMultiPartFieldWithoutLengthWithBoundary: fullBoundary
Expand All @@ -13,4 +13,4 @@ parseMultiPartFileFieldWithMimePart: aMimePart boundary: aBoundary decodeWith: a

aBlock
value: aMimePart
value: file pathString
value: filePathString

0 comments on commit c8d2295

Please sign in to comment.