Patches item #1005396, was opened at 2004-08-07 23:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497984&aid=1005396&group_id=61302

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Assert button (not) present with text 

Initial Comment:
I needed the ability to test if a button is present with 
certain text (or not present)... so I subclasses 
WebTester and added the following methods -- you 
should be able to incorporate them fairly easily I'd 
imagine:

        public void assertButtonPresentWithText
(String text)
        {
                Button[] buttons = getDialog
().getForm().getButtons();
                
                boolean found = false;
                for (int i = 0; i < buttons.length; 
i++)
                {
                        Button button = buttons[i];
                        if (button.getValue().equals
(text))
                        {
                                found = true;
                                break;
                        }
                }
                
        Assert.assertTrue("Did not find button with text [" 
+ text + "].",
                found);
        }
        
        public void assertButtonNotPresentWithText
(String text)
        {
                Button[] buttons = getDialog
().getForm().getButtons();
                
                boolean found = false;
                for (int i = 0; i < buttons.length; 
i++)
                {
                        Button button = buttons[i];
                        if (button.getValue().equals
(text))
                        {
                                found = true;
                                break;
                        }
                }
                
        Assert.assertFalse("Found button with text [" + 
text + "].",
                found); 
    }

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497984&aid=1005396&group_id=61302


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Jwebunit-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to