Skip to content

Commit

Permalink
Additional test for file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Jan 2, 2024
1 parent e2d0805 commit 0b1ff92
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ testing
testFileUpload

| fileupload filesubmit file receivedFile |

file := BPSmalltalkPlatform current fileWrite: 'Test.data' contents: 'Hello World!'.

[
fileupload := driver findElementByXPath: ('//input[@type=''file'']').
filesubmit := driver findElementByID: 'sendFile'.
fileupload sendKeys: file.
filesubmit click.

receivedFile := self waitUntil: [ self componentUnderTest receivedFile ] is: [ :value | value notNil ]
checkEvery: (Duration milliseconds: 100) timeoutAfter: (Duration seconds: 5) with: [ nil ].
self assert: receivedFile notNil.
self assert: (receivedFile contentsDecodedUsing: 'UTF-8') = 'Hello World!'.
] ensure: [ BPSmalltalkPlatform current fileDelete: file ].
self assert: (receivedFile isKindOf: WAFile).
self assert: (receivedFile contentsDecodedUsing: 'UTF-8') equals: 'Hello World!'.
] ensure: [ BPSmalltalkPlatform current fileDelete: file ]

0 comments on commit 0b1ff92

Please sign in to comment.