#{extends 'test/AbstractTest.html' /}
#{selenium}
open('/')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
// Simulate loss of connectivity
open('/Test/disableAjax')
open('/')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
// Modified on client
open('/')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
clickAndWait('link=note 1')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
type('name', 'note 1 new')
type('contents', 'note 1 new contents')
clickAndWait('save')
// Then on server
open('/Test/touchServerNote?name=note 1')
assertTextPresent('Touched note')
// Restore connectivity, home page triggers a sync
open('/Test/enableAjax')
open('/')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
// Server version should be on the client
clickAndWait('link=note 1')
waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000)
assertValue('name', 'note 1')
assertValue('contents', 'note 1 contents')
// And on the server
open('/Test/showServerNote?name=note 1')
assertTextPresent('name=note 1')
assertTextPresent('contents=note 1 contents')
#{/selenium}