Skip to content

Commit 037ea2b

Browse files
authored
Merge pull request #91 from oslabs-beta/master
Spearmint 3.0
2 parents ba5da8c + 21d2845 commit 037ea2b

File tree

160 files changed

+6965
-3056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+6965
-3056
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": ["airbnb-typescript"],
3+
"parserOptions": {
4+
"project": "./tsconfig.json"
5+
},
6+
"rules": {
7+
"arrow-body-style": "off",
8+
"no-plusplus": "off",
9+
"no-param-reassign": "off"
10+
},
11+
"env": {
12+
"jest": true,
13+
"browser": true
14+
}
15+
}

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_js:
44
cache:
55
directories:
66
- node_modules
7-
deplloy:
7+
script:
8+
- npm test
9+
deploy:
810
skip_cleanup: true
9-
on: master
11+
on: master

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![](https://lh5.googleusercontent.com/5Gr2dZXHJdmIiASsPw9put-6mR20e4g1gOk-af4krREaJ7NqkZnqXLD5QgiotfNHYhGRh387HSqdhjRwxdwOvQzg9ChhfIrZz0FdxVu6gktBtG-sy1MX6Xq36Gmrzu_6G_K7LDQZ)
22

3-
Spearmint helps developers easily create functional React/Redux/Endpoint tests without writing any code. It dynamically converts user inputs into executable Jest test code by using DOM query selectors provided by @testing-library.
3+
Spearmint helps developers easily create functional React/Redux/Endpoint/Paint Timing tests without writing any code. It dynamically converts user inputs into executable Jest test code by using DOM query selectors provided by @testing-library.
44

55
## How to use
66

@@ -22,6 +22,10 @@ To run Endpoint tests generated by spearmint, install the following in your dev
2222

2323
npm i -D jest supertest
2424

25+
To run Puppeteer tests generated by spearmint, install the following in your dev dependencies.
26+
27+
npm i -D jest puppeteer
28+
2529
## How it works
2630

2731
1. On the initial screen, enter the URL of your project and load your application to start creating tests.
@@ -30,23 +34,27 @@ To run Endpoint tests generated by spearmint, install the following in your dev
3034

3135
2. Utilize our auto-complete, drop-down options, and tooltips features to easily create arrangement, action, and assertion test statements for React; reducer, action creator, asynchronous action creator, and middleware test statements for Redux; and hooks, context, and endpoint test statements.
3236

33-
![](https://lh5.googleusercontent.com/5VYUlGG5VDdZxdZEh5aokuilhKRp8B5QyVmxvtW_abLYCAzYN-s-el1oV5WMtGuTzbEO2I6l8Ys_yK2gC0fCi8ISHwjh4LlgezsrPWd7mDEtLbPqBYf1J4pgkGmfIV4yq4I_dpQg)
37+
![](/public/newReact.png?raw=true)
3438

3539
3. Refer to the browser view of your app that is displayed on the right to quickly identify values for your selectors and use the file directory to open up a code editor view to easily refer to your codebase for props information.
3640

3741
4. Spearmint will then convert user input to dynamically generate a test file that will be saved inside a **tests** folder, which you can use to run ‘npm test’ on.
3842

39-
![](https://lh4.googleusercontent.com/zE-ty31I22R7P9-ubFIb4ko6MOBb7r1-56cHX65h9AcF9IsE22RhPKMEdhyR0MJ3PbqNovj1uwxF2T5_klwZ2sWniXfCiXfaEysjQgH5NRskaDFNd-TOGce0oTMn2jPaPEGFHlEq)
43+
![](/public/testfile.png?raw=true)
4044

4145
## Team
4246

4347
> Alex [@apark0720](https://github.com/apark0720)  · 
48+
> Charlie [@charlie-maloney](https://github.com/charlie-maloney)  · 
4449
> Chloe [@HeyItsChloe](https://github.com/HeyItsChloe)  · 
4550
> Cornelius [@corneeltron](https://github.com/corneeltron)  · 
46-
> Dave [@davefranz](https://github.com/davefranz)  · 
47-
> Johnny [@johnny-lim](https://github.com/johnny-lim) <br />
51+
> Dave [@davefranz](https://github.com/davefranz) <br />
52+
> Johnny [@johnny-lim](https://github.com/johnny-lim) &nbsp;&middot;&nbsp;
4853
> Julie [@julicious100](https://github.com/julicious100) &nbsp;&middot;&nbsp;
4954
> Karen [@karenpinilla](https://github.com/karenpinilla) &nbsp;&middot;&nbsp;
5055
> Linda [@lcwish](https://github.com/lcwish) &nbsp;&middot;&nbsp;
56+
> Mike [@mbcoker](https://github.com/mbcoker) <br />
5157
> Natlyn [@natlynp](https://github.com/natlynp) &nbsp;&middot;&nbsp;
52-
> Rachel [@rachethecreator](https://github.com/rachethecreator)
58+
> Rachel [@rachethecreator](https://github.com/rachethecreator) &nbsp;&middot;&nbsp;
59+
> Sieun [@sieunjang](https://github.com/sieunjang) &nbsp;&middot;&nbsp;
60+
> Tristen [@twastell](https://github.com/twastell)

package.json

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
"homepage": "./",
1919
"private": true,
2020
"dependencies": {
21+
"@types/jest": "^25.2.3",
22+
"@types/react-beautiful-dnd": "^12.1.2",
23+
"@types/react-dom": "^16.9.8",
24+
"@types/react-modal": "^3.10.5",
25+
"classnames": "^2.2.6",
2126
"concurrently": "^4.1.2",
2227
"cross-env": "^5.2.1",
28+
"dotenv": "^8.2.0",
2329
"electron-is-dev": "^1.1.0",
30+
"fibers": "^5.0.0",
2431
"js-beautify": "^1.10.0",
2532
"monaco-editor": "^0.17.0",
2633
"node-sass": "^4.12.0",
@@ -30,23 +37,21 @@
3037
"react-dom": "^16.8.6",
3138
"react-modal": "^3.8.1",
3239
"react-monaco-editor": "^0.25.1",
33-
"react-scripts": "3.0.1",
34-
"typescript": "^3.5.1",
40+
"react-scripts": "3.4.1",
41+
"sass": "^1.26.5",
42+
"typescript": "^3.9.2",
3543
"wait-on": "^3.3.0"
3644
},
3745
"scripts": {
3846
"react-start": "react-scripts start",
39-
"react-build": "react-scripts build",
47+
"react-build": "NODE_ENV=production react-scripts build",
4048
"test": "react-scripts test --env=jsdom",
4149
"test:watch": "jest --watch",
4250
"react-eject": "react-scripts eject",
43-
"electron-build": "electron-builder -mwl",
51+
"electron-build": "NODE_ENV=production electron-builder -mwl",
4452
"release": "npm run react-build && electron-builder --publish=always",
45-
"build": "npm run react-build && npm run electron-build",
46-
"start": "concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
47-
},
48-
"eslintConfig": {
49-
"extends": "react-app"
53+
"build": "NODE_ENV=production npm run react-build && npm run electron-build",
54+
"start": "NODE_ENV=development concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
5055
},
5156
"browserslist": {
5257
"production": [
@@ -61,12 +66,22 @@
6166
]
6267
},
6368
"devDependencies": {
64-
"@testing-library/react": "^8.0.1",
69+
"@testing-library/jest-dom": "^5.8.0",
70+
"@testing-library/react": "^8.0.9",
6571
"@testing-library/react-hooks": "^3.2.1",
72+
"@types/jest": "^25.2.3",
73+
"@typescript-eslint/eslint-plugin": "^2.33.0",
74+
"@typescript-eslint/parser": "^2.33.0",
6675
"electron": "^5.0.3",
67-
"electron-builder": "^20.43.0",
76+
"electron-builder": "^22.6.1",
77+
"electron-devtools-installer": "^3.0.0",
6878
"enzyme": "^3.10.0",
6979
"enzyme-adapter-react-16": "^1.14.0",
80+
"eslint-config-airbnb-typescript": "^7.2.1",
81+
"eslint-plugin-import": "^2.20.2",
82+
"eslint-plugin-jsx-a11y": "^6.2.3",
83+
"eslint-plugin-react": "^7.20.0",
84+
"eslint-plugin-react-hooks": "^2.5.1",
7085
"jest-dom": "^3.5.0",
7186
"react-test-renderer": "^16.12.0",
7287
"spectron": "^5.0.0",

public/electron.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
require('dotenv').config()
12
const { app, BrowserWindow } = require('electron');
23
const path = require('path');
34
const isDev = require('electron-is-dev');
4-
55
let mainWindow;
6-
let testView;
76

7+
if (process.env.NODE_ENV === 'development') {
8+
const { default: installExtension, REACT_DEVELOPER_TOOLS } = require('electron-devtools-installer');
9+
function addDevTools() {
10+
app.whenReady().then(() => {
11+
installExtension(REACT_DEVELOPER_TOOLS)
12+
.then((name) => console.log(`Added Extension: ${name}`))
13+
.catch((err) => console.log('An error occurred: ', err));
14+
});
15+
};
16+
}
817
function createWindow() {
918
mainWindow = new BrowserWindow({
10-
width: 1400,
11-
minWidth: 1400,
19+
width: 1550,
1220
height: 750,
1321
minHeight: 750,
1422
icon: path.join(__dirname, 'public/icon.png'),
@@ -17,23 +25,24 @@ function createWindow() {
1725
webviewTag: true,
1826
},
1927
});
20-
2128
mainWindow.loadURL(
2229
isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`
2330
);
2431
mainWindow.on('closed', () => (mainWindow = null));
2532
}
2633

27-
app.on('ready', createWindow);
34+
if (process.env.NODE_ENV === 'development') {
35+
app.on('ready', addDevTools);
36+
}
2837

38+
app.on('ready', createWindow);
2939
app.on('window-all-closed', () => {
3040
if (process.platform !== 'darwin') {
3141
app.quit();
3242
}
3343
});
34-
3544
app.on('activate', () => {
3645
if (mainWindow === null) {
3746
createWindow();
3847
}
39-
});
48+
});

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
manifest.json provides metadata used when your web app is installed on a
1010
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1111
-->
12+
<script src="https://kit.fontawesome.com/3142614e38.js" crossorigin="anonymous"></script>
1213
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1314
<!--
1415
Notice the use of %PUBLIC_URL% in the tags above.

public/newReact.png

146 KB
Loading

public/testfile.png

226 KB
Loading

src/App.jsx

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
import React, { useReducer } from 'react';
22
import styles from './App.module.scss';
3-
import { GlobalContext, globalState, globalReducer } from './context/globalReducer';
4-
import { TestCaseContext, testCaseState, testCaseReducer } from './context/testCaseReducer';
3+
import { GlobalContext, globalState, globalReducer } from './context/reducers/globalReducer';
4+
import { ReactTestCaseContext, reactTestCaseState, reactTestCaseReducer } from './context/reducers/reactTestCaseReducer';
5+
import {
6+
PuppeteerTestCaseContext,
7+
puppeteerTestCaseState,
8+
puppeteerTestCaseReducer,
9+
} from './context/reducers/puppeteerTestCaseReducer';
510
import {
611
EndpointTestCaseContext,
712
endpointTestCaseState,
813
endpointTestCaseReducer,
9-
} from './context/endpointTestCaseReducer';
14+
} from './context/reducers/endpointTestCaseReducer';
1015
import {
1116
ReduxTestCaseContext,
1217
reduxTestCaseState,
1318
reduxTestCaseReducer,
14-
} from './context/reduxTestCaseReducer';
19+
} from './context/reducers/reduxTestCaseReducer';
1520
import {
1621
HooksTestCaseContext,
1722
hooksTestCaseState,
1823
hooksTestCaseReducer,
19-
} from './context/hooksTestCaseReducer';
24+
} from './context/reducers/hooksTestCaseReducer';
2025
import {
2126
TestFileModalContext,
2227
testFileModalState,
2328
testFileModalReducer,
24-
} from './context/testFileModalReducer';
29+
} from './context/reducers/testFileModalReducer';
2530

26-
import { MockDataContext, mockDataState, mockDataReducer } from './context/mockDataReducer';
27-
import ProjectLoader from './containers/ProjectLoader/ProjectLoader';
28-
import NavBar from './containers/NavBar/NavBar';
29-
import LeftPanel from './containers//LeftPanel/LeftPanel';
30-
import RightPanel from './containers/RightPanel/RightPanel';
31+
import { MockDataContext, mockDataState, mockDataReducer } from './context/reducers/mockDataReducer';
32+
import ProjectLoader from './pages/ProjectLoader/ProjectLoader';
33+
import NavBar from './components/NavBar/NavBar';
34+
import LeftPanel from './pages//LeftPanel/LeftPanel';
35+
import RightPanel from './pages/RightPanel/RightPanel';
3136

3237
const App = () => {
3338
const [global, dispatchToGlobal] = useReducer(globalReducer, globalState);
34-
const [testCase, dispatchToTestCase] = useReducer(testCaseReducer, testCaseState);
39+
const [reactTestCase, dispatchToReactTestCase] = useReducer(reactTestCaseReducer, reactTestCaseState);
3540
const [mockData, dispatchToMockData] = useReducer(mockDataReducer, mockDataState);
3641
const [endpointTestCase, dispatchToEndpointTestCase] = useReducer(
3742
endpointTestCaseReducer,
@@ -46,11 +51,16 @@ const App = () => {
4651
hooksTestCaseReducer,
4752
hooksTestCaseState
4853
);
54+
const [puppeteerTestCase, dispatchToPuppeteerTestCase] = useReducer(
55+
puppeteerTestCaseReducer,
56+
puppeteerTestCaseState
57+
);
4958
const [testFileModal, dispatchToTestFileModal] = useReducer(
5059
testFileModalReducer,
5160
testFileModalState
5261
);
5362

63+
5464
if (!global.isProjectLoaded) {
5565
return (
5666
<div>
@@ -73,25 +83,28 @@ const App = () => {
7383
*
7484
* We access the value that we gave to the Provider through useContext
7585
*/
76-
<div id={global.isFileDirectoryOpen ? styles.appGridOpen : styles.appGridClose}>
86+
<div id={global.isFileDirectoryOpen ?
87+
(global.isRightPanelOpen? styles.fileDirectoryOpenRightPanelOpen : styles.fileDirectoryOpenRightPanelClosed) :
88+
(global.isRightPanelOpen? styles.fileDirectoryClosedRightPanelOpen : styles.fileDirectoryClosedRightPanelClosed)
89+
}>
7790
<GlobalContext.Provider value={[global, dispatchToGlobal]}>
78-
<TestCaseContext.Provider value={[testCase, dispatchToTestCase]}>
79-
<ReduxTestCaseContext.Provider value={[reduxTestCase, dispatchToReduxTestCase]}>
80-
<EndpointTestCaseContext.Provider
81-
value={[endpointTestCase, dispatchToEndpointTestCase]}
82-
>
83-
<HooksTestCaseContext.Provider value={[hooksTestCase, dispatchToHooksTestCase]}>
84-
<TestFileModalContext.Provider value={[testFileModal, dispatchToTestFileModal]}>
85-
<MockDataContext.Provider value={[mockData, dispatchToMockData]}>
86-
<NavBar />
87-
<LeftPanel />
88-
</MockDataContext.Provider>
89-
</TestFileModalContext.Provider>
90-
</HooksTestCaseContext.Provider>
91-
</EndpointTestCaseContext.Provider>
92-
</ReduxTestCaseContext.Provider>
93-
</TestCaseContext.Provider>
94-
<RightPanel />
91+
<ReduxTestCaseContext.Provider value={[reduxTestCase, dispatchToReduxTestCase]}>
92+
<ReactTestCaseContext.Provider value={[reactTestCase, dispatchToReactTestCase]}>
93+
<EndpointTestCaseContext.Provider value={[endpointTestCase, dispatchToEndpointTestCase]}>
94+
<HooksTestCaseContext.Provider value={[hooksTestCase, dispatchToHooksTestCase]}>
95+
<TestFileModalContext.Provider value={[testFileModal, dispatchToTestFileModal]}>
96+
<MockDataContext.Provider value={[mockData, dispatchToMockData]}>
97+
<PuppeteerTestCaseContext.Provider value={[puppeteerTestCase, dispatchToPuppeteerTestCase]}>
98+
<NavBar />
99+
<LeftPanel />
100+
</PuppeteerTestCaseContext.Provider>
101+
</MockDataContext.Provider>
102+
</TestFileModalContext.Provider>
103+
</HooksTestCaseContext.Provider>
104+
</EndpointTestCaseContext.Provider>
105+
</ReactTestCaseContext.Provider>
106+
</ReduxTestCaseContext.Provider>
107+
{global.isRightPanelOpen ? <RightPanel /> : ''}
95108
</GlobalContext.Provider>
96109
</div>
97110
);

src/App.module.scss

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,40 @@
33
@import 'assets/stylesheets/fonts';
44
@import 'assets/stylesheets/colors';
55

6-
#appGridOpen {
6+
//file directory is open but right panel is closed
7+
#fileDirectoryOpenRightPanelClosed {
8+
display: grid;
9+
grid-template-columns: 280px auto;
10+
grid-template-rows: 100vh;
11+
grid-template-areas: 'navBar leftPanel';
12+
background-color: $light-gray3;
13+
}
14+
15+
//both open
16+
#fileDirectoryOpenRightPanelOpen {
717
display: grid;
818
grid-template-columns: 280px auto 40%;
919
grid-template-rows: 100vh;
1020
grid-template-areas: 'navBar leftPanel rightPanel';
1121
background-color: $light-gray3;
1222
}
1323

14-
#appGridClose {
24+
//file directory is closed but right panel is open
25+
#fileDirectoryClosedRightPanelOpen {
1526
display: grid;
1627
grid-template-columns: 48px auto 50%;
1728
grid-template-rows: 100vh;
1829
grid-template-areas: 'navBar leftPanel rightPanel';
1930
background-color: $light-gray3;
2031
}
32+
33+
//both closed
34+
#fileDirectoryClosedRightPanelClosed {
35+
display: grid;
36+
grid-template-columns: 48px auto;
37+
grid-template-rows: 100vh;
38+
grid-template-areas: 'navBar leftPanel';
39+
background-color: $light-gray3;
40+
}
41+
42+

0 commit comments

Comments
 (0)