Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

element.$ stopped working #922

Closed
mohsen1 opened this issue Jun 11, 2014 · 20 comments
Closed

element.$ stopped working #922

mohsen1 opened this issue Jun 11, 2014 · 20 comments

Comments

@mohsen1
Copy link

mohsen1 commented Jun 11, 2014

I used to use a syntax like this in my tests:

var rows  = element.all(by.repeate("thing in stuff"));
rows.each(function(row){
  row.$('.button').getText().then(function(text){
    if(text.indexOf('....') > -1) { /* ... */}
  });
});

Now I'm getting the following error:

TypeError: Cannot call method 'css' of undefinedTypeError: Cannot call method 'css' of undefined
    at element.$ (/usr/local/lib/node_modules/protractor/lib/protractor.js:674:31)
    at /Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/products/basic_products_crud_tests.js:43:61
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:452:27
    at Array.forEach (native)
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:451:13
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1598:20)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:428:12)
    at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:397:7)
    at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:375:7)
==== async task ====
WebDriver.call(function)
    at webdriver.WebDriver.call (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:511:15)
    at webdriver.WebDriver.findElementsInternal_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:832:15)
    at webdriver.WebDriver.findElements (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:812:17)
    at Object.findElementsOverride (/usr/local/lib/node_modules/protractor/lib/locators.js:293:21)
    at Protractor.findElements (/usr/local/lib/node_modules/protractor/lib/protractor.js:813:21)
    at Object.elementArrayFinder.map (/usr/local/lib/node_modules/protractor/lib/protractor.js:449:22)
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/products/basic_products_crud_tests.js:43:31)
    at /usr/local/lib/node_modules/protractor/jasminewd/index.js:94:14
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1598:20)
==== async task ====
Asynchronous test function: it()
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/jasminewd/index.js:93:33)
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
    at jasmine.Block.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:1174:17)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at jasmine.Queue.start (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2162:8)
    at jasmine.Spec.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2503:14)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at jasmine.Queue.start (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2162:8)
    at jasmine.Suite.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2649:14)==== async task ====
Error
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/products/basic_products_crud_tests.js:41:5)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/products/basic_products_crud_tests.js:40:3)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at Object.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/products/basic_products_crud_tests.js:6:1)
@hankduan
Copy link
Contributor

are you sure it's not because of the typo: by.repeate("thing in stuff")

@mohsen1
Copy link
Author

mohsen1 commented Jun 11, 2014

@hankduan no, that typo doesn't actually exist in my code. I'm at Version 0.23.1.

@mohsen1
Copy link
Author

mohsen1 commented Jun 11, 2014

Is there a template Angular/Protractor app that I can quickly try things in it?

@hankduan
Copy link
Contributor

The following works for me:

  iit('same as example', function() {
    browser.get('https://angularjs.org');
    var rows = element.all(by.repeater('video in videos'));
    rows.each(function(row){
      row.$('.video-item-heading').getText().then(function(text){
        console.log(text);
      });
    });
  });

You can try with https://angularjs.org like I did. There is also a sample app in the testapp directory you can use.

See if the above works for you. Also, try getting the latest version (although i'm not aware of anything in 0.23 that would break it)

@mohsen1
Copy link
Author

mohsen1 commented Jun 11, 2014

The code I am actually using is different than the example I've provided and the one you wrote.

To be exact, I'm pasting my code here:

  describe('#Deleting', function() {
    goToDeveloperApps();
    it('deletes the app', function () {
      var rows = element.all(by.css('#list tbody tr'));
      rows.each(function (row){
        return row.getText().then(function(text){
          if(text.indexOf(app_name) > -1 ){
            row.$('.btn').click();
            // row.findElement(by.css('.btn')).click();
            modal.confirm();
          }
        });
      });
    });
  });

commenting out the click() line and uncommenting next line fix the issue for me.

This is the error I get:

TypeError: Cannot call method 'css' of undefinedTypeError: Cannot call method 'css' of undefined
    at element.$ (/usr/local/lib/node_modules/protractor/lib/protractor.js:674:31)
    at /Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:105:17
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1598:20)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:428:12)
    at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:397:7)
    at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:375:7)
    at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:493:5)
    at Object.webdriver.promise.asap (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:732:5)
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1609:25)
==== async task ====
WebElement.getText()
    at webdriver.WebDriver.schedule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:267:15)
    at webdriver.WebElement.schedule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1609:23)
    at webdriver.WebElement.getText (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1857:15)
    at element.(anonymous function) [as getText] (/usr/local/lib/node_modules/protractor/lib/protractor.js:647:32)
    at /Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:103:20
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:411:11
    at Array.forEach (native)
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:410:13
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
==== async task ====
Asynchronous test function: it()
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/jasminewd/index.js:93:33)
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
    at jasmine.Block.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:1174:17)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at jasmine.Queue.start (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2162:8)
    at jasmine.Spec.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2503:14)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at onComplete (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2205:18)
    at jasmine.Spec.finish (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2477:5)==== async task ====
Error
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:100:5)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:98:3)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at Object.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:5:1)
Failed.

@hankduan
Copy link
Contributor

Can you upgrade and try again?

@mohsen1
Copy link
Author

mohsen1 commented Jun 11, 2014

With version 0.24.1 I got a different error:

TypeError: Cannot read property 'ELEMENT' of undefinedTypeError: Cannot read property 'ELEMENT' of undefined
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1552:29
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1243:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1531:20)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:354:12)
    at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:323:7)
    at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:301:7)
    at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:421:5)
    at Object.webdriver.promise.asap (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:663:5)
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1542:25)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:354:12)
==== async task ====
WebDriver.findElements(By.cssSelector("#list tbody tr"))
    at webdriver.WebDriver.schedule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:268:15)
    at webdriver.WebDriver.findElements (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:826:17)
    at ElementArrayFinder.getWebElements (/usr/local/lib/node_modules/protractor/lib/protractor.js:117:28)
    at ElementFinder.getWebElement (/usr/local/lib/node_modules/protractor/lib/protractor.js:568:51)
    at self.(anonymous function) [as getText] (/usr/local/lib/node_modules/protractor/lib/protractor.js:387:30)
    at /Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:103:20
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:279:9
    at Array.forEach (native)
    at /usr/local/lib/node_modules/protractor/lib/protractor.js:278:11
==== async task ====
Asynchronous test function: it()
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:93:33)
    at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
    at jasmine.Block.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:1174:17)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at jasmine.Queue.start (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2162:8)
    at jasmine.Spec.execute (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2503:14)
    at jasmine.Queue.next_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2209:31)
    at onComplete (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2205:18)
    at jasmine.Spec.finish (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2477:5)==== async task ====
Error
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:100:5)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at null.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:98:3)
    at jasmine.Env.describe_ (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:913:21)
    at jasmine.Env.describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at describe (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:658:27)
    at Object.<anonymous> (/Users/mohsen/apigee/apigee_ui/webui/platform/test/protractor/tests/developer_apps/basic_developer_apps_curd_test.js:5:1)
Failed.

@hankduan
Copy link
Contributor

I just realized you're removing elements with the clicks.
Internally, element.all(by.x).each(), resolves to a list of elements with indices i.e. element(by.x, index=0), element(by.x, index=1), ..., element(by.x, index=n-1)
When you remove elements from the array, when you get to the last element, element(by.x, index=n-1) will resolve to undefined (since you've shorted the list), which means it will not have the $ method.

The easiest way that I can think of doing this is doing an each(), but from the last element to the first

  describe('#Deleting', function() {
    goToDeveloperApps();
    it('deletes the app', function () {
      var rows = element.all(by.css('#list tbody tr'));
      rows.count(function(count) {
        // iterate from back to front
        for (i = count-1; i >= 0; --i) {
          var row = rows.get(i);
          return row.getText().then(function(text){
            if(text.indexOf(app_name) > -1 ){
              row.$('.btn').click(); // Remove your element
              modal.confirm();
            }
          });
        } 
      })
    });
  });

although now that you know why it broke and how it works, you can fix it in a number of ways.
Also, if you know that you're only removing max of a one element, you can always break out of the loop once you removed that element

@mohsen1
Copy link
Author

mohsen1 commented Jun 12, 2014

Thank you for looking into this. Why Element.prototype.click() removes the element from the array? Also why row.findElement(by.css('.btn')).click(); didn't do the same?

@hankduan
Copy link
Contributor

Isn't that what your test is doing? i.e. clicking on the buttons to 'deletes the app'.
You will generally find this kind of behavior when you remove elements from an array as you are iterating through it

@mohsen1
Copy link
Author

mohsen1 commented Jun 12, 2014

Yes it deletes the row, row.findElement(by.css('.btn')).click(); deletes the row too but it doesn't change the rows array.

So basically when I use findElement, rows will not change but if I use $ it will change length of the rows array while looping via .each. correct?

@hankduan
Copy link
Contributor

No. findElement returned the raw webelement from webdriver.
From 0.24.0 on, we removed the ability to call findElement from an Element finder (i.e. row.findElement()) because it's often misused (i.e. used instead of row.element(by.x)/row.$()).

@Droogans
Copy link

Can you elaborate on this change some more?

var listOfThings = [];
$$('.list-of-things').then(function (things) {
    _.forEach(things, function (thing) {
        return thing.$('a').getAttribute('href').then(function (link) {
            listOfThings.push(link.slice(link.indexOf('?') + 1));
        });
    });
    return listOfThings;
});

Is this no longer valid? Because I'm pretty sure this still works in my some of my code.

@Droogans
Copy link

@hankduan I looked up the change at 3c0e727, and it looks like everything should work the same as before except $ and $$ are no longer being attached to the return values of $ and $$ calls.

Is there a reason this was removed?

@hankduan
Copy link
Contributor

Your snippet should work; it doesn't?
I'm not sure what you mean by "$ and $$ are no longer being attached to the return values of $ and $$ calls.", but $ and $$ are basically shorthands for element(by.css()) and element.all(by.css()), respectively.

@Droogans
Copy link

Ok, so here's a function I have in my rows.js base file. Three applications use it.

elementByNumber: {
    value: function (rowNumber) {
        var page = this;
        return $$(this.cssRowSelector + '.data-row-' + rowNumber).then(function (row) {
            console.log(row[0]);
            if (!row.length) {
                return page.length.then(function (length) {
                    page.InvalidRowNumberException.thro(rowNumber + ' -- Valid rows are 1 - ' + length);
                });
            }
            return row[0];
        });
    }
}

I've added a console.log statement to show the output of the test run:

{ locator_: 
   { using: 'css selector',
     value: '.data-table .data-row.data-row-1' },
  parentElementFinder_: null,
  actionResult_: 
   { then: [Function: then],
     cancel: [Function: cancel],
     isPending: [Function: isPending] },
  opt_index_: 0,
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  toWireValue: [Function] }

This is from protractor version 0.24.1

Now when I change my version to 0.20.1, and run the same test, I get this:

{ then: [Function: then],
  cancel: [Function: cancel],
  isPending: [Function: isPending],
  errback: [Function: reject],
  driver_: 
   { session_: 
      { then: [Function: then],
        cancel: [Function: cancel],
        isPending: [Function: isPending] },
     executor_: { execute: [Function] },
     flow_: 
      { events_: {},
        timer: [Object],
        history_: [Object],
        activeFrame_: [Object],
        schedulingFrame_: [Object],
        eventLoopId_: [Object] } },
  id_: 
   { then: [Function: then],
     cancel: [Function: cancel],
     isPending: [Function: isPending] },
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  '$': [Function],
  findElement: [Function],
  '$$': [Function],
  findElements: [Function],
  isElementPresent: [Function],
  evaluate: [Function] }

In the 0.20.1 version, I could chain successive $ and $$ calls. Now I can't. I can still chain the calls.

There's also some other changes that have occurred that are causing me issues, but that's a different topic.

@hankduan
Copy link
Contributor

You don't see '$' and '$$' when you call console.log(row[0]) because those functions are prototypes now. You should be able to use '$' and '$$' as you did before. Let me know otherwise (but it doesn't look like you are experiencing any issues).

With regards to your 'some other issues'. Feel free to open a new issue, or if it's just a question, stackoverflow is great for asking those.

@Droogans
Copy link

Ok.

@hankduan
Copy link
Contributor

Looks like everything is resolved, so closing (btw #935 will make errors like this more apparent)

@mohsen1
Copy link
Author

mohsen1 commented Jul 10, 2014

@hankduan while your method for iteration in items work it's very verbose. I used the "async recursion" to avoid code complexity. I put it here as a reference

    it('should not have any Organization Roles leftovers', function () {
      browser.get('#/' + config.org_name + '/roles');

      function deleteRow(){
        $('button.delete-role-button').click();
         modal.confirm();
         return $$('.user-role-row').count().then(function (count){
            if(count) { deleteRow(); }
         });
      }

      deleteRow();

      expect($$('.user-role-row').count()).toBe(0);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants