diff --git a/.eslintrc b/.eslintrc
index 97e17131..c1cd6772 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,7 +6,8 @@
"rules": {
"arrow-body-style": "off",
"no-plusplus": "off",
- "no-param-reassign": "off"
+ "no-param-reassign": "off",
+ "linebreak-style": "off"
},
"env": {
"jest": true,
diff --git a/.gitignore b/.gitignore
index 1dda36d4..754a1f13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
# production
/build
+/dist
# misc
.DS_Store
diff --git a/README.md b/README.md
index 40c5f1c5..6c5bee3b 100644
--- a/README.md
+++ b/README.md
@@ -2,80 +2,67 @@
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.
-# How to use
+# Installation
+Please download spearmint from our [website](https://www.spearmintjs.com/). Available for Mac OS, Windows and Linux.
-Download spearmint @ spearmintjs.com. Available for Mac OS and Windows.
-
+# How to use in development mode
-### React Testing
-
-To run React tests generated by spearmint, install the following in your dev dependencies.
+### For Mac developers
- npm i -D jest @testing-library/jest-dom @testing-library/react test-data-bot
+**Prerequisite**: Install Xcode
-To run Redux tests generated by spearmint, install the following in your dev dependencies, in addition to your React test installations above.
+First install
+1. Fork and clone this repository.
+2. ```npm run install-once```
+3. ```npm run start```
- npm i -D redux-mock-store redux-thunk fetch-mock
+***
-To run Hooks / Context tests generated by spearmint, install the following in your dev dependencies, in addition to your React test installations above.
+### For Windows developers
- npm i -D @testing-library/react-hooks
+**Prerequisite**: Install Python and Microsoft C++ Build Tools.
-
-
-### Endpoint Testing
-
-To run Endpoint tests generated by spearmint, install the following in your dev dependencies.
+In an Administrator PowerShell run the following commands:
+```choco install python visualcpp-build-tools -y```
+```npm config set msvs_version 2017```
+
+1. Fork and clone this repository.
+2. ```npm run install-once```
+3. ```npm run start-windows```
- npm i -D jest supertest
-### Puppeteer Testing
-
-To run Puppeteer tests generated by spearmint, install the following in your dev dependencies.
- npm i -D jest puppeteer
+# How it works
-
-
-### Accessiblity Testing
-
+1. On the initial screen, load your application to start creating tests.
-To run Accessibility tests generated by spearmint on HTML, install the following in your dev dependencies.
+![](/public/mainPage.png)
- npm i -D axe-core regenerator-runtime jest
+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.
-To run Accessibility tests generated by spearmint on React Components, install the following in your dev dependencies.
+![](/public/generateTest.png)
- npm i -D axe-core regenerator-runtime jest enzyme enzyme-adapter-react-16
+3. Spearmint will then convert user input to dynamically generate a test file, which you can click export icon on the left nav bar to automatically save the test file in the **\_\_tests\_\_** folder.
-To run Accessibility tests generated by spearmint on URL's with Puppeteer, install the following in your dev dependencies.
- npm i -D axe-core puppeteer
+4. Lastly click **Run Test** button and follow the guide and click what type of test you would like to perform.
+![](/public/runTest.png)
+5. Accessibility lens have been added in the app to give developers with different mismatches various options to interact with the app.
+![](/public/AccLens_Demo.gif)
-# How it works
-
-1. On the initial screen, enter the URL of your project and load your application to start creating tests.
-
-![](https://lh4.googleusercontent.com/CAFpoefRUUxgNosudQuc7gabSReFiI_puZ_WTjrzUSzB6pgOUdQ1babF2mxJql2lC8TQ-jjVLOgG5Qka8SUfF2fi-u2H9xSP7rZ_0Udpj-ISFPAY028UYKIUZcgOApnipVZwE7xh)
-
-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.
-
-![](/public/newReact.png?raw=true)
-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.
+# Demo
-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.
+![](/public/inapp-test-demo-run-test.gif)
-![](/public/testfile.png?raw=true)
-
-
+***
### The Spearmint Team
@@ -84,24 +71,28 @@ To run Accessibility tests generated by spearmint on URL's with Puppeteer, insta
> Alfred [@astaiglesia](https://github.com/astaiglesia) ·
> Annie [@annieshinn](https://github.com/annieshinn) ·
> Ben [@bkwak](https://github.com/bkwak) ·
-> Charlie [@charlie-maloney](https://github.com/charlie-maloney)
+> Charlie [@charlie-maloney](https://github.com/charlie-maloney) ·
> Chloe [@HeyItsChloe](https://github.com/HeyItsChloe) ·
> Cornelius [@corneeltron](https://github.com/corneeltron) ·
> Dave [@davefranz](https://github.com/davefranz) ·
-> Evan [@Berghoer](https://github.com/Berghoer) ·
-> Gabriel [@bielchristo](https://github.com/bielchristo)
+> Dieu [@dieunity](https://github.com/dieunity) ·
+> Evan [@Berghoer](https://github.com/Berghoer) ·
+> Gabriel [@bielchristo](https://github.com/bielchristo)
> Johnny [@johnny-lim](https://github.com/johnny-lim) ·
> Julie [@julicious100](https://github.com/julicious100) ·
-> Karen [@karenpinilla](https://github.com/karenpinilla) ·
+> Justin [@JIB3377](https://github.com/JIB3377) ·
+> Karen [@karenpinilla](https://github.com/karenpinilla) ·
> Linda [@lcwish](https://github.com/lcwish) ·
-> Luis [@Luis-KM-Lo](https://github.com/Luis-KM-Lo)
+> Luis [@Luis-KM-Lo](https://github.com/Luis-KM-Lo) ·
+> Max [@MaxWeisen](https://github.com/MaxWeisen) ·
> Mike [@mbcoker](https://github.com/mbcoker) ·
-> Natlyn [@natlynp](https://github.com/natlynp) ·
+> Mo [@mhmaidi789](https://github.com/mhmaidi789) ·
+> Natlyn [@natlynp](https://github.com/natlynp) ·
> Nick [@nicolaspita](https://github.com/nicolaspita) ·
> Rachel [@rachethecreator](https://github.com/rachethecreator) ·
-> Sean [@sean-haverstock](https://github.com/Sean-Haverstock)
-> Sharon [@sharon-zhu](https://github.com/sharon-zhu) ·
+> Sean [@sean-haverstock](https://github.com/Sean-Haverstock) ·
+> Sharon [@sharon-zhu](https://github.com/sharon-zhu) ·
> Sieun [@sieunjang](https://github.com/sieunjang) ·
> Tolan [@taoantaoan](https://github.com/taoantaoan) ·
-> Tristen [@twastell](https://github.com/twastell)
-
\ No newline at end of file
+> Tristen [@twastell](https://github.com/twastell)
+
diff --git a/config-overrides.js b/config-overrides.js
new file mode 100644
index 00000000..928a4aee
--- /dev/null
+++ b/config-overrides.js
@@ -0,0 +1,7 @@
+/* config-overrides.js */
+
+module.exports = function override(config, env) {
+ //do stuff with the webpack config...
+ config.target = 'electron-renderer';
+ return config;
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index 82b4b970..1c365a9b 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
{
"name": "spearmint",
- "version": "0.5.0",
+ "version": "0.6.0",
"description": "An open-source developer tool that simplifies testing and hopes to help increase awareness about web accessibility.",
- "author": "spearmintjs",
+ "author": "team spearmint",
"build": {
"appId": "com.spearmint",
"files": [
@@ -12,12 +12,24 @@
],
"directories": {
"buildResources": "build"
+ },
+ "linux": {
+ "target": [
+ "deb"
+ ],
+ "icon": "build/icon.*",
+ "maintainer": "Team Spearmint"
}
},
"main": "public/electron.js",
+ "bugs": {
+ "url": "https://github.com/oslabs-beta/spearmint_LA42/issues"
+ },
"homepage": "./",
"private": true,
"dependencies": {
+ "@material-ui/core": "^4.11.3",
+ "@material-ui/icons": "^4.11.2",
"@types/jest": "^25.2.3",
"@types/react-beautiful-dnd": "^12.1.2",
"@types/react-dom": "^16.9.8",
@@ -28,9 +40,10 @@
"dotenv": "^8.2.0",
"electron-is-dev": "^1.1.0",
"fibers": "^5.0.0",
+ "fix-path": "^3.0.0",
"js-beautify": "^1.10.0",
"monaco-editor": "^0.17.0",
- "node-sass": "^4.12.0",
+ "node-pty": "^0.10.0",
"react": "^16.8.6",
"react-autosuggest": "^9.4.3",
"react-beautiful-dnd": "^11.0.3",
@@ -38,23 +51,29 @@
"react-modal": "^3.8.1",
"react-monaco-editor": "^0.25.1",
"react-scripts": "^3.4.1",
- "sass": "^1.26.5",
+ "sass": "^1.32.11",
"typescript": "^3.9.2",
- "wait-on": "^3.3.0"
+ "wait-on": "^3.3.0",
+ "xterm": "^4.11.0",
+ "xterm-addon-fit": "^0.5.0",
+ "xterm-for-react": "^1.0.4"
},
"scripts": {
- "test": "react-scripts test --env=jsdom",
+ "install-once": "npm i && npm run electron-rebuild",
+ "test": "react-app-rewired test --env=jsdom",
"test:e2e": "./node_modules/mocha/bin/mocha src/__tests__/spec.e2e.js",
"test:integra": "mocha src/__tests__/spec.integra.js",
"test:watch": "jest --watch",
"react-start": "react-scripts start",
"react-eject": "react-scripts eject",
- "build": "NODE_ENV=production npm run react-build && npm run electron-build",
+ "build": "NODE_ENV=production react-app-rewired build && npm run electron-build",
"react-build": "NODE_ENV=production react-scripts build",
"electron-build": "NODE_ENV=production electron-builder -mwl",
+ "electron-rebuild": "electron-rebuild -f -w node-pty",
+ "postinstall": "electron-builder install-app-deps",
"release": "npm run react-build && electron-builder --publish=always",
- "start-windows": "SET NODE_ENV=development concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\"",
- "start": "NODE_ENV=development concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
+ "start-windows": "cross-env NODE_ENV=development concurrently \"cross-env BROWSER=none react-app-rewired start\" \"wait-on http://localhost:3000 && electron .\"",
+ "start": "NODE_ENV=development concurrently \"cross-env BROWSER=none react-app-rewired start\" \"wait-on http://localhost:3000 && electron .\""
},
"browserslist": {
"production": [
@@ -78,9 +97,10 @@
"@typescript-eslint/parser": "^2.33.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
- "electron": "^5.0.3",
+ "electron": "^12.0.5",
"electron-builder": "^22.6.1",
"electron-devtools-installer": "^3.0.0",
+ "electron-rebuild": "^2.3.5",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint-config-airbnb-typescript": "^7.2.1",
@@ -89,8 +109,9 @@
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^2.5.1",
"mocha": "^8.3.2",
+ "react-app-rewired": "^2.1.8",
"react-test-renderer": "^16.12.0",
"spectron": "^5.0.0",
"test-data-bot": "^0.8.0"
}
-}
+}
\ No newline at end of file
diff --git a/public/AccLens_Demo.gif b/public/AccLens_Demo.gif
new file mode 100644
index 00000000..ae8eb153
Binary files /dev/null and b/public/AccLens_Demo.gif differ
diff --git a/public/appDemo - Copy.gif b/public/appDemo - Copy.gif
deleted file mode 100644
index a123126c..00000000
Binary files a/public/appDemo - Copy.gif and /dev/null differ
diff --git a/public/electron.js b/public/electron.js
index e7accdd7..2e8f0fa4 100644
--- a/public/electron.js
+++ b/public/electron.js
@@ -1,52 +1,173 @@
-const { app, BrowserWindow } = require('electron');
-const path = require('path');
-const isDev = require('electron-is-dev');
-let mainWindow;
-
-if (isDev) console.log('electron version', process.versions.electron);
-
-if (isDev) {
- const {
- default: installExtension,
- REACT_DEVELOPER_TOOLS,
- } = require('electron-devtools-installer');
- function addDevTools() {
- app.whenReady().then(() => {
- installExtension(REACT_DEVELOPER_TOOLS)
- .then((name) => console.log(`Added Extension: ${name}`))
- .catch((err) => console.log('An error occurred: ', err));
- });
- }
-}
-function createWindow() {
- mainWindow = new BrowserWindow({
- width: 1550,
- height: 750,
- minHeight: 750,
- icon: path.join(__dirname, 'public/icon.png'),
- webPreferences: {
- nodeIntegration: true,
- webviewTag: true,
- },
- });
- mainWindow.loadURL(
- isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`
- );
- mainWindow.on('closed', () => (mainWindow = null));
-}
-
-if (isDev) {
- app.on('ready', addDevTools);
-}
-
-app.on('ready', createWindow);
-app.on('window-all-closed', () => {
- if (process.platform !== 'darwin') {
- app.quit();
- }
-});
-app.on('activate', () => {
- if (mainWindow === null) {
- createWindow();
- }
-});
+const {
+ app, BrowserWindow, ipcMain, dialog,
+} = require('electron');
+const path = require('path');
+const isDev = require('electron-is-dev');
+const fs = require('fs');
+const os = require('os');
+const pty = require('node-pty');
+const fixPath = require('fix-path');
+
+//Dynamic variable to change terminal type based on os
+const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
+console.log("process.env.Path1: ", process.env.PATH);
+//=> '/usr/bin'
+
+fixPath();
+
+console.log("process.env.Path2: ", process.env.PATH);
+//=> '/usr/local/bin:/usr/bin'
+let mainWindow;
+
+if (isDev) console.log('electron version', process.versions.electron);
+
+if (isDev) {
+ const {
+ default: installExtension,
+ REACT_DEVELOPER_TOOLS,
+ } = require('electron-devtools-installer');
+ function addDevTools() {
+ app.whenReady().then(() => {
+ installExtension(REACT_DEVELOPER_TOOLS)
+ .then((name) => console.log(`Added Extension: ${name}`))
+ .catch((err) => console.log('An error occurred: ', err));
+ });
+ }
+};
+
+function createWindow() {
+ mainWindow = new BrowserWindow({
+ width: 1550,
+ height: 750,
+ minHeight: 750,
+ icon: path.join(__dirname, 'icon.png'),
+ webPreferences: {
+ nodeIntegration: true,
+ webviewTag: true,
+ contextIsolation: false,
+ },
+ });
+ mainWindow.loadURL(
+ isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`,
+ );
+ mainWindow.on('closed', () => (mainWindow = null));
+
+ // PTY PROCESS FOR IN APP TERMINAL
+ const ptyArgs = {
+ name: 'xterm-color',
+ cols: 80,
+ rows: 80,
+ cwd: process.env.HOME,
+ env: process.env,
+ };
+ console.log("process.env.HOME: ", process.env.HOME);
+
+ const ptyProcess = pty.spawn(shell, [], ptyArgs);
+ // with ptyProcess, we want to send incoming data to the channel terminal.incData
+ ptyProcess.on('data', (data) => {
+ mainWindow.webContents.send('terminal.incData', data);
+ });
+ // in the main process, at terminal.toTerm channel, when data is received,
+ // main process will write to ptyProcess
+ ipcMain.on('terminal.toTerm', (event, data) => {
+ ptyProcess.write(data);
+ });
+}
+
+// EDITORVIEW.JSX SAVE FILE FUNCTIONALITY
+ipcMain.on('EditorView.saveFile', (e, filePath, editedText) => {
+ fs.writeFile(filePath, editedText, (err) => {
+ if (err) throw err;
+ });
+ // Return a success message upon save
+ e.returnValue = 'Changes Saved';
+});
+
+/*
+ EXPORTFILEMODAL.JSX FILE FUNCTIONALITY
+ (check existence and create folder)
+*/
+ipcMain.on('ExportFileModal.exists', (e, fileOrFolderPath) => {
+ e.returnValue = fs.existsSync(fileOrFolderPath, (err) => {
+ if (err) throw err;
+ });
+});
+
+ipcMain.on('ExportFileModal.mkdir', (e, folderPath) => {
+ e.returnValue = fs.mkdirSync(folderPath, (err) => {
+ if (err) throw err;
+ });
+});
+
+ipcMain.on('ExportFileModal.fileCreate', (e, filePath, file) => {
+ e.returnValue = fs.writeFile(filePath, file, (err) => {
+ if (err) throw err;
+ });
+});
+
+ipcMain.on('ExportFileModal.readFile', (e, filePath) => {
+ e.returnValue = fs.readFileSync(filePath, 'utf8', (err) => {
+ if (err) throw err;
+ });
+});
+
+// OPENFOLDERBUTTON.JSX FILE FUNCTIONALITY
+ipcMain.on('OpenFolderButton.isDirectory', (e, filePath) => {
+ e.returnValue = fs.statSync(filePath).isDirectory();
+});
+
+ipcMain.on('OpenFolderButton.dialog', (e) => {
+ const dialogOptions = {
+ properties: ['openDirectory', 'createDirectory'],
+ filters: [
+ { name: 'Javascript Files', extensions: ['js', 'jsx'] },
+ { name: 'Style', extensions: ['css'] },
+ { name: 'Html', extensions: ['html'] },
+ ],
+ message: 'Please select your project folder',
+ };
+ e.returnValue = dialog.showOpenDialogSync(dialogOptions);
+});
+
+/*
+UNIVERSAL IPC CALLS
+(The following IPC calls are made from various components in the codebase)
+*/
+ipcMain.on('Universal.stat', (e, filePath) => {
+ e.returnValue = fs.statSync(filePath).isDirectory();
+});
+
+ipcMain.on('Universal.readDir', (e, projectFilePath) => {
+ e.returnValue = fs.readdirSync(projectFilePath, (err) => {
+ if (err) throw err;
+ });
+});
+
+ipcMain.on('Universal.readFile', (e, filePath) => {
+ e.returnValue = fs.readFileSync(filePath, 'utf8', (err) => {
+ if (err) throw err;
+ });
+});
+
+ipcMain.on('Universal.path', (e, folderPath, filePath) => {
+ e.returnValue = path.relative(folderPath, filePath, (err) => {
+ if (err) throw err;
+ });
+})
+
+// ELECTRON BOILERPLATE FOR DEVTOOLS AND WINDOW CREATION
+if (isDev) {
+ app.on('ready', addDevTools);
+}
+
+app.on('ready', createWindow);
+app.on('window-all-closed', () => {
+ if (process.platform !== 'darwin') {
+ app.quit();
+ }
+});
+app.on('activate', () => {
+ if (mainWindow === null) {
+ createWindow();
+ }
+});
diff --git a/public/generateTest.png b/public/generateTest.png
new file mode 100644
index 00000000..5a6f60d7
Binary files /dev/null and b/public/generateTest.png differ
diff --git a/public/inapp-test-demo-run-test.gif b/public/inapp-test-demo-run-test.gif
new file mode 100644
index 00000000..93696d39
Binary files /dev/null and b/public/inapp-test-demo-run-test.gif differ
diff --git a/public/mainPage.png b/public/mainPage.png
new file mode 100644
index 00000000..6c27724a
Binary files /dev/null and b/public/mainPage.png differ
diff --git a/public/newReact.png b/public/newReact.png
deleted file mode 100644
index 114cb4ca..00000000
Binary files a/public/newReact.png and /dev/null differ
diff --git a/public/runTest.png b/public/runTest.png
new file mode 100644
index 00000000..328b77b5
Binary files /dev/null and b/public/runTest.png differ
diff --git a/public/testfile.png b/public/testfile.png
deleted file mode 100644
index 32e7655d..00000000
Binary files a/public/testfile.png and /dev/null differ
diff --git a/src/App.jsx b/src/App.jsx
index 3705bd11..94ff5124 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -3,7 +3,7 @@ import styles from './App.module.scss';
import { GlobalContext, globalState, globalReducer } from './context/reducers/globalReducer';
import ProjectLoader from './pages/ProjectLoader/ProjectLoader';
import NavBar from './components/NavBar/NavBar';
-import LeftPanel from './pages//LeftPanel/LeftPanel';
+import LeftPanel from './pages/LeftPanel/LeftPanel';
import RightPanel from './pages/RightPanel/RightPanel';
import About from './pages/About/About';
@@ -19,9 +19,9 @@ const App = () => {
);
- } else {
- return (
- /**
+ }
+ return (
+ /**
* Wrap the components that we want to share the unique states with.
* You can only provide one value to a Provider.
* - In order to avoid creating separate Contexts, wrap multiples in an array (ex: testCase and dispatchToTestCase).
@@ -33,36 +33,36 @@ const App = () => {
*
* We access the value that we gave to the Provider through useContext
*/
-
+
+
+ {/* Create config file only if title is react or hook */}
+
+
+
+
+ {/* Specify File to test */}
+
+ }
+ aria-controls="panel1a-content"
+ // id="panel1a-header"
+ id={styles.accordionSummary}
+ >
+ Specify file to test (optional)
+
+
+ {/* Select test to run */}
+
+
+
+
+
+
+
+
+ {/* Testing */}
+
+ }
+ aria-controls="panel1a-content"
+ // id="panel1a-header"
+ id={styles.accordionSummary}
+ >
+ Select and Run Tests
+
+
+ {/* Select test to run */}
+
+ {/* To do: make button toggle on/off */}
+
+
+
+ {`npx jest ${fileName}\n`}
+ {`npx jest --verbose ${fileName}\n`}
+ {`npx jest --coverage ${fileName}\n`}
+
+
+
+
+
+
+
+
+
+
+
);
diff --git a/src/components/Modals/modalHooks.js b/src/components/Modals/modalHooks.js
index 1812e033..d2b37b7c 100644
--- a/src/components/Modals/modalHooks.js
+++ b/src/components/Modals/modalHooks.js
@@ -36,82 +36,80 @@ export function useNewTest(dispatchToMockData, dispatchTestCase, createTest, clo
}
export function useGenerateScript(test, testType = null, puppeteerUrl = 'sample.io') {
- const [{ projectFilePath }] = useContext(GlobalContext);
+ const [{ projectFilePath }] = useContext(GlobalContext)
switch (test) {
case 'acc':
if (testType === 'html') {
return (
- `cd ${projectFilePath}
- npm i -D axe-core regenerator-runtime jest
- jest`
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D axe-core regenerator-runtime jest',
+ }
);
}
if (testType === 'react') {
return (
- `cd ${projectFilePath}
- npm i -D axe-core regenerator-runtime jest enzyme enzyme-adapter-react-16
- jest`
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D axe-core regenerator-runtime jest enzyme enzyme-adapter-react-16',
+ }
);
}
if (testType === 'puppeteer') {
return (
- `cd ${projectFilePath}
- npm i -D axe-core puppeteer
- node ${puppeteerUrl}
- `
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D axe-core puppeteer',
+ }
);
-
}
return 'error';
case 'react':
return (
- `cd ${projectFilePath}\n` +
- 'npm i -D @testing-library/jest-dom @testing-library/react test-data-bot jest\n' +
- 'npm run test'
+ {
+ cd: `cd ${projectFilePath}`,
+ install: `npm i -D @testing-library/jest-dom @testing-library/react test-data-bot jest`,
+ }
);
case 'redux':
return (
- `cd ${projectFilePath}\n` +
- 'npm i -D @testing-library/jest-dom @testing-library/react test-data-bot redux-mock-store redux-thunk fetch-mock node-fetch jest\n' +
- 'npm run test'
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D @testing-library/jest-dom @testing-library/react test-data-bot redux-mock-store redux-thunk fetch-mock node-fetch jest',
+ }
);
case 'hooks':
return (
- `cd ${projectFilePath}\n` +
- 'npm i -D @testing-library/jest-dom @testing-library/react test-data-bot @testing-library/react-hooks jest\n' +
- 'npm run test'
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D @testing-library/jest-dom @testing-library/react test-data-bot @testing-library/react-hooks jest',
+ }
);
case 'endpoint':
+ const endPointGuide = {
+ 1: `1. Please follow these steps to configure your files correctly. The tests will not run properly if you skip these steps.`,
+ 2: `2. Your server file MUST export your server object.`,
+ 3: `3. Comment out or remove the appropriate lines of code where the call to the server's listen method takes place.`,
+ 4: `4. If you are testing a route that involves querying a database, you must import the file where your database instance is created.`,
+ 5: `5. In that file, you must export your database instance object.`,
+ '5a': `5a. PostgreSQL: Pool, Client, or pg object.`,
+ '5b': `5b. MongoDB: MongoClient instance.`,
+ '5c': `5c. Mongoose: mongoose instance.`,
+ }
return (
- <>
-
- Please follow these steps to configure your files correctly. The tests will not run
- properly if you skip these steps!
-
- 1. Your server file MUST export your server object.
- 2. Comment out or remove the appropriate lines of code where the call to the
- server's listen method takes place
-
- Example
- 3. If your are testing a route that involves querying a database, you must
- import the file where your database instance is created.
-
-
- 4. In that file, you must export your database instance object
-
PostgreSQL: Pool, Client, or pg object
-
MongoDB: MongoClient instance
-
Mongoose: mongoose instance
-
- 5. Make sure to add "jest" to the test script in the package.json file.
-
-
- npm i -D jest supertest
-
- npm run test
- >
+ {
+ endPointGuide: endPointGuide,
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D jest supertest regenerator-runtime',
+ }
);
case 'puppeteer':
- return `cd ${projectFilePath}\nnpm i -D jest puppeteer\nnpm run test`;
+ return (
+ {
+ cd: `cd ${projectFilePath}`,
+ install: 'npm i -D puppeteer',
+ }
+ );
default:
return '';
// code block
diff --git a/src/components/NavBar/NavBar.jsx b/src/components/NavBar/NavBar.jsx
index b0c004fd..3eed01c6 100644
--- a/src/components/NavBar/NavBar.jsx
+++ b/src/components/NavBar/NavBar.jsx
@@ -20,13 +20,15 @@ import ExportFileModal from '../Modals/ExportFileModal';
const menuIcon = require('../../assets/images/menu.png');
const exportIcon = require('../../assets/images/file-export.png');
-const browserIcon = require('../../assets/images/google-chrome.png');
-const codeIcon = require('../../assets/images/visual-studio-code.png');
-const homeIcon = require('../../assets/images/home.png');
+// const browserIcon = require('../../assets/images/google-chrome.png');
+// const codeIcon = require('../../assets/images/visual-studio-code.png');
+// const homeIcon = require('../../assets/images/home.png');
const NavBar = ({ inAboutPage }) => {
const [
- { fileTree, isFileDirectoryOpen, projectUrl, rightPanelDisplay },
+ {
+ fileTree, isFileDirectoryOpen, projectUrl, rightPanelDisplay,
+ },
dispatchToGlobal,
] = useContext(GlobalContext);
const [isExportModalOpen, setIsExportModalOpen] = useState(false);
@@ -37,21 +39,21 @@ const NavBar = ({ inAboutPage }) => {
};
/* switches between code and browser view */
- const handleEditorToggle = () => {
- if (!inAboutPage) dispatchToGlobal(toggleRightPanel('codeEditorView'));
- };
+ // const handleEditorToggle = () => {
+ // if (!inAboutPage) dispatchToGlobal(toggleRightPanel('codeEditorView'));
+ // };
/* switches between code and browser view */
- const handleBrowserToggle = () => {
- if (inAboutPage) return;
- if (rightPanelDisplay === 'browserView' && projectUrl) {
- dispatchToGlobal(resetToProjectUrl());
- }
- if (!projectUrl) {
- dispatchToGlobal(setProjectUrl('https://google.com'));
- }
- dispatchToGlobal(toggleRightPanel('browserView'));
- };
+ // const handleBrowserToggle = () => {
+ // if (inAboutPage) return;
+ // if (rightPanelDisplay === 'browserView' && projectUrl) {
+ // dispatchToGlobal(resetToProjectUrl());
+ // }
+ // if (!projectUrl) {
+ // dispatchToGlobal(setProjectUrl('https://google.com'));
+ // }
+ // dispatchToGlobal(toggleRightPanel('browserView'));
+ // };
/* exports the file (when true) */
const openExportModal = () => {
@@ -60,19 +62,21 @@ const NavBar = ({ inAboutPage }) => {
};
/*returns to project loader screen */
- const handleClickHome = () => {
- dispatchToGlobal(loadProject(false));
- };
+ // const handleClickHome = () => {
+ // dispatchToGlobal(loadProject(false));
+ // };
/*
* renders: buttons + icons for navbar, exportFileModal, boxes to open new folder and enter url, file directory
*/
return (