Awesome
Parasol
Parasol (full name “Beach Parasol”) is a Smalltalk framework to automate web browsers. It’s particularly useful to write automated tests for Seaside web applications. Its design and implementation are based on the Java Selenium WebDriver API.
Example
Here’s a straightforward annotated example. This example uses Parasol to automate a search for “Pharo” on Wikipedia:
"Open a web browser on the English-language Wikipedia home page."
driver := BPRemoteWebDriver withCapabilities: BPChromeOptions new.
driver get: 'http://en.wikipedia.org/'.
"Click on the search box and type in 'Pharo' followed by a press of the Return key."
(driver findElementByID: 'searchInput') click.
driver getKeyboard sendKeys: ('Pharo' , (String with: BPKeys return)).
"Get the text of the article's first paragraph and show it on the transcript."
Transcript show: ((driver findElementByID: 'mw-content-text') findElementByCSSSelector: 'p:not(.mw-empty-elt)') getText.
"Tell the browser to quit."
driver quit.
Check the Hands-On section below to learn how to run the example yourself.
Introduction Video
On YouTube you can find an introduction video about Beach Parasol. The video is a recording of a talk that was given at the ESUG 2013 conference. The slides of this talk are also available on SlideShare and as a PDF.
Hands-On
To try Beach Parasol, you'll need to get a few things:
- A Pharo image
- The Chrome web browser
- The Selenium standalone server JAR file
- The Chromedriver for your operating system and matching Chrome version
We run automated tests for the supported platforms. If you find things are not working with more recent versions, please do file an issue.
You should extract the Chromedriver's ZIP file into the directory where you put the Selenium server JAR file. To run the Selenium server, execute the following on the command line:
java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-4.13.0.jar standalone
Loading Parasol
Warning: Parasol's default baseline will NOT load Seaside automatically. You can therefore use Parasol without Seaside, but then you should only load the 'core' Metacello group. The 'default' Metacello group pulls in the extensions for Seaside but you are required to load Seaside yourself. This ensures you can load your own version of Seaside without tackling Metacello load conflicts. Only the 'tests' Metacello group will load latest master of Seaside.
To load Parasol into a Pharo image with the Seaside extensions:
Metacello new
baseline: 'Parasol';
repository: 'github://SeasideSt/Parasol:master/repository';
load: 'default'.
(Smalltalk at: #ZnZincServerAdaptor) startOn: 8080.
To load Parasol into a Pharo image and pull in Seaside as well:
Metacello new
baseline: 'Parasol';
repository: 'github://SeasideSt/Parasol:master/repository';
load: 'tests'.
(Smalltalk at: #ZnZincServerAdaptor) startOn: 8080.
Now give the Wikipedia example from above a try! For more examples, check the test cases BPRemoteWebDriverTestCase
and BPWebElementTestCase
.
Documentation
If you need more documentation, you can check the documentation of Parasol’s Java counterpart. Most classes and methods in Parasol were designed to closely follow their Java counterpart, to make it easier to use its documentation and translate from Java-based examples. Good starting points are the documentation for the WebDriver and WebElement interfaces. They are the counterparts to BPRemoteWebDriver
and BPWebElement
.
The Seaside tutorial offered by the HPI Software Architecture Group has a chapter on “Testing Seaside Applications” using Parasol.
Supported Smalltalk Platforms
The main Smalltalk platforms for Parasol is Pharo and GemStone. There was support for VisualWorks in the past, but this has been removed due to lack of maintenance (see issue #8, let us know if you’re interested in VisualWorks support). Support for Squeak is currently unmaintained but we accept PRs that fix the Squeak issues.
GitHub versus SS3 Repository
An older repository for Parasol exists on SqueakSource3. This GitHub repository is the current development repository, the older SqueakSource3 repository is no longer kept up-to-date.
Build Status
Parasol’s self-tests are automatically ran using Github actions, the image above shows the status of the latest build of the “master” branch. Please note there's an open issue regarding some of the self-tests failing randomly (issue #2).
Related
You might also be interested in:
- browserstack-local-smalltalk: running your tests with Parasol against BrowserStack
- AutomaticParasol: for running SeleniumIDE-Generated Tests in Pharo Smalltalk (using Parasol).
- WebDriver: alternative Pharo WebDriver package described as “based on Parasol but clean room and for Pharo only.”