Coder Social home page Coder Social logo

dgrebb / backstopjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garris/backstopjs

0.0 0.0 0.0 61.42 MB

Catch CSS curve balls.

Home Page: http://backstopjs.org

License: MIT License

Shell 1.43% JavaScript 93.00% CSS 1.36% HTML 3.93% Dockerfile 0.28%

backstopjs's Introduction

Website Badge Linkedin Badge
Goodreads Badge Catchafire Badge Pinboard Badge


Howdy! I'm Dan.

I love computers. They've been a major part of my life for over 30 years.

Building websites since 1999, I never stop experimenting with new technology.

I currently work at Comcast, and fight for the users.

Be excellent to each other.


GitHub-Stats-Card-Dark

GitHub-Stats-Card-Light


Recent Posts

Recent Gists

More Projects

Recent Pins

backstopjs's People

Contributors

anton-kulagin avatar bblackwo avatar brendonbribeiro avatar cactusa avatar coliff avatar dependabot[bot] avatar dgrebb avatar digitaldonkey avatar fuhlig avatar gabegorelick avatar garris avatar jehoshua02 avatar jkevingutierrez avatar klausbayrhammer avatar klodoma avatar kyanny avatar laubsauger avatar ledenis avatar lewisnyman avatar medovob avatar mfranzke avatar mirzazeyrek avatar nobso avatar onigoetz avatar proll avatar rimi-itk avatar roborourke avatar seanmcmillan avatar tkrah avatar wlsf82 avatar

backstopjs's Issues

[FEAT] - Remote - UI Path

Requirements

The server should be able to host static report files from base path rather than several levels deep.

Maintain backwards comparability to also host static assets several levels deep.

  • add new static paths to express
  • add CORS support to super simple webserver
  • add refs endpoint
  • enhance tests endpoint with filters
  • ensure report path can remain hosted from current sever-levels deep implementation
  • test
  • update documentation

