Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323765 - WithLabel-matchers are not scoped to the ControlFinder, they do a shell-wide search instead
Summary: WithLabel-matchers are not scoped to the ControlFinder, they do a shell-wide ...
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: 2.0.0-dev   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-26 18:53 EDT by Ralf Ebert CLA
Modified: 2010-10-12 11:55 EDT (History)
0 users

See Also:
KetanPadegaonkar: iplog+


Attachments
0001-SWTBotViewTest-viewBotWidgetScope-reproduces-Bug-323.patch (7.26 KB, patch)
2010-08-26 18:57 EDT, Ralf Ebert CLA
no flags Details | Diff
0001-SWTBotViewTest-viewBotWidgetScope-reproduces-Bug-323.patch (7.82 KB, patch)
2010-08-27 08:22 EDT, Ralf Ebert CLA
no flags Details | Diff
0002-323765-WithLabel-matchers-are-not-scoped-to-the-Cont.patch (11.33 KB, patch)
2010-08-27 08:23 EDT, Ralf Ebert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Ebert CLA 2010-08-26 18:53:42 EDT
Build Identifier: 

When searching for controls restricted to views or editors like bot.viewById("...").bot().textWithLabel("...") the WithLabel matcher will leave the parent Composite and return controls from other views.

Reproducible: Always

Steps to Reproduce:
See attached test case SWTBotViewTest#viewBotWidgetScope
Comment 1 Ralf Ebert CLA 2010-08-26 18:57:01 EDT
Created attachment 177571 [details]
0001-SWTBotViewTest-viewBotWidgetScope-reproduces-Bug-323.patch
Comment 2 Ralf Ebert CLA 2010-08-27 06:29:29 EDT
This happens because org.eclipse.swtbot.swt.finder.matchers.WithLabel does a shell-wide search if it is not instantiated with a parent. Expressing scope by parent and not by a Finder object seems bogus to me and this way of instantiating the matcher seems to be used. My current plan to fix this is to allow matchers (in general) to get the control finder they are used for by implementing an interface like IControlFinderAware#setControlFinder().
Comment 3 Ralf Ebert CLA 2010-08-27 08:22:51 EDT
Created attachment 177610 [details]
0001-SWTBotViewTest-viewBotWidgetScope-reproduces-Bug-323.patch
Comment 4 Ralf Ebert CLA 2010-08-27 08:23:37 EDT
Created attachment 177611 [details]
0002-323765-WithLabel-matchers-are-not-scoped-to-the-Cont.patch

From: Ralf Ebert <ralf@ralfebert.de>
Date: Fri, 27 Aug 2010 14:21:32 +0200
Subject: [PATCH 2/2] 323765: WithLabel-matchers are not scoped to the ControlFinder

WithLabel finds controls using the ControlFinder now, so it is correctly
restricted when used for scoped bots like viewById("...").bot(). For this,
the SWTBot class is generated with an withLabel() method which passes in
its ControlFinder.
Comment 5 Ralf Ebert CLA 2010-09-06 21:58:42 EDT
May I kindly ask to review the patches and give me feedback if there is anything left to do about them?
Comment 6 Ketan Padegaonkar CLA 2010-10-12 11:55:08 EDT
Applied patch, sorry that it took a long time to resolve. Please verify and mark as fixed.