Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

tests(visual): add Argos CI #130

Merged
merged 1 commit into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ packages/react-instantsearch/examples/*/node_modules/
docs/
docs-production/
dist/

# Happo visual regression build
test/.happo
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ npm-debug.log
*.iml
preview.zip
.happypack/

# Ignore Argos CI screenshots.
test/screenshots/

# Ignore Happo build.
test/.happo/
24 changes: 24 additions & 0 deletions .happo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require('path');
const FirefoxTarget = require('happo-target-firefox');

module.exports = {
snapshotsFolder: 'test/screenshots',
targets: [
new FirefoxTarget({
name: 'firefox',
sourceFiles: ['test/.happo/tests.js'],
stylesheets: [
'storybook/public/default.css',
'storybook/public/react-autosuggest.css',
'storybook/public/rheostat.css',
'storybook/public/util.css',
],
viewports: {
medium: {
width: 640,
height: 888,
},
},
}),
],
};
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ before_script:
branches:
only:
- master
addons:
firefox: 50.0
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
cache:
yarn: true
directories:
- node_modules
- packages/react-instantsearch/node_modules
- packages/react-instantsearch-theme-algolia/node_modules
env:
global:
- ARGOS_TOKEN=da82cbbe3add183c6adb18f5c61da515d9bf99dd
5 changes: 3 additions & 2 deletions docgen/assets/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function sidebarFollowScroll(sidebarContainer) {
sidebarContainer.style.top = null;
}
sidebarContainer.classList.add('fixed');
linksContainer.style.maxHeight = `calc(100vh - ${titleHeight + navHeight}px)`;
linksContainer.style.maxHeight = `calc(100vh - ${titleHeight +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been running yarn reformat.

Copy link
Contributor Author

@oliviertassinari oliviertassinari Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to do so on master, I will rebase if you need a less noisy PR.

navHeight}px)`;
} else {
sidebarContainer.classList.remove('fixed');
linksContainer.style.maxHeight = '';
Expand Down Expand Up @@ -78,7 +79,7 @@ function scrollSpy(sidebarContainer, headersContainer) {
// then we take the closest to this position as reference
.sort(
(header1, header2) =>
(Math.abs(header1.rect.top) < Math.abs(header2.rect.top) ? -1 : 1)
Math.abs(header1.rect.top) < Math.abs(header2.rect.top) ? -1 : 1
);

if (headers[0] && highestVisibleHeaders.length === 0) {
Expand Down
10 changes: 5 additions & 5 deletions docgen/plugins/jsdoc-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export default function() {
return function(files, metalsmith, done) {
const allFilles = Object.entries(files).reduce(
(memo, [filename, file]) =>
(/\.jsdoc$/.test(filename)
/\.jsdoc$/.test(filename)
? [...memo, { filename: filename.replace(/\.jsdoc$/, ''), ...file }]
: memo),
: memo,
[]
);

Expand Down Expand Up @@ -80,9 +80,9 @@ export default function() {
stats: fileFromMetalsmith && fileFromMetalsmith.stats,
filename: fileFromMetalsmith && fileFromMetalsmith.filename,
title,
mainTitle: `${data.kind
.charAt(0)
.toUpperCase()}${data.kind.slice(1)}s`, //
mainTitle: `${data.kind.charAt(0).toUpperCase()}${data.kind.slice(
1
)}s`, //
withHeadings: false,
layout: `${data.kind}.pug`,
category: data.kind,
Expand Down
4 changes: 2 additions & 2 deletions docgen/plugins/onlyChanged.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const cssFiles = join(__dirname, '../src/stylesheets/**/*');
const CSSEntryPoints = ['stylesheets/index.css', 'stylesheets/header.css'];

export const hasChanged = file =>
(file.stats && file.stats.ctime && file.stats.mtime
file.stats && file.stats.ctime && file.stats.mtime
? Date.parse(file.stats.ctime) > lastRunTime ||
Date.parse(file.stats.mtime) > lastRunTime
: true);
: true;

