| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,46 @@ | ||
| const element = require("../package.json").pfelement.elementName; | ||
| let windowSize; | ||
|
|
||
| describe(element, () => { | ||
| let snapshotOptions; | ||
|
|
||
| before(() => { | ||
| browser.url(`/elements/${element}/demo`); | ||
| // Capture window size | ||
| windowSize = browser.getWindowSize(); | ||
|
|
||
| snapshotOptions = { | ||
| removeElements: [ | ||
| $("#toc"), | ||
| $$(".skip-e2e") | ||
| ] | ||
| }; | ||
| browser.url(`/elements/${element}/demo/index_e2e.html`); | ||
|
|
||
| browser.setWindowSize(1200, 1000); | ||
| }); | ||
|
|
||
| ["light", "dark", "saturated"].forEach(context => { | ||
| it(`should take a screenshot and compare for ${context} context`, () => { | ||
| $("#context").selectByAttribute("value", context); | ||
| browser.saveFullPageScreen(`${element}--${context}`, snapshotOptions); | ||
| expect(browser.checkFullPageScreen(`${element}--${context}`, snapshotOptions)).toBeLessThan(3.1); | ||
| }); | ||
| after(function() { | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhy set the browser window size after these tests?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAn observation - I noticed that if you change the browser size between tests, it persists between test files unless you unset that update.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityFuture option is to set up a global before that sets the initial browser size
Sorry, something went wrong.
All reactions
|
||
| browser.setWindowSize(windowSize.width, windowSize.height); | ||
| }); | ||
| }); | ||
|
|
||
| if (browser.capabilities.browserName === "IE") { | ||
|
Comment thread
castastrophe marked this conversation as resolved.
|
||
| it(`should take a screenshot and compare`, () => { | ||
| browser.saveFullPageScreen(element, {}); | ||
| expect(browser.checkFullPageScreen(element, {})).toBeLessThan(3.1); | ||
| }); | ||
| } else { | ||
|
|
||
| ["light", "dark", "saturated"].forEach(context => { | ||
| it(`should take a screenshot and compare for ${context} context`, () => { | ||
| if (context !== "light") { | ||
| let color = "darker"; | ||
| if (context === "saturated") color = "accent"; | ||
|
|
||
| browser.execute(function (color) { | ||
| document.querySelector("#wrapper").className = `surface--${color}`; | ||
| Promise.all([customElements.whenDefined("pfe-tabs")]).then(function () { | ||
| document.querySelectorAll("pfe-tabs").forEach(function (tab) { | ||
| tab.resetContext(); | ||
| }); | ||
| }); | ||
| }, color); | ||
| } | ||
|
|
||
| browser.saveFullPageScreen(`${element}--${context}`, {}); | ||
| expect(browser.checkFullPageScreen(`${element}--${context}`, {})).toBeLessThan(3.1); | ||
| }); | ||
| }); | ||
| } | ||
| }); | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.