Skip to content

Screenshot/video is not creating folder structure from tests #24052

Open
@PippoRaimondi

Description

Current behavior

When we have a test folder structure like this:

cypress
    --> specs
        --> some-test.cy.js
        --> some-folder
            --> some-other-test.js

And screenshots are taken within the above tests, we get screenshots added the following way:

cypress
    --> screenshots
         --> screenshot-some-test
         --> screenshot-some-other-test

Desired behavior

How it used to work and how all visual regression tools need it to work:

cypress
    --> specs
         --> some-test.cy.js
         --> some-folder
             --> some-other-test.js

And screenshots are taken within the above tests, we get screenshots added the following way:

cypress
    --> screenshots
        --> screenshot-some-test
        --> some-folder
            --> screenshot-some-other-test

If it's too much work to fix the above, can you please include specName back to the after:screenshot details object?

Cypress 9.x after:screenshot details object:

{
  name: 'folder-structure-test/folder-structure-spec-wholePage',
  specName: 'folder-structure-test/folder-structure-spec.js',
  path: '/Users/filipporaimondi/code/cypress-image-diff/cypress/screenshots/folder-structure-test/folder-structure-spec.js/folder-structure-test/folder-structure-spec-wholePage (1).png',
  ...
}

Cypress 10.x after:screenshot details object:

{
  name: 'folder-structure.cy-wholePage',
  path: '/Users/filipporaimondi/code/cypress-image-diff/cypress/screenshots/folder-structure.cy-wholePage (1).png',
  ...
}

Test code to reproduce

Just take any screenshot within a folder structure above to replicate...

Cypress Version

10.x

Node version

16.x

Operating System

mac

Debug Logs

No response

Other

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions