Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix e2e tests
  • Loading branch information
danreeves committed May 5, 2021
1 parent 10059e9 commit 4c1775c
Show file tree
Hide file tree
Showing 48 changed files with 96 additions and 39 deletions.
Empty file modified .babelrc 100644 → 100755
Empty file.
Empty file modified .editorconfig 100644 → 100755
Empty file.
Empty file modified .gitignore 100644 → 100755
Empty file.
Empty file modified .npmignore 100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions .travis.yml 100644 → 100755
@@ -1,13 +1,13 @@
language: node_js
node_js: "stable"
node_js: 'stable'
branches:
only:
- master

before_install:
- "stty cols 80"
- "export SAUCE_JOB=react-tether"
- "export SAUCE_BUILD=$TRAVIS_COMMIT"
- 'stty cols 80'
- 'export SAUCE_JOB=react-tether'
- 'export SAUCE_BUILD=$TRAVIS_COMMIT'

script:
- ./bin/test
Empty file modified CHANGELOG.md 100644 → 100755
Empty file.
Empty file modified LICENSE 100644 → 100755
Empty file.
Empty file modified README.md 100644 → 100755
Empty file.
Empty file modified dangerfile.js 100644 → 100755
Empty file.
Empty file modified example/components/body.js 100644 → 100755
Empty file.
Empty file modified example/components/code.js 100644 → 100755
Empty file.
Empty file modified example/components/demo.js 100644 → 100755
Empty file.
Empty file modified example/components/link.js 100644 → 100755
Empty file.
Empty file modified example/components/page-title.js 100644 → 100755
Empty file.
Empty file modified example/components/page.js 100644 → 100755
Empty file.
Empty file modified example/components/section.js 100644 → 100755
Empty file.
Empty file modified example/components/target.js 100644 → 100755
Empty file.
Empty file modified example/components/theme.js 100644 → 100755
Empty file.
Empty file modified example/components/tooltip.js 100644 → 100755
Empty file.
Empty file modified example/index.html 100644 → 100755
Empty file.
Empty file modified example/index.js 100644 → 100755
Empty file.
Empty file modified example/shuffle.js 100644 → 100755
Empty file.
Empty file modified example/tests/commonjs/index.html 100644 → 100755
Empty file.
17 changes: 13 additions & 4 deletions example/tests/commonjs/index.js 100644 → 100755
Expand Up @@ -6,10 +6,19 @@ function App() {
return (
<div>
<h1>CommonJS example</h1>
<ReactTether attachment="top left">
<span>Child 1</span>
<span>Child 2</span>
</ReactTether>
<ReactTether
attachment="top left"
renderTarget={ref => (
<span ref={ref} id="child-1">
Child 1
</span>
)}
renderElement={ref => (
<span ref={ref} id="child-2">
Child 2
</span>
)}
/>
</div>
);
}
Expand Down
Empty file modified example/tests/esm/index.html 100644 → 100755
Empty file.
17 changes: 13 additions & 4 deletions example/tests/esm/index.js 100644 → 100755
Expand Up @@ -6,10 +6,19 @@ function App() {
return (
<div>
<h1>ES Modules example</h1>
<ReactTether attachment="top left">
<span>Child 1</span>
<span>Child 2</span>
</ReactTether>
<ReactTether
attachment="top left"
renderTarget={ref => (
<span ref={ref} id="child-1">
Child 1
</span>
)}
renderElement={ref => (
<span ref={ref} id="child-2">
Child 2
</span>
)}
/>
</div>
);
}
Expand Down
Empty file modified example/tests/html-class-stability/index.css 100644 → 100755
Empty file.
Empty file modified example/tests/html-class-stability/index.html 100644 → 100755
Empty file.
Empty file modified example/tests/html-class-stability/index.js 100644 → 100755
Empty file.
Empty file modified example/tests/renderelementto/index.html 100644 → 100755
Empty file.
37 changes: 21 additions & 16 deletions example/tests/renderelementto/index.js 100644 → 100755
Expand Up @@ -18,16 +18,20 @@ function App() {
}}
>
<div>
<ReactTether attachment="top center" renderElementTo={badParent}>
<span>Target 1</span>
<span>Render to #bad-parent</span>
</ReactTether>
<ReactTether
attachment="top center"
renderElementTo={badParent}
renderTarget={ref => <span ref={ref}>Target 1</span>}
renderElement={ref => <span ref={ref}>Render to #bad-parent</span>}
/>
</div>
<div>
<ReactTether attachment="top center" renderElementTo={goodParent}>
<span>Target 1</span>
<span>Render to #good-parent</span>
</ReactTether>
<ReactTether
attachment="top center"
renderElementTo={goodParent}
renderTarget={ref => <span ref={ref}>Target 1</span>}
renderElement={ref => <span ref={ref}>Render to #good-parent</span>}
/>
</div>
</div>
<h2>fixing it with bodyElement</h2>
Expand All @@ -48,16 +52,17 @@ function App() {
attachment="top center"
renderElementTo={badParent}
bodyElement={badParent}
>
<span>Target 1</span>
<span>Render to #bad-parent</span>
</ReactTether>
renderTarget={ref => <span ref={ref}>Target 1</span>}
renderElement={ref => <span ref={ref}>Render to #bad-parent</span>}
/>
</div>
<div>
<ReactTether attachment="top center" renderElementTo={goodParent}>
<span>Target 1</span>
<span>Render to #good-parent</span>
</ReactTether>
<ReactTether
attachment="top center"
renderElementTo={goodParent}
renderTarget={ref => <span ref={ref}>Target 1</span>}
renderElement={ref => <span ref={ref}>Render to #good-parent</span>}
/>
</div>
</div>
</div>
Expand Down
Empty file modified example/tests/typescript/index.html 100644 → 100755
Empty file.
17 changes: 13 additions & 4 deletions example/tests/typescript/index.tsx 100644 → 100755
Expand Up @@ -6,10 +6,19 @@ function App() {
return (
<div>
<h1>TypeScript example</h1>
<ReactTether attachment="top left">
<span>Child 1</span>
<span>Child 2</span>
</ReactTether>
<ReactTether
attachment="top left"
renderTarget={ref => (
<span ref={ref} id="child-1">
Child 1
</span>
)}
renderElement={ref => (
<span ref={ref} id="child-2">
Child 2
</span>
)}
/>
</div>
);
}
Expand Down
Empty file modified example/tests/umd/index.html 100644 → 100755
Empty file.
17 changes: 13 additions & 4 deletions example/tests/umd/index.js 100644 → 100755
Expand Up @@ -6,10 +6,19 @@ function App() {
return (
<div>
<h1>UMD Modules example</h1>
<ReactTether attachment="top left">
<span>Child 1</span>
<span>Child 2</span>
</ReactTether>
<ReactTether
attachment="top left"
renderTarget={ref => (
<span ref={ref} id="child-1">
Child 1
</span>
)}
renderElement={ref => (
<span ref={ref} id="child-2">
Child 2
</span>
)}
/>
</div>
);
}
Expand Down
Empty file modified images/tether-demo.gif 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json 100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json 100644 → 100755
Expand Up @@ -10,10 +10,10 @@
"prebuild": "rm -rf dist && mkdir dist && rm -rf lib && mkdir lib",
"prepack": "npm run build",
"prepublishOnly": "npm run test",
"demo": "npm run build && parcel example/index.html",
"demo": "parcel example/index.html",
"demo:deploy": "./bin/build-demo",
"unit": "jest tests/unit",
"e2e": "testcafe chrome tests/e2e --app 'npm run demo'",
"e2e": "testcafe chrome tests/e2e --app \"npm run demo\"",
"e2e:full": "testcafe \"saucelabs:Chrome\",\"saucelabs:Firefox\",\"saucelabs:Safari\",\"saucelabs:MicrosoftEdge\" tests/e2e --app 'npm run demo'",
"test": "npm run lint && npm run typescript && npm run unit",
"tdd": "npm run unit -- --watch",
Expand Down
Empty file modified src/TetherComponent.jsx 100644 → 100755
Empty file.
Empty file modified src/react-tether.d.ts 100644 → 100755
Empty file.
Empty file modified src/react-tether.js 100644 → 100755
Empty file.
16 changes: 16 additions & 0 deletions tests/e2e/demo.js 100644 → 100755
Expand Up @@ -45,31 +45,47 @@ test(`It handles repositioning, constraints,
test('CommonJS example works', async t => {
const cjs = new Selector('#commonjs');
const app = new Selector('#app');
const target = new Selector('#child-1');
const element = new Selector('#child-2');
await t.navigateTo((await cjs.attributes).href);
await t.expect(await app.hasChildElements).ok();
await t.expect(await target.exists).ok();
await t.expect(await element.exists).ok();
await t.navigateTo(home);
});

test('ESM example works', async t => {
const esm = new Selector('#esm');
const app = new Selector('#app');
const target = new Selector('#child-1');
const element = new Selector('#child-2');
await t.navigateTo((await esm.attributes).href);
await t.expect(await app.hasChildElements).ok();
await t.expect(await target.exists).ok();
await t.expect(await element.exists).ok();
await t.navigateTo(home);
});

test('TypeScript example works', async t => {
const tsc = new Selector('#typescript');
const app = new Selector('#app');
const target = new Selector('#child-1');
const element = new Selector('#child-2');
await t.navigateTo((await tsc.attributes).href);
await t.expect(await app.hasChildElements).ok();
await t.expect(await target.exists).ok();
await t.expect(await element.exists).ok();
await t.navigateTo(home);
});

test('UMD distributable example works', async t => {
const tsc = new Selector('#umd');
const app = new Selector('#app');
const target = new Selector('#child-1');
const element = new Selector('#child-2');
await t.navigateTo((await tsc.attributes).href);
await t.expect(await app.hasChildElements).ok();
await t.expect(await target.exists).ok();
await t.expect(await element.exists).ok();
await t.navigateTo(home);
});
Empty file modified tests/jest-config.js 100644 → 100755
Empty file.
Empty file modified tests/unit/component.test.js 100644 → 100755
Empty file.
Empty file modified tests/unit/proptypes.test.js 100644 → 100755
Empty file.
Empty file modified tests/unit/public.test.js 100644 → 100755
Empty file.
Empty file modified tsconfig.json 100644 → 100755
Empty file.
Empty file modified webpack.config.js 100644 → 100755
Empty file.

0 comments on commit 4c1775c

Please sign in to comment.