Skip to content

Commit 295c1ae

Browse files
authored
Merge pull request #100 from oslabs-beta/main
Spearmint Version 5.0.0
2 parents 4804f86 + 7d4c38e commit 295c1ae

File tree

65 files changed

+2375
-560
lines changed

Some content is hidden

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

65 files changed

+2375
-560
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 spearmintjs
3+
Copyright (c) 2019-2021 spearmintjs
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
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

5-
## How to use
5+
# How to use
66

77
Download spearmint @ spearmintjs.com. Available for Mac OS and Windows.
88

9+
<br>
10+
11+
### React Testing
12+
<hr>
913
To run React tests generated by spearmint, install the following in your dev dependencies.
1014

1115
npm i -D jest @testing-library/jest-dom @testing-library/react test-data-bot
@@ -18,15 +22,44 @@ To run Hooks / Context tests generated by spearmint, install the following in yo
1822

1923
npm i -D @testing-library/react-hooks
2024

25+
<br>
26+
27+
### Endpoint Testing
28+
<hr>
2129
To run Endpoint tests generated by spearmint, install the following in your dev dependencies.
2230

2331
npm i -D jest supertest
2432

33+
<br>
34+
35+
### Puppeteer Testing
36+
<hr>
2537
To run Puppeteer tests generated by spearmint, install the following in your dev dependencies.
2638

2739
npm i -D jest puppeteer
2840

29-
## How it works
41+
42+
<br>
43+
44+
### Accessiblity Testing
45+
<hr>
46+
47+
To run Accessibility tests generated by spearmint on HTML, install the following in your dev dependencies.
48+
49+
npm i -D axe-core regenerator-runtime jest
50+
51+
To run Accessibility tests generated by spearmint on React Components, install the following in your dev dependencies.
52+
53+
npm i -D axe-core regenerator-runtime jest enzyme enzyme-adapter-react-16
54+
55+
To run Accessibility tests generated by spearmint on URL's with Puppeteer, install the following in your dev dependencies.
56+
57+
npm i -D axe-core puppeteer
58+
59+
60+
<br>
61+
62+
# How it works
3063

3164
1. On the initial screen, enter the URL of your project and load your application to start creating tests.
3265

@@ -42,24 +75,33 @@ To run Puppeteer tests generated by spearmint, install the following in your dev
4275

4376
![](/public/testfile.png?raw=true)
4477

45-
## Team
78+
<br>
79+
80+
### The Spearmint Team
81+
<hr>
4682

4783
> Alex [@apark0720](https://github.com/apark0720) &nbsp;&middot;&nbsp;
84+
> Alfred [@astaiglesia](https://github.com/astaiglesia) &nbsp;&middot;&nbsp;
85+
> Annie [@annieshinn](https://github.com/annieshinn) &nbsp;&middot;&nbsp;
4886
> Ben [@bkwak](https://github.com/bkwak) &nbsp;&middot;&nbsp;
49-
> Charlie [@charlie-maloney](https://github.com/charlie-maloney) &nbsp;&middot;&nbsp;
50-
> Chloe [@HeyItsChloe](https://github.com/HeyItsChloe) <br />
87+
> Charlie [@charlie-maloney](https://github.com/charlie-maloney) <br />
88+
> Chloe [@HeyItsChloe](https://github.com/HeyItsChloe) &nbsp;&middot;&nbsp;
5189
> Cornelius [@corneeltron](https://github.com/corneeltron) &nbsp;&middot;&nbsp;
5290
> Dave [@davefranz](https://github.com/davefranz) &nbsp;&middot;&nbsp;
5391
> Evan [@Berghoer](https://github.com/Berghoer) &nbsp;&middot;&nbsp;
54-
> Johnny [@johnny-lim](https://github.com/johnny-lim) <br />
92+
> Gabriel [@bielchristo](https://github.com/bielchristo) <br />
93+
> Johnny [@johnny-lim](https://github.com/johnny-lim) &nbsp;&middot;&nbsp;
5594
> Julie [@julicious100](https://github.com/julicious100) &nbsp;&middot;&nbsp;
5695
> Karen [@karenpinilla](https://github.com/karenpinilla) &nbsp;&middot;&nbsp;
5796
> Linda [@lcwish](https://github.com/lcwish) &nbsp;&middot;&nbsp;
5897
> Luis [@Luis-KM-Lo](https://github.com/Luis-KM-Lo) <br />
5998
> Mike [@mbcoker](https://github.com/mbcoker) &nbsp;&middot;&nbsp;
6099
> Natlyn [@natlynp](https://github.com/natlynp) &nbsp;&middot;&nbsp;
61100
> Nick [@nicolaspita](https://github.com/nicolaspita) &nbsp;&middot;&nbsp;
62-
> Rachel [@rachethecreator](https://github.com/rachethecreator) <br />
63-
> Sean [@sean-haverstock](https://github.com/Sean-Haverstock) &nbsp;&middot;&nbsp;
101+
> Rachel [@rachethecreator](https://github.com/rachethecreator) &nbsp;&middot;&nbsp;
102+
> Sean [@sean-haverstock](https://github.com/Sean-Haverstock) <br />
103+
> Sharon [@sharon-zhu](https://github.com/sharon-zhu) &nbsp;&middot;&nbsp;
64104
> Sieun [@sieunjang](https://github.com/sieunjang) &nbsp;&middot;&nbsp;
65-
> Tristen [@twastell](https://github.com/twastell)
105+
> Tolan [@taoantaoan](https://github.com/taoantaoan) &nbsp;&middot;&nbsp;
106+
> Tristen [@twastell](https://github.com/twastell) <br />
107+
<hr>

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "Spearmint",
3-
"version": "0.1.0",
4-
"description": "Spearmint",
2+
"name": "spearmint",
3+
"version": "0.5.0",
4+
"description": "An open-source developer tool that simplifies testing and hopes to help increase awareness about web accessibility.",
55
"author": "spearmintjs",
66
"build": {
77
"appId": "com.spearmint",
@@ -37,20 +37,23 @@
3737
"react-dom": "^16.8.6",
3838
"react-modal": "^3.8.1",
3939
"react-monaco-editor": "^0.25.1",
40-
"react-scripts": "3.4.1",
40+
"react-scripts": "^3.4.1",
4141
"sass": "^1.26.5",
4242
"typescript": "^3.9.2",
4343
"wait-on": "^3.3.0"
4444
},
4545
"scripts": {
46-
"react-start": "react-scripts start",
47-
"react-build": "NODE_ENV=production react-scripts build",
4846
"test": "react-scripts test --env=jsdom",
47+
"test:e2e": "./node_modules/mocha/bin/mocha src/__tests__/spec.e2e.js",
48+
"test:integra": "mocha src/__tests__/spec.integra.js",
4949
"test:watch": "jest --watch",
50+
"react-start": "react-scripts start",
5051
"react-eject": "react-scripts eject",
52+
"build": "NODE_ENV=production npm run react-build && npm run electron-build",
53+
"react-build": "NODE_ENV=production react-scripts build",
5154
"electron-build": "NODE_ENV=production electron-builder -mwl",
5255
"release": "npm run react-build && electron-builder --publish=always",
53-
"build": "NODE_ENV=production npm run react-build && npm run electron-build",
56+
"start-windows": "SET NODE_ENV=development concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\"",
5457
"start": "NODE_ENV=development concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
5558
},
5659
"browserslist": {
@@ -69,9 +72,12 @@
6972
"@testing-library/jest-dom": "^5.8.0",
7073
"@testing-library/react": "^8.0.9",
7174
"@testing-library/react-hooks": "^3.2.1",
75+
"@types/classnames": "^2.2.11",
7276
"@types/jest": "^25.2.3",
7377
"@typescript-eslint/eslint-plugin": "^2.33.0",
7478
"@typescript-eslint/parser": "^2.33.0",
79+
"chai": "^4.3.4",
80+
"chai-as-promised": "^7.1.1",
7581
"electron": "^5.0.3",
7682
"electron-builder": "^22.6.1",
7783
"electron-devtools-installer": "^3.0.0",
@@ -82,6 +88,7 @@
8288
"eslint-plugin-jsx-a11y": "^6.2.3",
8389
"eslint-plugin-react": "^7.20.0",
8490
"eslint-plugin-react-hooks": "^2.5.1",
91+
"mocha": "^8.3.2",
8592
"react-test-renderer": "^16.12.0",
8693
"spectron": "^5.0.0",
8794
"test-data-bot": "^0.8.0"

public/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
work correctly both with client-side routing and a non-root public URL.
2121
Learn how to configure a non-root public URL by running `npm run build`.
2222
-->
23-
<title>spearmint</title>
23+
<title>spearmint | testing, simplified</title>
2424
</head>
2525

2626
<body>
@@ -42,6 +42,5 @@
4242
return '/monaco-editor-worker-loader-proxy.js';
4343
},
4444
};
45-
// require(['vs/editor/editor.main'], function() {});
4645
</script>
4746
</html>

src/App.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import RightPanel from './pages/RightPanel/RightPanel';
88
import About from './pages/About/About';
99

1010
const App = () => {
11-
// useReducer takes a reducer and initial state as
12-
// args and return the current state paired with a dispatch method
13-
// distpatchTo method invokes associated reducer function
14-
1511
const [global, dispatchToGlobal] = useReducer(globalReducer, globalState);
1612

1713
if (!global.isProjectLoaded) {

src/__tests__/globalReducer.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ describe('Global Reducer works properly', () => {
179179
});
180180
});
181181

182-
it('should handle UPDATE_FILE_SHOW', () => {
183-
let action = { type: 'UPDATE_FILE_SHOW', testString: '' };
182+
it('should handle UPDATE_FILE', () => {
183+
let action = { type: 'UPDATE_FILE', testString: '' };
184184
expect(globalReducer(initialState, action)).toEqual({
185185
...initialState,
186186
file: '',
187187
});
188188
action = {
189-
type: 'UPDATE_FILE_SHOW',
189+
type: 'UPDATE_FILE',
190190
testString: `import React from "react";
191191
import { render, fireEvent } from '@testing-library/react';
192192
import '@testing-library/jest-dom/extend-expect`,

src/__tests__/spec.e2e.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const Application = require('spectron').Application;
2+
const path = require('path');
3+
const chai = require('chai');
4+
const chaiAsPromised = require('chai-as-promised');
5+
6+
// specifies the path of the application to launch
7+
const electronPath = require('electron');
8+
9+
// tell spectron to look and use the main.js file + package.json located 2 levels above
10+
const appPath = path.join(__dirname, '../..');
11+
12+
13+
// instantiates the spearmint application given the optional paramaters of the Application API
14+
const app = new Application({
15+
path: electronPath, // string path to the Electron application executable to launch
16+
args: [appPath], // array of paths to find the executable files and package.json
17+
});
18+
19+
// define the use of chai and chai as promised packages
20+
global.before(function () {
21+
chai.should();
22+
chai.use(chaiAsPromised);
23+
});
24+
25+
describe('Application Accessibility Audit', function () {
26+
this.timeout(10000);
27+
28+
beforeEach(function () {
29+
return app.start();
30+
});
31+
32+
afterEach(function () {
33+
if (app && app.isRunning()) {
34+
return app.stop();
35+
}
36+
});
37+
38+
it('Audits Accessibility', function (done) {
39+
app.client.auditAccessibility().then(function (audit) {
40+
if (audit.failed) {
41+
console.error('Please address the following accessibility issues in your application: \n', audit.results)
42+
}
43+
else {
44+
console.log('No accessibility issues have been found.')
45+
}
46+
done()
47+
})
48+
});
49+
});

src/__tests__/spec.integra.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const Application = require('spectron').Application;
2+
const path = require('path');
3+
const assert = require('assert');
4+
5+
// specifies the path of the application to launch
6+
const electronPath = require('electron');
7+
8+
// tell spectron to look and use the main.js file + package.json located 2 levels above
9+
const appPath = path.join(__dirname, '../..');
10+
11+
// instantiates the spearmint application given the optional paramaters of the Application API
12+
const app = new Application({
13+
path: electronPath, // string path to the Electron application executable to launch
14+
args: [appPath], // array of paths to find the executable files and package.json
15+
});
16+
17+
18+
describe('Application Accessibility Audit', function () {
19+
this.timeout(10000);
20+
21+
beforeEach(function () {
22+
return app.start();
23+
});
24+
25+
afterEach(function () {
26+
if (app && app.isRunning()) {
27+
return app.stop();
28+
}
29+
});
30+
31+
it('Audits Accessibility', function () {
32+
return app.client.auditAccessibility().then(function (audit) {
33+
if (audit.failed) {
34+
console.error('Please address the following accessibility issues in your application: \n', audit.results)
35+
}
36+
else {
37+
console.log('No accessibility issues have been found.')
38+
}
39+
})
40+
});
41+
});
147 KB
Loading

0 commit comments

Comments
 (0)