CodeceptJS
CodeceptJS copied to clipboard
IFrame issue: Uncaught frame.frameElement: Target closed
What are you trying to achieve?
Testing a site which uses frames.
What do you get instead?
Doing a very simple test just checking for a text on the page I get very inconsistent results. Sometimes it runs and passes but often times it fails with "Uncaught frame.frameElement: Target closed"
I can immediately run the test again and sometimes it will pass, sometimes it will fail again.
Things I've tried that don't seem to improve things:
- running headed or headless
- using firefox or chromium (haven't tried electron yet)
- using --plugins retryFailedStep (doesn't seem to help as it seems to be an error not a failure)
What can I do to make these more reliable?
Provide console output if related. Use
--verbosemode for more details.
Uncaught frame.frameElement: Target closed
Error: done() called multiple times in hook <General Smoke Tests "after each" hook: finalize codeceptjs for "I am both SMOKE and FOO test @smoke @foo"> of file C:\www\bold2-tests\smoke_test.js
Provide test source code if related
Feature('General Smoke Tests');
Before(({ I, loginPage }) => { // or Background
I.amOnPage('/');
within({frame: "#master_frame"}, () => {
loginPage.login(process.env.APP_USERNAME, secret(process.env.APP_PASSWORD));
});
});
Scenario('I am a smoke test but not FOO', ({ I }) => {
within({frame: "#master_frame"}, () => {
I.see('Main Menu');
});
}).tag('@smoke');
Scenario('I am both SMOKE and FOO test @smoke @foo', ({ I }) => {
within({frame: "#master_frame"}, () => {
I.see('Main Menu');
});
});
Details
- CodeceptJS version: CodeceptJS v3.2.2
- NodeJS Version: v16.13.1
- Operating System: Windows 10
- Playwright
- Configuration file:
// use dotenv for secret management
// https://www.npmjs.com/package/dotenv
require('dotenv').config();
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
const { setHeadlessWhen } = require('@codeceptjs/configure');
setHeadlessWhen(process.env.HEADLESS);
// see: https://codecept.io/helpers/Playwright/
exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
Playwright: {
url: 'http://local.mylocal.com',
show: true,
restart: true,
browser: 'firefox'
}
},
include: {
I: './steps_file.js',
loginPage: './pages/login.js'
},
bootstrap: null,
mocha: {},
name: 'my-test',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}