DailyImageWidgetTest
open /wp-admin/
clickAndWait link=Installed
clickAndWait //a[contains(@href, 'action=activate') and contains(@href, 'hubblesite-daily-image-wordpress')]
assertTextPresent Plugin activated.
clickAndWait link=Dashboard
storeText //span[@id="wp-version-message"]/span[@class="b"] wp_version
getEval /WordPress ([0-9.]+)\./.test(storedVars['wp_version']); storedVars['wp_version'] = RegExp.$1;
clickAndWait link=Widgets
gotoIf storedVars['wp_version'] < 2.8 wordpress_27
clickAndWait //a[contains(@href,'hubblesite-daily-image') and contains(@href,'addnew')]
assertTextNotPresent Warning: in_array()
check //input[@name="hubblesite[image]"]
check //input[@name="hubblesite[title]"]
uncheck //input[@name="hubblesite[credits]"]
clickAndWait savewidget
assertElementPresent //div[@id='widgets-right']//h4[contains(text(),"HubbleSite Daily Image")]
clickAndWait site-visit-button
assertText //*[@id='hubblesite-daily-image']/h2 HubbleSite Daily Image
assertElementPresent //*[@id='hubblesite-daily-image']/a[contains(@href,'hubblesite.org/gallery/album')]
storeAttribute //*[@id='hubblesite-daily-image']/a[contains(@href,'hubblesite.org/gallery/album')]@title title
assertElementPresent //*[@id='hubblesite-daily-image']//img[contains(@src,'imgsrc.hubblesite.org') and @alt="${title}"]
goBackAndWait
click //div[@id='widgets-right']//div[contains(@id, 'hubblesite-daily-image')]//a[contains(@class, 'widget-action')]
uncheck //div[@id='widgets-right']//div[contains(@id,'hubblesite-daily-image')]//input[contains(@name, 'title')]
check //div[@id='widgets-right']//div[contains(@id,'hubblesite-daily-image')]//input[contains(@name, 'credits')]
click //div[contains(@id, 'hubblesite-daily-image')]//input[@type='submit']
clickAndWait site-visit-button
assertElementPresent //div[@id="hubblesite-daily-image-credits"]
goBackAndWait
click //div[@id='widgets-right']//div[contains(@id, 'hubblesite-daily-image')]//a[contains(@class, 'widget-action')]
click //div[@id='widgets-right']//div[contains(@id, 'hubblesite-daily-image')]//a[@class="widget-control-remove"]
pause 1000
assertElementNotPresent //div[@id='widgets-right']//div[contains(@id, 'hubblesite-daily-image')]
goto widgets_done
label wordpress_27
click //a[contains(@class, 'widget-control-add') and contains(@href,"add=hubblesite-daily-image")]
click //a[contains(@class, 'widget-control-edit') and contains(@href,"edit=hubblesite-daily-image")]
check //input[@name="hubblesite[image]"]
check //input[@name="hubblesite[title]"]
uncheck //input[@name="hubblesite[credits]"]
clickAndWait save-widgets
clickAndWait //div[@id='wphead']/h1/a/span
assertText //li[@id='hubblesite-daily-image']/h2 HubbleSite Daily Image
assertElementPresent //li[@id='hubblesite-daily-image']/a[contains(@href,'hubblesite.org/gallery/album')]
storeAttribute //li[@id='hubblesite-daily-image']/a[contains(@href,'hubblesite.org/gallery/album')]@title title
assertElementPresent //li[@id='hubblesite-daily-image']//img[contains(@src,'imgsrc.hubblesite.org') and @alt="${title}"]
goBackAndWait
click //a[contains(@class, 'widget-control-edit') and contains(@href,"edit=hubblesite-daily-image")]
uncheck //input[@name="hubblesite[title]"]
check //input[@name="hubblesite[credits]"]
clickAndWait save-widgets
clickAndWait //div[@id='wphead']/h1/a/span
assertElementPresent //div[@id="hubblesite-daily-image-credits"]
goBackAndWait
click //a[contains(@class, 'widget-control-edit') and contains(@href,"edit=hubblesite-daily-image")]
click //a[contains(@class, 'widget-control-remove') and contains(@href,"remove=hubblesite-daily-image")]
clickAndWait save-widgets
label widgets_done
clickAndWait link=Installed
clickAndWait //a[contains(@href,'deactivate') and contains(@href,'hubblesite-daily-image-wordpress')]
assertTextPresent Plugin deactivated.