CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

I.AcceptPopup not working

Open fabioel opened this issue 10 years ago • 2 comments

Hi I have a problem with accepting a popup. I don't think that this is an issue with CodeceptJS directly, but more an issue with PhantomJS. I have built a simple test page:

<html>
  <body>
    <h2> Hello </h2>
    <div>
      <p> This is a random text! </p>
      <script>
        var val = confirm('Are you sure?');
        if (val) document.write('good job');
      </script>
    </div>
  </body>
</html>

As you can see after accepting the popup there should be a change in the DOM. But when calling I.seeInPopup('Are you sure') I get the following error:

TypeError: Cannot read property 'indexOf' of undefined
      at Object.InclusionAssertion.haystack (/usr/lib/node_modules/codeceptjs/lib/assert/include.js:18:22)
      at InclusionAssertion.assert (/usr/lib/node_modules/codeceptjs/lib/assert.js:41:34)
      at Object.<anonymous> (/usr/lib/node_modules/codeceptjs/lib/helper/WebDriverIO.js:815:39)
      at Object.<anonymous> (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:369:37)
      at Object.safeExecute (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/utils/safeExecute.js:19:24)
      at Object.WebdriverIO.resolve (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:87:29)
      at /usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:227:32
      at _rejected (/usr/lib/node_modules/codeceptjs/node_modules/q/q.js:830:24)
      at /usr/lib/node_modules/codeceptjs/node_modules/q/q.js:856:30
      at Promise.when (/usr/lib/node_modules/codeceptjs/node_modules/q/q.js:1108:31)

How can I handle popups in CodeceptJS?

fabioel avatar Mar 14 '16 09:03 fabioel

Looks like a bug. Strange, I thought I had tests for this case

DavertMik avatar Mar 14 '16 10:03 DavertMik

Probably this because webdriverio changed its api. Please try new CodeceptJS with webdriverio 4.0 Alternatively, maybe phantomjs doesn't support testing of alerts in any good way. If this issue only appears in phantomjs - please don't reopen this issue

DavertMik avatar Mar 21 '16 22:03 DavertMik