Wiki Tests Wiki
Add reveal()
to that test case,
run the test batch, wait for a web browser to pop up, and click on a test
button. The target IFRAME
should
display, with a familiar "missing web page" error. The IFRAME
can't navigate to a bogus src
URI.
Until now, our YAML has been fictitious. We need to create a new Wiki page, to test our own Wiki.
def set_wiki_test_up source = "--- !omap - setup: - !omap - script: \"\" - test_WikiTestPage: - !omap - color: green - page: /wiki/WikiTestPage - script: something tests our Wiki - teardown: - !omap - script: \"\" " @yar = YarWiki.new('TestWiki') @yar.save_page(source) end def self_test set_wiki_test_up get :index, :id => @yar.page_name assert_select 'td#wiki_panel' do |wiki_panel| return wiki_panel end end def test_surf_self wiki_panel = self_test reveal() end
The new page, TestWiki, will soon have commands that test our sample page, WikiTestPage. Then we will use those commands to test-first features into our Wiki.
But for now, all we can do is reveal()
this new page, click the test
button, and drop our jaws:
Figure 6. Our Wiki opens a panel now, revealing our Wiki.
The inner Wiki is fully functional, so if it had any more features, we could click on them, and manually test them.
Now gaze at that script node. All it says is "something tests our Wiki". We need to do better than that if we actually want to test it!
Drive our Test Page with JavaScript ...
Get Test Driven Ajax (on Rails) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.