[CHORE]: Update Dockerfile and test with Node 20 (#34)

The BackstopJS Dockerfile should be updated to and adjust for any Node 20 compatibility issues.

  • Update Dockerfile
  • Adjust any related configuration
  • Test all scenarios

Docker Validations Performed

Note: a npm run docker-load script was added to load local buildx multi-platform image without publishing

  • cd test/configs/ && node ../../cli/index.js test --docker
  • npm run sanity-test-docker
  • npm run smoke-test-docker - exits without indication of passing smoke tests; report opens in browser. expected?
  • npm run sanity-test-playwright-docker

[FEAT]: Layer Dockerfile to Improve Build Time

Problem

Docker builds take a long time.

Solution

Layer the docker image so a majority is cached before building the BackstopJS meat.

The layering should be easily overridden with a new npm script via docker buildx build --no-cache or whatever.

Layers

Each of these will be cacheable except the last, which will always get latest backstop, playwright, and puppeteer.

  • set up the OS and deps
  • set up npm deps
  • install backstop, playwright, and docker fresh

[FEAT] - Watch Mode

Let's add a "watch-mode" to BackstopJS, so it will run automatically on when file changes are detected.

  • possibly use nodemon
  • use another method of file-watching
  • can be passed configuration with files to watch
  • can be passed a filter to only run certain tests on file change

[FEAT] - Refactor Dockerfile

Ensure proper configuration set for

  • user: does it need to be root? node? something else?
  • deps: npx playwright install --with-deps in the Dockerfile itself to reduce build times
  • speed: set up container layering so all dependencies are cached prior to setting up backstop in the RUN command
  • any other nice-to haves from open issues

[FEAT] - Compare - Dependency Refresh

Requirements

Update compare ecosystem dependencies and build src to output with latest React, Babel, and Webpack.

Tasks

  • after updating dependencies, refactor webpack.config.js as needed (static image assets etc.)
  • build compare successfully
  • test browser regressions
    • Safari
    • Chrome
    • Firefox
    • Edge
  • add issues for larger lifts

[FEAT] - Updates and Refactoring for Node 20

Requirements

The project should be installed and run with Node 20. As gaps are identified, create issues for larger lifts, or add tasks below to upgrade specific dependencies one at a time.

Tasks

  • install BackstopJS from master using Node 20
  • update dependencies with ncu
  • update Dockerfile to Node 20 (#40)
  • validate santiy-test-docker
  • validate sanity-test
  • validate ember-backstop
  • validate remote
  • validate test
  • validate reference
  • validate approve
  • create dependency compatibility issues

Compatibility Tests

  • test Node 14
  • test Node 16
  • test Node 18

[CHORE]: Convert project to ESM

Requirements

A number of dependencies are now 100% ESM, and do not work with CommonJS/require().

The project should be converted, entirely, to ESM. This conversion is backwards compatible with CommonJS, but CommonJS is not compatible with ESM.

p-map and chalk for example

p-map

❯ npm run sanity-test

> [email protected] sanity-test
> cd test/configs/ && node ../../cli/index.js test

/BackstopJS/core/util/createBitmaps.js:4
const pMap = require('p-map');
             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /BackstopJS/node_modules/p-map/index.js from /BackstopJS/core/util/createBitmaps.js not supported.
Instead change the require of index.js in /BackstopJS/core/util/createBitmaps.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/BackstopJS/core/util/createBitmaps.js:4:14)
    at Object.<anonymous> (/BackstopJS/core/command/reference.js:1:23)
    at requireCommand (/BackstopJS/core/command/index.js:49:26)
    at Array.map (<anonymous>)
    at Object.<anonymous> (/BackstopJS/core/command/index.js:46:4)
    at Object.<anonymous> (/BackstopJS/core/runner.js:1:24)
    at Object.<anonymous> (/BackstopJS/cli/index.js:6:16) {
  code: 'ERR_REQUIRE_ESM'

Node.js v20.8.1

chalk

❯ npm run sanity-test

> [email protected] sanity-test
> cd test/configs/ && node ../../cli/index.js test

/BackstopJS/core/util/logger.js:1
const chalk = require('chalk');
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /BackstopJS/node_modules/chalk/source/index.js from /BackstopJS/core/util/logger.js not supported.
Instead change the require of index.js in /BackstopJS/core/util/logger.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/BackstopJS/core/util/logger.js:1:15)
    at Object.<anonymous> (/BackstopJS/core/command/index.js:3:16)
    at Object.<anonymous> (/BackstopJS/core/runner.js:1:24)
    at Object.<anonymous> (/BackstopJS/cli/index.js:6:16) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.8.1

[FEAT]: CI - Add GitHub Workflows

Let's add GitHub workflows to test all the things!

  • sanity tests
  • smoke tests
  • unit tests
  • docker build
  • docker smoke tests (with built image)
  • docker sanity tests (with built image)

[FEAT] - Update backstop-twentytwenty Dependencies

Requirements

Update backstop-twentytwenty to latest Webpack, Babel, and React.

Tasks

  • reconfigure webpack as needed
  • adjust React where needed
  • test in Node 20 via sanity-test in main project
  • test in Node 18 via sanity-test in main project
  • test in Node 16 via sanity-test in main project (nice to have)
  • add issues for larger lifts

[FEAT/FIX]: Core/Report - CSP Refactoring (garris#1171)

Problem

Content-Security-Policy is beginning to grow in popularity, and CSS/Script injections will increasingly be blocked.

This applies to:

  • frame-src: report viewing inside frames in CI/CD like Jenkins (garris#1171)
  • style-src: injecting styles and inline styles in HTML Report
  • script-src: injecting scripts and inline scripts in HTML Report

Solution

  • do more research into CSP thread: puppeteer/puppeteer#1229 (comment)
  • design feature implementations
    • create a loader for Report
    • create a loader for test injection (unique to Playwright/Puppeteer?)

Puppeteer

Important

CSP bypassing happens at the moment of CSP initialization rather than evaluation. Usually, this means that page.setBypassCSP should be called before navigating to the domain.

Playwright

[FEAT] - Capture - Add `page.screenshot` API options to BackstopJS-configuration options

Summary

Problem

Reducing motion is a very necessary challenge when taking screen shots. The Playwright screenshot API has a parameter, animation, that could be used to achieve faster capture.

Page-level APIs aren't currently exposed, so this cannot currently be added by Backstop configuration.

Solution

Add a configuration API for page-level function params that can be processed and passed into the Puppeteer and Playwright runners.

Notes

[FEAT]: CI - Pass full backstopjs package name/version to Docker

Summary

Let's allow the backstopjs package installation to be passable in args during Docker build.

Why?

This will allow GitHub actions to pass the current backstopjs branch to Docker, so build, publish, and tests are run with the latest changes this branch has introduced.

How?

  • rename the Dockerfile ARG "BACKSTOPJS_VERSION" → "BACKSTOP_INSTALL_SOURCE"
  • adjust the ENV BACKSTOPJS_VERSION=$BACKSTOPJS_VERSIONBACKSTOP_INSTALL_SOURCE=$BACKSTOP_INSTALL_SOURCE
  • adjust npm scripts as needed
  • create GitHub Actions var BACKSTOP_INSTALL_SOURCE to concatenate installation source path
  • update GitHub Actions to pass the BACKSTOP_INSTALL_SOURCE to Docker builds
  • check if any $TAGs need to be adjusted

Default view state via configuration (or save to localStorage)

Hey, thanks for a great tool :)

I was wondering if you would consider showing all the information by default rather than having it hidden? I appreciate the clean interface, but I didn't notice that the information was hidden until I went to click to copy the file name.

I'm not so confident in getting this spun up to make an MR, but I think the changes would be:

Change this styling to

display: flex;
flex-wrap: wrap;

And then remove these lines and everything pertaining to settings.textInfo

Originally posted by @mikestreety in garris#1519

[BUG] - Update Compare application, dependencies, and webpack configuration

Requirements

Currently npm run build-compare fails due to webpack/babel configuration conflicts. This may be due to differences in how Node handles blobs in > 14.x.x.

Possible Solutions

Details

❯ npm run build-compare

> [email protected] build-compare
> cp ./node_modules/diverged/src/diverged.js ./compare/output/ && cp ./node_modules/diff/dist/diff.js ./compare/output/ && webpack --config ./compare/webpack.config.js && npm run lint

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: Plugin/Preset files are not allowed to export objects, only functions. In /BackstopJS/node_modules/babel-preset-es2015/lib/index.js
    at createDescriptor (/BackstopJS/node_modules/@babel/core/lib/config/config-descriptors.js:159:11)
    at createDescriptor.next (<anonymous>)
    at step (/BackstopJS/node_modules/gensync/index.js:261:32)
    at /BackstopJS/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/BackstopJS/node_modules/gensync/index.js:223:11)

Node.js v20.8.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.