                     .scrollToElement scrollElement
                     .click selector 'role', indexOfTargetUser1+1
                     .pause 1000
-                    .click action 2
+                    .click nthItem 2
                     .pause 1000
                     .click selector 'role', indexOfTargetUser1+1
                     .pause 1000
-                    .click action 2
+                    .click nthItem 2
                     .pause 1000
                     .assert.containsText selector('role', indexOfTargetUser1+1), 'Member'
                     .pause 1000
                     .click selector 'role', indexOfTargetUser2+1
                     .pause 1000
-                    .click action 2
+                    .click nthItem 2
                     .pause 1000
                     .assert.containsText selector('role', indexOfTargetUser2+1), 'Admin'
                     .end()

  "#{sectionSelector} .ListView-row:nth-of-type(#{index}) #{memberSelector} .#{type}"


action = (index) ->
  ".menu-class ul.ButtonWithMenuItemsList li:nth-of-type(#{index})"

      .scrollToElement scrollElement
      .waitForElementVisible selector('role', 1), 20000
      .click selector('role', 1), ->
        myteamhelpers.checkTeammates browser, invitations[0], nthItem(1), nthItem(2), selector('role', 1), no, ->
          browser.waitForElementVisible selector('role', 1), 20000
          browser.click selector('role', 2), ->
            myteamhelpers.checkTeammates browser, invitations[1], nthItem(1), nthItem(2), selector('role', 2), no, ->
              browser.expect.element(selector('role', index+1)).text.to.contain 'Owner'
              browser.click selector('role', lastPendingInvitationIndex+1), ->
                myteamhelpers.checkTeammates browser, invitations[lastPendingInvitationIndex], nthItem(1), nthItem(2), selector('role', lastPendingInvitationIndex+1), yes, ->
                  browser
                    .waitForElementNotPresent selector('fullname', lastPendingInvitationIndex+1), 20000
                    .end()