export default function onlyChanged(files, metalsmith, cb) {
if (lastRunTime === false) {
Expand Down
3 changes: 2 additions & 1 deletion docgen/plugins/webpackEntryMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default function webpackEntryMetadata(webpackConfig) {
const assets = Object.keys(webpackConfig.entry).reduce(
(memo, entryName) => ({
...memo,
[`${entryName}.js`]: `${webpackConfig.output.publicPath}${entryName}.js`,
[`${entryName}.js`]: `${webpackConfig.output
.publicPath}${entryName}.js`,
}),
{}
);
Expand Down
20 changes: 8 additions & 12 deletions docgen/src/examples/default-theme/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { withUrlSync } from '../urlSync';
import 'react-instantsearch-theme-algolia/style.scss';

const App = props => (
const App = props =>
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
Expand All @@ -34,10 +34,9 @@ const App = props => (
<Facets />
<CustomResults />
</div>
</InstantSearch>
);
</InstantSearch>;

const Header = () => (
const Header = () =>
<header className="content-wrapper header">
<a
href="https://community.algolia.com/react-instantsearch/"
Expand All @@ -49,10 +48,9 @@ const Header = () => (
/>
</a>
<SearchBox />
</header>
);
</header>;

const Facets = () => (
const Facets = () =>
<aside>

<ClearAll
Expand Down Expand Up @@ -83,15 +81,13 @@ const Facets = () => (
<div className="thank-you">
Data courtesy of <a href="http://www.ikea.com/">ikea.com</a>
</div>
</aside>
);
</aside>;

const SideBarSection = ({ title, children }) => (
const SideBarSection = ({ title, children }) =>
<section className="facet-wrapper">
<div className="facet-category-title facet">{title}</div>
{children}
</section>
);
</section>;

const Hit = ({ hit }) => {
const icons = [];
Expand Down
23 changes: 10 additions & 13 deletions docgen/src/examples/e-commerce-infinite/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function App() {
);
}

const Header = () => (
const Header = () =>
<header className="content-wrapper">
<a
href="https://community.algolia.com/react-instantsearch/"
Expand All @@ -52,10 +52,9 @@ const Header = () => (
</a>
<a href="./" className="logo">aeki</a>
<ConnectedSearchBox />
</header>
);
</header>;

const Facets = () => (
const Facets = () =>
<aside>

<ClearAll
Expand Down Expand Up @@ -101,10 +100,9 @@ const Facets = () => (
<div className="thank-you">
Data courtesy of <a href="http://www.ikea.com/">ikea.com</a>
</div>
</aside>
);
</aside>;

const CustomSearchBox = ({ currentRefinement, refine }) => (
const CustomSearchBox = ({ currentRefinement, refine }) =>
<div className="input-group">
<input
type="text"
Expand All @@ -119,8 +117,7 @@ const CustomSearchBox = ({ currentRefinement, refine }) => (
<i className="fa fa-search" />
</button>
</span>
</div>
);
</div>;

const ColorItem = ({ item, createURL, refine }) => {
const active = item.isRefined ? 'checked' : '';
Expand All @@ -138,19 +135,19 @@ const ColorItem = ({ item, createURL, refine }) => {
};

const CustomColorRefinementList = ({ items, refine, createURL }) =>
(items.length > 0
items.length > 0
? <div>
<h5 className={'ais-Panel__Title'}>Colors</h5>
{items.map(item => (
{items.map(item =>
<ColorItem
key={item.label}
item={item}
refine={refine}
createURL={createURL}
/>
))}
)}
</div>
: null);
: null;

function CustomHits({ hits, refine, hasMore }) {
const loadMoreButton = hasMore
Expand Down
28 changes: 12 additions & 16 deletions docgen/src/examples/e-commerce/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { withUrlSync } from '../urlSync';
import 'react-instantsearch-theme-algolia/style.scss';

const App = props => (
const App = props =>
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
Expand All @@ -39,10 +39,9 @@ const App = props => (
<Facets />
<CustomResults />
</div>
</InstantSearch>
);
</InstantSearch>;

const Header = () => (
const Header = () =>
<header className="content-wrapper">
<a
href="https://community.algolia.com/react-instantsearch"
Expand All @@ -55,10 +54,9 @@ const Header = () => (
</a>
<a href="./" className="logo">aeki</a>
<ConnectedSearchBox />
</header>
);
</header>;

const Facets = () => (
const Facets = () =>
<aside>

<ClearAll
Expand Down Expand Up @@ -104,10 +102,9 @@ const Facets = () => (
<div className="thank-you">
Data courtesy of <a href="http://www.ikea.com/">ikea.com</a>
</div>
</aside>
);
</aside>;

const CustomSearchBox = ({ currentRefinement, refine }) => (
const CustomSearchBox = ({ currentRefinement, refine }) =>
<div className="input-group">
<input
type="text"
Expand All @@ -122,8 +119,7 @@ const CustomSearchBox = ({ currentRefinement, refine }) => (
<i className="fa fa-search" />
</button>
</span>
</div>
);
</div>;

const ColorItem = ({ item, createURL, refine }) => {
const active = item.isRefined ? 'checked' : '';
Expand All @@ -141,19 +137,19 @@ const ColorItem = ({ item, createURL, refine }) => {
};

const CustomColorRefinementList = ({ items, refine, createURL }) =>
(items.length > 0
items.length > 0
? <div>
<h5 className={'ais-Panel__Title'}>Colors</h5>
{items.map(item => (
{items.map(item =>
<ColorItem
key={item.label}
item={item}
refine={refine}
createURL={createURL}
/>
))}
)}
</div>
: null);
: null;

function CustomHits({ hits }) {
return (
Expand Down
Loading