#{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) 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') type('name', 'note 1 new') type('contents', 'note 1 new contents') clickAndWait('save') // Back to list assertTextPresent('note 1 new') clickAndWait('link=note 1 new') waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000) assertValue('name', 'note 1 new') assertValue('contents', 'note 1 new contents') // Client is offline => note not saved on server open('/Test/showServerNote?name=note 1') assertTextPresent('name=note 1') assertTextPresent('contents=note 1 contents') // Restore connectivity, home page triggers a sync open('/Test/enableAjax') open('/') waitForCondition('var w = selenium.browserbot.getCurrentWindow(); w.jQuery && w.jQuery.active == 0', 2000) // The note should now be modified on the server open('/Test/showServerNote?name=note 1 new') assertTextPresent('name=note 1 new') assertTextPresent('contents=note 1 new contents') #{/selenium}