Results 1 to 10 of 10

Thread: Trying to find a way to test for the non-existence of an object through sencha test

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Join Date
    Jan 2018

    Default Answered: Trying to find a way to test for the non-existence of an object through sencha test

    The scenario I'm trying to solve for is that when certain elements exist for a logged in account, this object exists in a tree-list item. However, when those elements are NOT there, the item is not on the tree-list, and I do not know how to test for this expected absence of this object.

    Trying to find any element on the object fails because the test times out waiting for the object to appear. Even a try/catch fails and cancels the test without successful failure.

    Anyone have other ideas on this type of negative test?

  2. It looks like there is a known issue with the "timedout()" API, when it's the first event in a spec/test. This will be fixed in a future update. Also, in your code sample above, the last two lines are invalid usage of the Sencha Test APIs. The first two lines are valid syntax.

    In order to test for non-existence of a component, here are two examples that will work in the meantime:

        it('Should pass as component does not exist', function () {
            // Expect a failure to occur on this individual test.  If there is a failure, this will cause the spec to show as a "pass".
            // It's best to keep the scope of the test fairly small, to just the failure you want to test.
        it('Should also pass as component does not exist', function () {
            // Make use of the "wait" API, so the "timedout" API is not the first event in the spec.

Similar Threads

  1. Replies: 1
    Last Post: 3 Feb 2017, 8:59 AM
  2. Replies: 5
    Last Post: 2 Feb 2017, 8:42 AM
  3. Replies: 5
    Last Post: 26 Sep 2016, 11:17 AM
  4. Replies: 1
    Last Post: 9 Aug 2016, 3:46 AM
  5. Replies: 2
    Last Post: 4 Aug 2016, 4:27 AM

Posting Permissions

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