codeceptjs / codeceptjs/CodeceptJS

Problems with multiple dialog popups using Puppeteer

Aperta
#1,872 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
4.2k
Fork
757
Merge medio
2g 9h
PR unite (30g)
16

Descrizione

#### What are you trying to achieve?

I'm converting some WebDriver tests into Puppeteer format and came across a problem with popups.

**Scenario:**
I have a button, that when clicked displays a dialog popup with the text "Are you sure you want to remove this node?"
When accepting the popup, a second popup is displayed with the text "deleteRow"

#### What do you get instead?

Using WebDriver the tests pass, but with Puppeteer I get this error:

> expected text in popup to include "Are you sure you want to remove this node?"
> + expected - actual
>
> -deleteRow
> +Are you sure you want to remove this node?

Original WebDriver test:
```js
I.click('.json-editor-btntype-deletelast');
I.seeInPopup('Are you sure you want to remove this node?');
I.acceptPopup();
I.seeInPopup('deleteRow');
I.acceptPopup();
I.click('.get-value');
assert.equal(await I.grabValueFrom('.debug'), '["A","B"]');
```

Puppetter test:
```js
I.amAcceptingPopups();
I.click('.json-editor-btntype-deletelast');
I.seeInPopup('Are you sure you want to remove this node?');
I.acceptPopup();
I.amAcceptingPopups();
I.seeInPopup('deleteRow');
I.acceptPopup();
I.click('.get-value');
assert.equal(await I.grabValueFrom('.debug'), '["A","B"]');
```
I have tried several different variations of "I.amAcceptingPopups()" positions, but nothing seems to work.

### Details

* CodeceptJS version: 2.3.0
* NodeJS Version: 12.9.0
* Operating System: Windows 19 Home 64Bit
* Puppeteer: 1.19.0
* Configuration file:

```js
exports.config = {
tests: './tests/codeceptjs/**/*_test.js',
timeout: 10000,
output: './e2e/output',
helpers: {
Puppeteer: {
browser: 'chrome',
url: 'localhost:9001/tests/pages/',
show: true,
disableScreenshots: false,
waitForNavigation: 'networkidle0',
waitForAction: 200,
restart: false,
chrome: {
args: ['--ignore-certificate-errors', '--no-sandbox']
}
},
customHelpers: {
require: './config/puppeteer.helpers.js'
}
},
include: {
I: './tests/codeceptjs/steps_file.js'
},
bootstrap: null,
mocha: {
reporterOptions: {
reportDir: './e2e/reports',
inlineAssets: true,
reportPageTitle: 'E2E Test Reports',
reportTitle: 'E2E Test Reports'
}
},
name: 'codeceptjs-json-editor'
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.