UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

58 lines 2.56 kB
// © 2022 SolarWinds Worldwide, LLC. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import { EyesLens } from "./eyes-lens"; import { PERCY_DEFAULT_CONFIG, } from "./types"; export class PercyLens extends EyesLens { constructor(page, settings) { super(page, settings); this.page = page; this.settings = settings; // eslint-disable-next-line @typescript-eslint/no-require-imports this.percySnapshot = require("@percy/playwright").percySnapshot; this.percyConfig = { ...PERCY_DEFAULT_CONFIG }; } async takeSnapshot(label) { await super.takeSnapshot(label); this.checkSettings(); await this.percySnapshot(this.page, `${this.settings.currentTestName} - ${label}`, { ...this.percyConfig }); } async takeFullScreenSnapshot(label) { await this.takeSnapshot(label); } async cameraON() { await this.setCustomCSS(); } async cameraOFF() { } toolConfig() { console.warn("No config is available for Percy"); } checkSettings() { this.percyConfig.widths = [...this.settings.responsiveWidths]; if (typeof this.settings.responsivityCallback === "function") { this.settings.responsivityCallback(this.page); } } async setCustomCSS() { await this.page.addStyleTag({ content: "input, textarea { caret-color: transparent;} * {cursor: none !important;}", }); } } //# sourceMappingURL=percy-lens.js.map