CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Headless mode and fullPageScreenshots config failed taking screenshot

Open Horsty80 opened this issue 2 years ago • 3 comments

What are you trying to achieve?

I try to take screenshot in a scenario or I try to have automatic screenshot when scenario is failed with the plugin

 screenshotOnFail: {
      enabled: true,
    },

What do you get instead?

If i take screenshot in scenario is failing with this error message

     page.screenshot: Timeout 5000ms exceeded.
=========================== logs ===========================
taking page screenshot
============================================================
  page.screenshot: Timeout 5000ms exceeded.
  =========================== logs ===========================
  taking page screenshot

Verbose logs :


Helpers: Playwright
Plugins: screenshotOnFail

github --
    [1]  Starting recording promises
    Timeouts: 
 » [Session] Starting singleton browser session
  test something
    I am on page "https://github.com/"
    I save screenshot "debug.png"
    » Screenshot is saving to C:\Users\horsty\Workspace\poke-codecept\output\debug.png
    [1] Error | TimeoutError: page.screenshot: Timeout 5000ms exceeded.
=========================== logs ===========================
taking page screenshot
============================================================
    [1] Error | TimeoutError: page.screenshot: Timeout 5000ms exceeded.
=========================== logs ===========================
taking page screenshot
============================================================
    [1] <teardown> Stopping recording promises
 » <screenshotOnFail> Test failed, try to save a screenshot
 » Screenshot is saving to C:\Users\horsty\Workspace\poke-codecept\output\test_something.failed.png
 » <TimeoutError: page.screenshot: Timeout 5000ms exceeded.
=========================== logs ===========================
taking page screenshot
============================================================> 
  × FAILED in 11453ms

    [2]  Starting recording promises

Provide test source code if related

// paste test

Details

dependancies :

  • "playwright": "^1.22.2"
  • "codeceptjs": "^3.3.3"
  • node v16.15.0

package.json

{
	"scripts": {
		"test": "codeceptjs run --steps"
	},
	"dependencies": {
		"codeceptjs": "^3.3.3"
	},
	"devDependencies": {
		"playwright": "^1.22.2"
	}
}
# paste config here
exports.config = {
  tests: "./*_test.js",
  output: "./output",
  helpers: {
    Playwright: {
      url: "http://localhost",
      show: false,
      browser: "chromium",
      fullPageScreenshots: true,
    },
  },
  include: {
    I: "./steps_file.js",
  },
  plugins: {
    screenshotOnFail: {
      enabled: true,
    },
  },
  bootstrap: null,
  mocha: {},
  name: "poke-codecept",
};

Horsty80 avatar Jun 14 '22 13:06 Horsty80

Hi, when your tests fail, do you manage to get screenshots?

Miriambnzdn avatar Aug 11 '22 12:08 Miriambnzdn

Hi, when your tests fail, do you manage to get screenshots?

Sorry i don't understand what do you expected with this question. I "manage" nothing, i just use the plugin screenshotOnFail no custom

  plugins: {
    screenshotOnFail: {
      enabled: true,
    },
  },

Horsty80 avatar Aug 11 '22 13:08 Horsty80

Oh sorry, I did not express myself well. When you use the plugin and your tests fail, you recover some screenshot in your output folder ?

Miriambnzdn avatar Aug 11 '22 13:08 Miriambnzdn

Closed for now! Feel free to reopen if you still encounter the issue with latest version and would be nice to provide a sample code to reproduce the issue.

kobenguyent avatar Oct 19 '23 12:10 kobenguyent