This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const PercyScript = require('@percy/script'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const directories = [ | |
| path.resolve(__dirname, '../src/components/elements'), | |
| path.resolve(__dirname, '../src/components/patterns'), | |
| path.resolve(__dirname, '../src/components/templates'), | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const PercyScript = require("@percy/script"); | |
| const fs = require("fs"); | |
| const path = require("path"); | |
| const directories = [ | |
| { | |
| type: "Element", | |
| path: path.resolve(__dirname, "src/components/elements") | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| events: | |
| enabled: true | |
| subscriptions: | |
| - command: node ~/scripts/turn-off-printer.js | |
| event: PrintDone | |
| type: system | |
| system: | |
| actions: | |
| - name: Turn off printer | |
| action: turnoff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| // TODO: I know, I know, don't use request... | |
| const request = require("request"); | |
| // Wrap request with a promise to make it awaitable | |
| function doRequest(options) { | |
| return new Promise(function(resolve, reject) { | |
| request(options, function(error, res, body) { | |
| if (!error && res.statusCode == 200) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipelines: | |
| default: | |
| - step: | |
| name: Visual test | |
| image: circleci/node:8-browsers | |
| script: | |
| - node -v | |
| - npm -v | |
| - npx percy exec -- node ./snapshots.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "devDependecies": { | |
| }, | |
| "percy": { | |
| "version": 1, | |
| "agent": { | |
| "request-headers": { | |
| "Authentication": "Basic c3RnOnN0ZzEyMw==" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| beforeEach(function() { | |
| // Tell Interactor where the applications DOM is | |
| // since Cypress runs the test specs in an isolated iframe (away from the app DOM) | |
| cy.window().then(remoteWindow => { | |
| Object.defineProperty(Interactor.prototype, "$dom", { | |
| get() { | |
| return remoteWindow; | |
| } | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function getExampleDOM() { | |
| // This is just a raw example of setting up some DOM | |
| // that we can interact with. Swap this with your UI | |
| // framework of choice 😉 | |
| let div = document.createElement("div"); | |
| div.innerHTML = ` | |
| <label for="username">Username</label> | |
| <input id="username" /> | |
| <button>Print Username</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { mount } from 'testing-hooks/react-dom'; | |
| import { type } from 'interactor.js'; | |
| import MyInputComponent from './MyInputComponent'; | |
| describe('MyInputComponent', () => { | |
| beforeEach(async () => { | |
| await mount( | |
| <MyInputComponent {...props} /> | |
| ); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require('https'); | |
| const AUTHORIZATION = ''; // base 64 of user:password | |
| const BITBUCKET_USER = ''; // either the user or the org that owns the repo | |
| const PERCY_USER = ''; // the name of your percy user or org | |
| exports.handler = (event, context, callback) => { | |
| /** | |
| We need to post to a URL like this: | |
| https://api.bitbucket.org/2.0/repositories/<user>/<repo>/commit/<hash>/statuses/build |
NewerOlder