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

Category: None
>Group: Release 1.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Martijn Dashorst (dashorst)
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); 
    }

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

Comment By: John Evans (lgas)
Date: 2004-08-08 08:36

Message:
Logged In: YES 
user_id=137603

Sorry about the formatting and about not being logged in.  
This was submitted by me.

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

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 BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Jwebunit-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to