codeceptjs / codeceptjs/CodeceptJS

Problems with multiple dialog popups using Puppeteer

Abierto
#1,872 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
757
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Descripción

#### 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'
}
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.