-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests for examples #516
Open
macintoshhelper
wants to merge
18
commits into
airbnb:master
Choose a base branch
from
macintoshhelper:dev/e2e-example-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5ff6a22
create initial e2e test examples module
macintoshhelper d1218ec
export app components from examples for pure test imports
macintoshhelper 8d95bee
migrate emotion example to use @emotion/primitives + @emotion/core
macintoshhelper 2c11811
remove flow types from form validation TextBox component
macintoshhelper 78c3170
fix svg export for es2015 #515
macintoshhelper 863a2ed
add test:e2e:examples script to root package.json
macintoshhelper 9c0ce94
add e2e examples comment [ci skip]
macintoshhelper 91cd02c
undo import Svg fix attempt
macintoshhelper 5100750
Merge branch 'master' into dev/e2e-example-tests
macintoshhelper bd95ed3
downgrade @skpm/test-runner to fix e2e tests
macintoshhelper 3850931
use import alias to work with e2e tests
macintoshhelper fd830e3
add babel/webpack setup for e2e example tests
macintoshhelper 1981ae8
add e2e examples test
macintoshhelper 746b8e7
Merge branch 'dev/e2e-example-tests' of github.com:macintoshhelper/re…
macintoshhelper 31a6478
fix e2e examples webpack module alias
macintoshhelper 29779eb
migrate skpm webpack.config to __tests__/examples
macintoshhelper 38bb39c
add prepublishOnly script for installing/building e2e examples depend…
macintoshhelper 2bcf86c
re-use aggregate example App code/imports for e2e example
macintoshhelper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "example-tests", | ||
"version": "1.0.0", | ||
"description": "", | ||
"skpm": { | ||
"main": "example-tests.sketchplugin", | ||
"manifest": "src/manifest.json" | ||
}, | ||
"scripts": { | ||
"build": "../../node_modules/.bin/skpm-build", | ||
"watch": "../../node_modules/.bin/skpm-build --watch", | ||
"render": "../../node_modules/.bin/skpm-build --watch --run", | ||
"render:once": "../../node_modules/.bin/skpm-build --run", | ||
"postinstall": "npm run build && ../../node_modules/.bin/skpm-link" | ||
}, | ||
"author": "Macintosh Helper <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@emotion/core": "^10.0.28", | ||
"@emotion/primitives": "^10.0.30", | ||
"chroma-js": "^1.2.2", | ||
"emotion-primitives": "^1.0.0-beta.0", | ||
"ramda": "^0.27.0", | ||
"react-primitives": "^0.8.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from 'react'; | ||
import sketch from 'sketch'; | ||
import { render, Document, Page } from 'react-sketchapp'; | ||
|
||
import { Document as BasicSetup } from '../../../examples/basic-setup/src/my-command'; | ||
import { Document as BasicSvg } from '../../../examples/basic-svg/src/my-command'; | ||
import { Document as Colors } from '../../../examples/colors/src/main'; | ||
import { App as Emotion } from '../../../examples/emotion/src/my-command'; | ||
import { Page as FormValidation } from '../../../examples/form-validation/src/main'; | ||
|
||
import formValidationData from '../../../examples/form-validation/src/data'; | ||
|
||
const pages = [ | ||
{ | ||
component: BasicSetup, | ||
name: 'Basic Setup', | ||
data: { | ||
colors: { | ||
Haus: '#F3F4F4', | ||
Night: '#333', | ||
Sur: '#96DBE4', | ||
'Sur Dark': '#24828F', | ||
Peach: '#EFADA0', | ||
'Peach Dark': '#E37059', | ||
Pear: '#93DAAB', | ||
'Pear Dark': '#2E854B', | ||
}, | ||
}, | ||
}, | ||
{ | ||
component: BasicSvg, | ||
name: 'Basic Svg', | ||
}, | ||
{ | ||
component: Colors, | ||
name: 'Colors', | ||
data: { | ||
colors: ['#01FFD8', '#C137E3', '#8702ED'], | ||
steps: 50, | ||
}, | ||
}, | ||
{ | ||
component: Emotion, | ||
name: 'Emotion', | ||
}, | ||
{ | ||
component: FormValidation, | ||
name: 'Form Validation', | ||
data: { | ||
sessions: formValidationData, | ||
}, | ||
}, | ||
]; | ||
|
||
const App = () => ( | ||
<Document> | ||
{pages.map(({ name, component: Component, data }) => ( | ||
<Page key={name} name={name}> | ||
<Component {...data} /> | ||
</Page> | ||
))} | ||
</Document> | ||
); | ||
|
||
export default () => { | ||
// FIXME: Get this working with skpm-test instead for CLI / CI stdout feedback | ||
render(<App />, sketch.getSelectedDocument() || new sketch.Document()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compatibleVersion": 3, | ||
"bundleVersion": 1, | ||
"commands": [ | ||
{ | ||
"name": "react-sketchapp: Example Tests", | ||
"identifier": "main", | ||
"script": "./main.js" | ||
} | ||
], | ||
"menu": { | ||
"isRoot": true, | ||
"items": [ | ||
"main" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const path = require('path'); | ||
|
||
const aliasedModules = [ | ||
'chroma-js', | ||
'ramda', | ||
'react-primitives', | ||
'@emotion/primitives', | ||
'@emotion/core', | ||
]; | ||
|
||
module.exports = (config) => { | ||
config.resolve = { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
'react-sketchapp': path.resolve(__dirname, '../../'), | ||
|
||
...aliasedModules.reduce((acc, mod) => { | ||
acc[mod] = path.resolve(__dirname, `./node_modules/${mod}`); | ||
return acc; | ||
}, {}), | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
"test:unit": "jest --config jest.config.js --no-watchman", | ||
"test:ci": "npm run test:unit -- --runInBand", | ||
"test:e2e": "skpm-test", | ||
"test:e2e:examples": "npm run build --prefix __tests__/examples/", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
"test:update": "npm run test -- --updateSnapshot", | ||
"test:e2e:watch": "npm run test:e2e -- --watch", | ||
"watch": "run-s clean build:main && run-p \"build:main -- -w\" \"test:unit -- --watch\"" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we get this list from the package.json? Just to make sure nothing is missing