Skip to content

Make path pattern smarter for errors screenshots #7014

@fmancardi

Description

@fmancardi

What is your Scenario?

I would like that screenshots on failure generate a file name with the testcase name + a progressive.
Probably this a non-sense because when test script fails it can not take more than one screenshot.

This is my .testcaferc.json

{
  "selectorTimeout": 2000,
  "skipJsErrors": true,

  "screenshots": {
    "takeOnFails": true,
    "pathPattern": "${DATE}_${TIME}/test-${TEST}/${USERAGENT}/${TEST}-${FILE_INDEX}.png"
  }
}

What is the Current behavior?

for the screenshots taken usin .takeScreenshot() it work as expected generating
tcf01

inside the TCF-004-errors folder, file name is the standard

2022-05-07 11_04_13-{C__development_testautomation_end-to-end_screenshots_2022-05-07_10-56-27_test-T

What is the Expected behavior?

inside the TCF-004-errors folder, file name respect the mask

${TEST}-${FILE_INDEX}.png

What is your public website URL? (or attach your complete example)

You can access our test site

This is the example

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture `New Fixture`
    .page `https://platform70-at.tesisquare.com/core/framework/login.cfm`;

test
.meta({'TCID': 'TCF-004',
          'WKFSTATUS': 'ready',
          '6.3': 'yes',
          '6.4': 'yes',
          '7.0': 'yes'})
('TCF-004', async t => {
    await t
        .click('#cookieChoiceDismiss')
        .typeText('#userlogin', 'admin')
        .typeText('#password', 'qqq')
        .click('#login')
        .click('#btn-toggle-menu')
        .click(Selector('#A_ADMIN_SYS-GESANAG_AN span').withText('ANAGRAFICHE'))
        .click('#A_ADMIN_SYS-GESANAG_AN_1')
        .click('#inserisci')
        .switchToIframe('#frame-for-tab')
        .typeText('#IdAnag', 'qazwsxedcrfvtgbyhnuj')
        .takeScreenshot()
        .typeText('#DescIndirizzoPF', 'qq')
        .typeText('#DescCittaPF', 'qq')
        .takeScreenshot()
        .typeText('#DescRagSocPF', 'qq')
        .typeText('#CapPF', 'qq')
        .typeText('#IdProvinciaPF', 'qq')
        .takeScreenshot()
        .click('#select2-Stato-container')
        .typeText('#fieldset_g1 .select2-search__field', 'Valido')
        .pressKey('enter')
        .click('#select2-idlingua-container')
        .typeText('#fieldset_g1 .select2-search__field', 'Italiano')
        .pressKey('enter')
        .click('#select2-IdNazionePF-container')
        .typeText('#fieldset_g1 .select2-search__field', 'ITALY')
        .pressKey('enter')
        .click('#inserisci')
        .expect(Selector('#pagecontainer div')
        	     .withText('Error ID: PLATFORM_STANDARD')
        	     .exists).eql(false)
        .expect(Selector('#pagecontainer a')
        	      .withText('Return to the Homepage')
        	      .exists).eql(false)
        .debug();
});


Your complete configuration file

{
  "selectorTimeout": 2000,
  "skipJsErrors": true,

  "screenshots": {
    "takeOnFails": true,
    "pathPattern": "${DATE}_${TIME}/test-${TEST}/${USERAGENT}/${TEST}-${FILE_INDEX}.png"
  }
}

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

N.A.

TestCafe version

1.18.2

Node.js version

v14.15.5

Command-line arguments

testcafe 'chrome --start-fullscreen' --test-meta WKFSTATUS=ready,6.4=yes --cfg=at-7.0.json ./test/testcafe/TCF-006-multiple-sshots.js

Browser name(s) and version(s)

No response

Platform(s) and version(s)

Windows 10, using Gitbash to run the script

Other

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions