Slide 1

Slide 1 text

Siesta on Force.com Making your pages testable Chris Peterson Sr. Software Engineer FinancialForce.com

Slide 2

Slide 2 text

Shrink Resource Siesta download is >5MB (static resource limit)

Slide 3

Slide 3 text

Requires ExtJs ● 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 ■ /resources ■ ext-all.js

Slide 4

Slide 4 text

Test Harness ● 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

Slide 5

Slide 5 text

Working with Visualforce ● Use apex:actionStatus with waitForElementNotVisible ● 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

Slide 6

Slide 6 text

Visualforce element ids aren't reliable If you don't specify an Id If you do

Slide 7

Slide 7 text

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: data-tid="input-accountName"

Slide 8

Slide 8 text

● Visualforce doesn't give you an index inside repeat and table elements. ● 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 Visualforce Iteration

Slide 9

Slide 9 text

Iterate a what now? More details:bit.ly/vf-table-index

Slide 10

Slide 10 text

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: different subdomains

Slide 11

Slide 11 text

Coming Soon 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.

Slide 12

Slide 12 text

Sample test data setup Running anonymous apex for test setup

Slide 13

Slide 13 text

FAQ Where can I see your code? https://github.com/capeterson/Siesta-DevTalk Where can I get these slides? https://speakerdeck.com/ca_peterson