Skip to content

execute() doesn't work in additionalSnapshots #392

@chris-dura

Description

@chris-dura
"@percy/cli": "^1.0.0-beta.55",

The execute() function seems to work when in the "parent" snapshot:

// snapshots.js

module.exports = [
	{
		name: 'snapshot one',
		url: 'http://localhost:8080',
		waitForSelector: '.some-element',
		execute() {
			document.querySelector('h1').innerHTML = 'Tilting on windmills...';
		}
	}
]

However, trying to run the same execute() in an additionalSnapshot (like in this pages.js example) it does not work, and the <h1> content stays the same :/

// snapshots.js

module.exports = [
	{
		name: 'snapshot one',
		url: 'http://localhost:8080',
		waitForSelector: '.some-element',
		additionalSnapshots: [
			{
				suffix: '--tilt',
				execute() {
					document.querySelector('h1').innerHTML = 'Tilting on windmills...';
				}
			}
		]
	}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions