-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Substantial amount of random errors snapshotting static pages #329
Comments
Hey @mitar! I debugged this and it seems related to some nested iframes that are accessible for serialization, but don't actually contain expected document elements. Essentially, After I figure out how to test this one properly, I'll add a fix which will skip serializing iframes that do not have document elements. This will suppress that error, but might result in unexpected or flakey snapshots when re-rendering in Percy's infrastructure without serialized frames (for example, if they aren't intended to be empty and are not publicly accessible from within Percy's rendering environment). In the meantime, you might be able to work around the issue either by waiting longer for the page to settle before taking the snapshot, or by finding and removing troublesome frames before the DOM is serialized. I see you're using the snapshot command on a static directory, so it may take a bit of work to convert to a page listing file to be able to pass in wait or execute options. We are going to be adding better documentation and a few more features to this command soon that will make these options easier to use with static directories. Another quick option you might try is the |
The CI above already included 1000 ms as the timeout value. Are you sure that network timeout captures the networking in iframes, too? Because it does not feel to me like it really influences anything for iframes.
No, none is empty on purpose. And on all pages they are the same iframes (twitter and disqus). In my case I think simply removing all iframes would probably work. Maybe an option to CLI which would do that would be best? I already hide some iframes. |
Ah, I missed the timeout option in the CI run. "Purposefully empty" could be that Twitter or Disqus have nested iframes and one of the intermediary iframes or maybe even a main iframe could have some protection in place to prevent reading the DOM. I'll be working on a simple reproduction for tests shortly, but it may be as simple as the script they run unsets the document element property. I'll start working on a test now for ignoring iframes that are missing document elements. If you don't see a mention in a PR in the next hour or so, I'll have it finished up tomorrow. As for more options for the snapshot CLI command, that work will probably happen over the next couple of weeks alongside better documentation. If you want to work around this right away, you'll need to convert to using a page listing file in order to provide pages an Based on the example JS page listing in the linked doc and the page iteration in the command source, you could map over the filenames and return the local URL, name, and then the execute function. To use the page listing, start your server and run the snapshot command with the page listing file. Here's what that might look like (untested): // percy-snapshots.js
const globby = require('globby');
const SERVER_ADDR = 'http://localhost:8008/';
const PUBLIC_DIR = './public';
const SNAPSHOT_FILES = ['*.html'];
const IGNORE_FILES = [];
module.exports = async () => {
let paths = await globby(SNAPSHOT_FILES, {
cwd: PUBLIC_DIR,
ignore: IGNORE_FILES
});
return paths.map(path => ({
name: path,
url: `${SERVER_ADDR}${path}`,
// this function runs in the browser before the snapshot is taken
execute() {
document.querySelector('.problem-iframe').remove();
}
}));
} # start your server first, then run
$ percy snapshot percy-snapshots.js |
Fixed in v1.0.0-beta.50 |
Awesome! I also made #343 as a followup. |
Bumps [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) from 2.11.2 to 2.11.3. - [Release notes](https://github.com/cypress-io/eslint-plugin-cypress/releases) - [Commits](cypress-io/eslint-plugin-cypress@v2.11.2...v2.11.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
See this CI run. I see many errors like:
I am surprised because all pages are more or less the same (blog posts) so there is not really a reason that one would fail and another one not.
Is there any way to get those errors down?
The text was updated successfully, but these errors were encountered: