nathanmarks / vrtest

MIT License
14 stars 3 forks source link

Can we use this lib with react-scripts without ejecting? #7

Open nicgirault opened 6 years ago

nicgirault commented 6 years ago

My challenge right now is to use this lib within my react app (that is using react-scripts without ejecting).

I would love to be able to write something like this:

title.js

import React from 'react'

export default function Title ({ text }) {
  return <h1>{text}</h1>
}

title.vrtest.js

import React from 'react'
import Title from './title'

export default function TitleExample () {
  return <Title text='This is a title' />
}

vrtest.config.js

const path = require('path');

module.exports = {
  tests: 'src/**/*.vrtest.js',
  storage: {
    baseline: path.resolve(__dirname, './screenshots/reference'),
    output: path.resolve(__dirname, './screenshots/output'),
  },
  selenium: {
    server: 'http://hub-cloud.browserstack.com/wd/hub',
  },
  profiles: [
    {
      name: 'chrome',
      desiredCapabilities: {
        'browserName' : 'Chrome',
        'browser_version' : '62.0',
        'os' : 'Windows',
        'os_version' : '10',
        'resolution' : '1024x768',
        'browserstack.user' : 'xxx',
        'browserstack.key' : 'xxx'
       },
    },
  ],
};

I guess it would mean to have an internal webpack config and this might not be a good idea since it can generate differences between the way to build the app on production and in test env. What do you think about it?

nathanmarks commented 6 years ago

Ok, so kind of like how react storybook provides a config out of the box that you can extend?