Skip to content

Commit

Permalink
Use portable newTemporaryFile method in Grease
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Feb 4, 2024
1 parent f2b3dfb commit cf0d512
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
testing
testUploadFunctionalTest

| file |
| filePathString |
self selectTest: 'WAUploadFunctionalTest'.

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

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

self assert: (driver findElementByCSSSelector: 'pre') getText equals: 'blabla'
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 cf0d512

Please sign in to comment.