How to Expand/Collapse Tree item.

Q7, 21.08.2013 by Ulyana Skorokhodova View Comments

Introduction.

We always want Q7 tests to be easy-readable and laconic. That’s why we didn’t what to overweight it with “intermediate” user actions which are not followed by a resulting action (like mouse-movements or tree expanding). In the most use cases tree expanding/collapsing  are not the subject of testing so Q7 records only the result (e.g. item selection), automatically expanding a tree. But in some cases we may need to specify expand/collapse state of a tree. In Q7 we have 4 ECL commands which can be used for this purpose:
  • expand
  • expand-all
  • collapse
  • collapse-all

Expand-all/Collapse-all.

Let’s say we have Project1 and Project2 containing some files and folders. Resource - Eclipse SDK 2013-08-21 13-11-46   To Expand all tree items we need to use expand-all command: Q7 Control Panel - ExpandTC (MyQ7Project) - org.eclipse.sdk.ide 2013-08-21 13-15-51 So the result is: Resource - Eclipse SDK 2013-08-21 13-16-15 Note: you should be careful with applying expand-all command to Java Projects (or to any item with a huge amount of nesting items) – it can make your application hang.  Similarly, to collapse all items collapse-all should be used: Q7 Control Panel - ExpandTC (MyQ7Project) - org.eclipse.sdk.ide 2013-08-21 13-19-20 So we come back to an initial state: Resource - Eclipse SDK 2013-08-21 13-19-39   To expand all children and sub-children of a specific item use  get-item | expand-all: Q7 Control Panel - ExpandTC (MyQ7Project) - org.eclipse.sdk.ide 2013-08-21 13-29-21 Project1 is expanded: Resource - Eclipse SDK 2013-08-21 13-29-44  

Collapse/Expand

These commands are used if you need to expand/collapse an item only not affecting its children. Project1 is expanded only (Folder A stays collapsed): Q7 Control Panel - ExpandTC (MyQ7Project) - org.eclipse.sdk.ide 2013-08-21 13-42-39 Resource - Eclipse SDK 2013-08-21 13-42-57   Let’s say we have Project1 and all its children expanded.  Collapse command being applied to Project1 collapses Project1 only leaving its children expanded. So when you expand Project1 next time – all children state remains the same, as it was before collapsing. Before: Resource - Eclipse SDK 2013-08-21 13-58-48   Collapse Project1: Q7 Control Panel - ExpandTC (MyQ7Project) - org.eclipse.sdk.ide 2013-08-21 13-59-10 Resource - Eclipse SDK 2013-08-21 13-59-36 Expand Project1 (all children stayed expanded): Resource - Eclipse SDK 2013-08-21 13-59-58          

blog comments powered by Disqus

Functional and UI Testing for Eclipse-based Applications

Test automation solution, handcrafted for Eclipse. Modern and easy to learn IDE.

Product Health Analytics and Support Automation Platform

End-user and product analytics solution that gives you rich insights into your application health & performance.

Eclipse-based IDE for the Fantom Programming Language

Full-featured Integrated Development Environment for emerging Fantom programming language.