Wrong error (allElements.shift not a function) showing in test summary
See original GitHub issueWe have many tests that make use of sections. Whenever one of these tests contains a call to verify an element within a section and the test fails, the correct error is reported, along with the allElements.shift is not a function error. Unfortunately, the final test summary at the end of the test run ONLY reports the allElements.shift error, instead of the correct, more helpful error that the element being sought was not available.
For example:
My test has the following line:
this.section.userMenu.expect.element('@logOff').to.be.visible
If the expectation fails when the test runs, I see:
✖ Expected element <Section[name=accountDropDown],Element[name=@signOut]> to be visible - expected "visible" but got: "not visible"
at Object.commands.assertLogoutButton (/app/e2e/pages/global.js:51:41)
at Object.module.exports.before.Throws an error for an incorrect login.Logs in with a valid user (/app/e2e/tests/login/login.spec.js:19:16)
The test then automatically retries. When this happens, an earlier validation (which occurs inside an iframe), which passed on the first attempt, now fails on the second attempt:
this.api.frame('login_iframe').waitForElementPresent('main_page_content')
Then, when the suite completes, that failure reports as:
TEST FAILURE: 1 error during execution, 0 assertions failed, 6 passed. (42.602s)
✖ login/login.spec
- Throws an error for an incorrect login (7.581s)
Error while running waitForElementPresent command: allElements.shift is not a function
at Object.setCredentialFields (/app/e2e/pages/login.js:63:8)
at Object.commands.loginFlow (/app/e2e/pages/login.js:40:10)
at Object.module.exports.before.Throws an error for an incorrect login (/app/e2e/tests/login/login.spec.js:13:15)
Summary:
- It would be helpful if the summary output would include the original error during the test’s first attempt, rather than the second attempt.
- It would be helpful if the waitForElementPresent error were reported rather than the allElements.shift internal error when a waitForElementPresent check is executed.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
I’m seeing this error in the retries after a command failure. Does anyone know if this is already fixed?
Should be fixed in v1.0.4.