Making your pages testable
Sr. Software Engineer
Siesta download is >5MB (static resource limit)
● from CDN (use cachefly for HTTPS support)
○ Sencha CDN is HTTP only, won't load right on
modern browsers inside HTTPS-only visualforce
○ Use cachefly - same URL structure but with HTTPS
● from static resource
○ Size limits issues? Only requires
● Load tests from localhost or static resources
● Siesta is bound by same-origin, like all js
○ So make sure the harness is a visualforce page
Working with Visualforce
● Use apex:actionStatus with
● Set separateContext : true in test definition
○ Prevents page rerenders breaking your test chains
○ Or use well-scoped rerender on all actions
● [Soon] AJAX toolkit for test setup/teardown
Visualforce element ids aren't reliable
If you don't specify an Id
If you do
data-tid used as a target for tests instead of id
If you use siesta's recorder set it to use these instead of Id:
This passes through to the generated HTML as:
● Visualforce doesn't give you an index inside repeat and
● data-tid really needs to be unique for our tests
● Old pages can be apex:variable as a counter, but that
broke in Sprint '12 (or somewhere around there)
● There's a trick that's not too disruptive: make an array of
array indexes and iterate on that
Iterate a what now?
What just doesn't work
● *.salesforce.com pages all contain anti-
iframe code and won't run in siesta
● Clickjack protection option for visualforce
can be problematic.
● Cross-namespace testing won't work:
Once a bug is fixed: invoke the salesforce
AJAX toolkit for test setup.
Once I write the feature request: invoke the
AJAX toolkit for test cleanup.
Sample test data setup
Running anonymous apex for test setup
Where can I see your code?
Where can I get these slides?