[Seaside] SeasideTesting

Liliana liliana at finworks.biz
Mon Jun 25 07:57:32 UTC 2007

Hi David.

Sorry to bug you, but I was wondering if you were still doing anything about
Thanks and regards,

-----Original Message-----
From: Liliana [mailto:liliana at finworks.biz] 
Sent: 21 June 2007 08:27 AM
To: 'seaside at lists.squeakfoundation.org'
Subject: Re: [Seaside] SeasideTesting

Hi David

I did read your code and figured kind of what you said :)  but I only
started working in Smalltalk three month ago and I'm still a bit scared to
hack other people's code! I would be more that happy just with a quick fix
that returns the HTTPResponse as received by the browser simulator. I would
then "establishSession" again if I need to do something else.

Thank you so much for your quick response.
Kind regards,

-----Original Message-----
From: David Shaffer [mailto:cdshaffer at acm.org] 
Sent: 20 June 2007 04:33 PM
To: Seaside - general discussion
Subject: Re: [Seaside] SeasideTesting


Sorry, right now SeasideTesting doesn't support "attachments" (documents 
which the browser downloads, as opposed to displays) or any response 
type which isn't Seaside-generated XHTML.  I think I can make some 
changes that would give you a simple way to do this though.  If its OK, 
I'll hold on to your code and include it as a test case once I've 
implemented this support.  I won't be able to look at it until this 
evening (EST).

In case you're interested the problem is that SeasideTesting (ST) needs 
to know what document the browser is current displaying which it refers 
to as the lastResponse but attachments (content-disposition: 
attachment), while they are delivered via HTTP responses, aren't 
typically displayed by browsers.  If I load this content into the 
lastResponse then you'll have to simulate a "back" button press to get 
back to the page with the anchor.  This is inconsistent with actual 
browser behavior...so, what I guess I need is to properly distinguish 
between the #lastResponse and the #currentPage.  Finally, I really need 
to check the content-type before I go about treating it as XHML :-)


-----Original Message-----
From: Liliana [mailto:liliana at finworks.biz] 
Sent: 20 June 2007 03:03 PM
To: 'seaside at lists.squeakfoundation.org'
Subject: SeasideTesting


I'd like to write a test to check the content of a file I produce in my
application , which is made available to the user via a download file link.
I've written two short classes that simulate what I want to do.

1.	a  WAComponent subclass: #HelloSeaside - which displays a file
download anchor
renderContentOn: html 
      html heading: 'Tests' level: 1.
      html break.
      html anchor
            document: 'some text that may be read from somewhere'
            mimeType: 'text/plain'
            fileName: 'myfilename.txt';
             with: 'Download file'! !

2.	a SCComponentTestCase subclass: #TestHelloSeaside - which attempts
to follow the anchor and get to the file content; in order to test that the
generated file is OK:
      self newApplicationWithRootClass: HelloSeaside.
      self establishSession.
      followAnchor: (self lastResponse anchorWithLabel: 'Download file').
      file := self lastResponse entitiesWithClass: 'file'.
      self assert: file contents = ''! !

The file out is attached.
When running the test I get a SAXParseException: XML expected 'Character
expected.' - generated by the call: 
SCSeasideResponseParser parseDocumentFromResponse: response
in SCBrowserSimulator>>issueRequestUntilNotMoved: anHttpRequest.
The response is an HTTPResponse with the following properties:
-	contents = a RWBinaryOrTextStream 'some text that may be read from
-	contentType = 'text/plain'.

Can somebody, please give me an idea on how to proceed from here?
Thank you


More information about the Seaside mailing list