codeceptjs / codeceptjs/CodeceptJS
Session is destroyed when opening a new tab that executes window.close() inside that said tab
- 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?
Open a tab that manages oauth login and continue running test after closing the oauth window.
#### What do you get instead?
After i successfully get credentials, i call a function in window.opener that passes the info i need then calls window.close() so user is taken back to the main window where the application is running. When trying to create a test case for this, getting an error saying session is gone because window was closed.
> Provide console output if related. Use `--verbose` mode for more details.
```bash
# paste output here
- FAILURES:
1) Providers Login
Twitter login should work:
Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
```
> Provide test source code if related
```js
// paste test
Feature('Providers Login')
Scenario('Twitter login should work', (I) => {
I.amOnPage('/')
I.click('.mno-btn-red')
I.click('.twitter')
I.switchToNextTab()
I.fillField('session[username_or_email]', '@twitter username')
I.fillField('session[password]', '@twitter password')
I.click('Authorize app')
I.seeInCurrentUrl('matcherino.com')
pause()
})
```
where @twitter username should be your own account
where @twitter password should be password of your account
### Details
* CodeceptJS version: 2.4.1
* NodeJS Version: 12.4.1
* Operating System:
* puppeteer || webdriverio || protractor || testcafe version (if related) Puppeteer: 2.0.0
* Configuration file:
```js
# paste config here
const { setHeadlessWhen } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// HEADLESS=true npx codecept run
setHeadlessWhen(process.env.HEADLESS);
exports.config = {
// tests: './src/*_test.js',
tests: './src/providers_test.js',
output: './output',
helpers: {
Puppeteer: {
url: 'http://matcherino.com',
show: true,
waitForNavigation: ["domcontentloaded", "networkidle0"],
waitForAction: 500
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'bdd-test',
plugins: {
retryFailedStep: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.