Docs Help

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

Sencha Test 2.1.1


top

Using the Inspector

The Inspector enables users of Sencha Test to easily locate components in a running Ext JS Application and create both locator strings as well as Page Objects for accessing those components in tests.

Functionality/Overview

  • View hierarchy of all components on an Ext JS application page.

  • Add components from that hierarchy to a list of selected locators.

  • Hover over the Ext JS application page in a browser and click to select components. These components are then added to the list of selected locators.

  • When clicking on hierarchy components or selected locators Inspector will attempt to highlight the component in the browser with a green rectangle.

  • Selected locators may be given a page name and individual names and saved as Page Objects to be used in tests as stpo...

  • A wizard is available to add hierarchical parents to the locator as well as advanced properties as well.

  • Selected locators can simply be inserted into the current test as ST Futures API expressions. Using the Page Objects feature is not required to make use of Inspector to generate locators.

  • Javascript expressions to access Page Objects can be inserted into the current test if Page Objects and named locators are present.

Inspector for Locators

Inspector helps you derive meaningful locators from elements on the web page. If you consider a simple scenario where you have to enter a value in a text field, you’ll see the significance of a good locator. For the text field on this page, we assign a default id of "@textfield-1143". Now, Ext JS is a highly componentized framework, so we can use the component query instead of the id. The component query for the subject text field is "textfield[fieldLabel="Subject"]".

image alt text

What are Page Objects?

Source Seleniumhq: The Page Object Design Pattern provides the following advantages

  1. There is a clean separation between test code and page specific code such as locators (or their use if you’re using a UI Map) and layout.

  2. There is a single repository for the services or operations offered by the page rather than having these services scattered throughout the tests.

The idea is very simple. You create functions or objects of all the components on a page in the application under test. You reuse them in multiple tests by instantiating the objects when needed. This means you can avoid having to copy and paste a locator on multiple test cases, which minimizes the need to modify the locator value when the developer changes the label from Subject to something fancy.

Using the Inspector

Follow these steps to use the Inspector either with an in-browser(single page application) or WebDriver Scenario (multi page application) test.

Note: It is required to use WebDriver scenario even if there is just a login page that redirects to a single page Ext JS app.

Are you starting from scratch? No tests at all? Just an application URL?

  1. Create a new Jasmine Test Suite

  2. Open the newly created Jasmine spec file

  3. Use the pre-made test case "should pass".

  4. Place the cursor inside of the "it" block and launch the Inspector by clicking the inspector button (search icon).

  5. Select a browser

  6. Wait for the browser to open, application to be loaded and started and for the Inspector grid of component hierarchy to be presented and filled out.

  7. If the application/URL you configured in the Scenario points to a non-Ext page you will need to navigate to an Ext page before Inspector will show any components. You can achieve this in two ways:

    • Add code to your test which navigates to the Ext app. A common situation is a login page.

        describe("test", function() {
            it("login then inspect", function() {
                ST.element('@email').type('a-username');
                ST.element('@password').type('a-password');
                ST.element('@submit').click();
                // inspect after this comment
            });
        });
      
    • Press Ctrl/Cmd-I to disabled inspecting in the browser and proceed to navigate to the Ext app.

  8. At this point you should see a component hierarchy in the Inspector window. You can navigate around in this hierarchy.

    image alt text

  9. When you click on a component in the hierarchy you may see the component highlighted in the browser with a bright green rectangle. A message will inform you if a component was highlighted or not. If a component is hidden you will not see it highlighted.

    image alt text

Using the selected value, you can take two different paths here. Create ST API code using the locators or Create Page Object code.

Inserting ST API Code

ST APIs allows you to create tests targeting Ext JS components and generic elements on a web applications. Inspector generate ST API code directly into the editor that can be extended with appropriate API methods based on the test case.

Inspector for Page Objects

  1. Launch the Inspector as previously described in Using the Inspector

  2. On arriving at the Inspector Grid and Selected Locators, select the page objects checkbox, enter a page name for this page.

  3. You may confirm that the URL is correct but may not change the URL.

  4. In order to change the URL you must change the URL in the Scenario or add some code to your test which navigates to the desired URL.

  5. Add components by clicking in the browser or by adding from the component hierarchy.

  6. Refine the locator string by selecting one of the pre-populated strings from the drop-down, by opening the Wizard or by typing in one manually (not recommended).

  7. Give the component/locator a name.

  8. Save the page object.

Using the Locator Wizard

Inspector Wizard allows users to select more properties to get a one-to-one match with a component. When multiple component matches a locator additional properties may be needed to narrow down to a specific component and this can be done by launching the wizard. Every time a new property is added, the wizard will indicate the number of matching components. The user can save the locator and use it within a test when there is just one component match.

image alt text

How to change URL to inspect a specific page (interim approach)

The below approach will let you use inspector to create meaningful locators. We will be enhancing this feature in the future so the page navigation and the URL updates will be captured more effectively.

Single Page Applications

  1. A page in a single page application can be accessed by just changing the anchor. For e.g. in the sample application on Sencha’s website http://examples.sencha.com/extjs/6.2.0/examples/admin-dashboard/#dashboard - #dashboard is the anchor.

  2. To inspect email page a new spec should be created. In Email.js, insert a code that will navigate the test to the email page.

  3. Launch inspector and follow the steps under "using inspector" section to get locators for the new page

Multi Page Applications

  1. Multi page applications that involves page navigation should have code that will login user and navigate them to the specific page as mentioned above

  2. Once you are on a specific page, launch inspector and follow the steps under "using inspector" section to get locators for the new page

Sencha Test 2.1.1