Skip to content

Commit

Permalink
Introducing E2E tests
Browse files Browse the repository at this point in the history
Fixes #43
  • Loading branch information
sebinsua committed Aug 19, 2020
1 parent b2c47ea commit 1fd6cb2
Show file tree
Hide file tree
Showing 13 changed files with 5,036 additions and 93 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -62,9 +61,42 @@ jobs:
key: v2-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v2-${{ runner.os }}-yarn-
- run: yarn
- run: yarn test
- name: Install examples dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --cwd examples/app-host install
test_e2e:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: v2-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v2-${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
- name: Run E2E tests
uses: ianwalter/[email protected]
with:
args: yarn e2e --forceExit
env:
CI: "true"
37 changes: 37 additions & 0 deletions e2e-tests/TestApp.test-tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from 'react';
import logo from './logo.svg';
import './App.css';

import widgets from './widgets';

function App(): JSX.Element {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<div data-testid="widgets">
<React.Suspense fallback={null}>
{Object.keys(widgets).length > 0
? Object.entries(widgets).map(([widgetName, Widget]) => (
<Widget key={widgetName} />
))
: 'No widgets found...'}
</React.Suspense>
</div>
</div>
);
}

export default App;
Loading

0 comments on commit 1fd6cb2

Please sign in to comment.