Results 1 to 2 of 2

Thread: Issue with multiple items when running test from CLI

  1. #1
    Sencha User
    Join Date
    Sep 2017
    Posts
    11

    Default Issue with multiple items when running test from CLI

    I have a test in which I need to make sure a grid is showing rows. It is not a specific row, as in this scenario, we have no way of knowing what will be the data previously - it is just to check whether the grid is showing rows or not.

    Sencha Studio has the option that I can disable "Fail locators with multiple results", but when I run the tests via CLI (e.g. stc run -p "Embedded" -s test/user/ -n 1 -S http://localhost:1903 -K AssetRegisterUserTests) then the tests fail. Is there any parameter I can use in this command in order to make it not fail when multiple results are found for a locator as well?

    Thanks for the attention!

  2. #2
    Sencha User
    Join Date
    Mar 2016
    Posts
    59
    Answers
    6

    Default

    Could you just assert that your grid has a certain number of items by looking for the n-th row? Something like:

    Code:
    ST.grid('tableview').rowAt(5);

  3. #3
    Sencha User
    Join Date
    Sep 2017
    Posts
    11

    Default

    Hey Craig, thanks for the reply!

    I could do that, however, it won't solve the issue as there will be many other situations where I will need to use multiple results from a locator. I'll give another example:

    I have many portlets opened when the user first login, and I need to close then (it is not know which portlets will be open) before I can start my test. Using JUnit, I would do something like this to achieve it:


    • public void closeAllPortlets() {
    • List<WebElement> list = driver.findElements(By.xpath("//span[@class='x-tab-close-btn']"));

    • for(WebElement el: list) {
    • el.click();
    • }
    • }



    Can't seem to find my way around to make this work with Sencha Test (WebDriver) though But once I do, again, will need a way to execute this from the CLI without failures because of the multiple results from a locator.

    Many thanks,

    Dayane

  4. #4
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi Dayane--

    I would recommend trying to craft locators that are unique. With the "multiple locators" option, you'll always get the first match, which is not very reliable (especially if there are changes to the application).

    Thanks
    Joel

Similar Threads

  1. Replies: 1
    Last Post: 9 Jun 2017, 6:02 AM
  2. Running multiple test scenarios
    By Anyfin in forum Q&A
    Replies: 2
    Last Post: 18 Apr 2017, 12:27 AM
  3. Replies: 1
    Last Post: 19 Dec 2016, 7:49 AM
  4. Replies: 3
    Last Post: 3 Aug 2016, 5:01 AM
  5. Replies: 2
    Last Post: 2 Aug 2016, 7:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •