Skip to content

Commit

Permalink
Squashed:
Browse files Browse the repository at this point in the history
* bump react to >16.8 to use hooks
* add ability to debug using a sample report
* bump react-dom to same version as react
* require trailing slashes on URLs
* stop page from complaining about missing manifest.json
* add explicit versions
* remove useless imports
* fix jsdoc type
* fix jsdoc param
* Silence loud chrome warnings in the devtools console by switching our
  fontawesome CDN tag to a crossorigin-friendly tag
* First fully working commit, still needs cleanup and passing tests.
* package.json: add lodash for uncomplicated comparison and slicing of
  state (and using module import so as to not bloat production bundle)
* .eslintrc.json: Make eslint allow comments up to 120 characters for
  e.g. JSDoc examples and web links
* AssertionPane.js: export aphrodite CSS for reuse
* CenterPane.jsx: rewrite of GetCenterPane function in reportUtils.js
* state.js: major revamp of UI state management
* passing unit tests on local PC, need to combine boilerplate from
  testsuites into a central place
* finishing component unit tests
* remove optional dependencies and upgrade react-hooks-testing-library
  to the non-deprecated version @testing-library/react-hooks
* switch to redux to avoid unstable_observedBits log messages
  • Loading branch information
dcm committed Jun 28, 2020
1 parent 10bd5af commit 0669a3f
Show file tree
Hide file tree
Showing 142 changed files with 13,181 additions and 4,648 deletions.
4 changes: 4 additions & 0 deletions testplan/web_ui/testing/.env
@@ -0,0 +1,4 @@
EXTEND_ESLINT=true
# make 'serve' skip checking its servers for updates
# see: node_modules/serve/bin/serve.js:365
NO_UPDATE_CHECK=1
5 changes: 5 additions & 0 deletions testplan/web_ui/testing/.env.production
@@ -0,0 +1,5 @@
#REACT_APP_THREAD=thread
#REACT_APP_THREADJS=thread.js
#REACT_APP_RELTHREAD=./thread
#REACT_APP_USE_THREAD=1
#EXTEND_ESLINT=1
2 changes: 2 additions & 0 deletions testplan/web_ui/testing/.env.test
@@ -0,0 +1,2 @@
SKIP_PREFLIGHT_CHECK=true
BROWSER=none
5 changes: 2 additions & 3 deletions testplan/web_ui/testing/.eslintignore
@@ -1,4 +1,3 @@
__tests__
__snapshots__
sampleReports.js
fakeReport.js
/build/
/node_modules/*
81 changes: 60 additions & 21 deletions testplan/web_ui/testing/.eslintrc.json
@@ -1,21 +1,42 @@
{
"env": {
"browser": 2,
"es6": 2,
"node": 2,
"commonjs": 2
"browser": true,
"es6": true,
"commonjs": true
},
"extends": [
"react-app"
],
"overrides": [
{
"files": [
"*.test.js",
"*.test.jsx",
"*.test.ts",
"*.test.tsx",
"./src/setupTests.js",
"./jest-puppeteer.config.js"
],
"env": {
"jest": true,
"node": true
},
"globals": {
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
}
}
],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": 2,
"jsx": 2,
"arrowFunctions": 2,
"classes": 2,
"modules": 2,
"defaultParams": 2
"experimentalObjectRestSpread": true,
"jsx": true,
"arrowFunctions": true,
"classes": true,
"modules": true,
"defaultParams": true
},
"sourceType": "module"
},
Expand All @@ -24,27 +45,45 @@
"react"
],
"rules": {
"max-len": ["error", { "code": 80 }],
"max-len": [
"error",
{
"code": 80,
"comments": 120
}
],
"linebreak-style": [
"error",
"unix"
],
"semi": ["error", "always"],
"semi": [
"error",
"always"
],
"no-const-assign": 2,
"no-dupe-class-members": 2,
"no-duplicate-case": 2,
"no-extra-parens": [2, "functions"],
"no-extra-parens": [
2,
"functions"
],
"no-self-compare": 2,
"accessor-pairs": 2,
"comma-spacing": [2, {
"before": false,
"after": true
}],
"comma-spacing": [
2,
{
"before": false,
"after": true
}
],
"constructor-super": 2,
"new-cap": [2, {
"newIsCap": true,
"capIsNew": false
}],
"new-cap": [
2,
{
"newIsCap": true,
"capIsNew": false
}
],
"new-parens": 2,
"no-array-constructor": 2,
"no-class-assign": 2,
Expand Down
6 changes: 6 additions & 0 deletions testplan/web_ui/testing/.gitignore
@@ -0,0 +1,6 @@
node_modules/
.env.local
.env.production.local
.env.development.local
yarn-error.log
/build/
14 changes: 14 additions & 0 deletions testplan/web_ui/testing/DEVELOPMENT.md
@@ -0,0 +1,14 @@
# Testplan Web UI

- Recommended Development Setup
* [IntelliJ-based IDEs](#intellij-based-ides)
* [VSCode](#vscode)


#### IntelliJ-based IDEs

TODO

### VSCode

TODO
5 changes: 5 additions & 0 deletions testplan/web_ui/testing/README.md
@@ -0,0 +1,5 @@
# Web UI

- [Recommended development setup](DEVELOPMENT.md)
- [Report fetch](src/Report/BatchReport/state/reportWorker)
-
40 changes: 40 additions & 0 deletions testplan/web_ui/testing/jest-puppeteer.config.js
@@ -0,0 +1,40 @@
const
{ dirname, resolve, delimiter } = require('path'),
{ appPackageJson, appNodeModules } = require('react-scripts/config/paths'),
{ getServers } = require('jest-dev-server'),
{ env: { PATH, SKIP_BUILD, CI, HEADLESS }, execPath } = process,
// serve production build for puppeteer integration tests
{ scripts: { build, serve } } = require(appPackageJson),
isSkipBuild = !!JSON.parse(SKIP_BUILD || '0'),
isHeadless = !!JSON.parse(CI || '0') && !!JSON.parse(HEADLESS || '1');

module.exports = {
// see github.com/smooth-code/jest-puppeteer/issues/120#issuecomment-464185653
launch: {
dumpio: true,
...(isHeadless ? {} : { headless: false, devtools: true }),
},
server: {
debug: true,
proto: 'http',
host: '127.0.0.1',
port: 5000,
usedPortAction: 'error',
launchTimeout: 1000 * 60 * 5,
command: (isSkipBuild ? '' : `${build} && `) + serve,
options: {
env: {
PATH: [
dirname(execPath),
resolve(appNodeModules, '.bin'),
PATH
].join(delimiter),
},
windowsVerbatimArguments: true,
},
},
getOrigin() {
return `${this.server.proto}://${this.server.host}:${this.server.port}`;
},
getProcesses: getServers,
};
76 changes: 67 additions & 9 deletions testplan/web_ui/testing/package.json
Expand Up @@ -4,44 +4,62 @@
"private": true,
"resolutions": {
"@babel/preset-env": "^7.8.7",
"watchpack": "1.6.1"
"watchpack": "1.6.1",
"immer": "^6.0.0"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "1.2.2",
"@fortawesome/free-solid-svg-icons": "5.2.0",
"@fortawesome/react-fontawesome": "0.1.3",
"@reduxjs/toolkit": "^1.3.4",
"ag-grid-community": "^21.2.1",
"ag-grid-react": "^21.2.1",
"aphrodite": "2.2.3",
"axios": "0.19.0",
"bootstrap": "4.3.1",
"eslint-plugin-react": "^7.14.3",
"react": "16.6.0",
"history": "^4.10.1",
"lodash": "^4.17.15",
"prop-types": "^15.7.2",
"react": "~16.12.0",
"react-copy-html-to-clipboard": "6.0.4",
"react-custom-scrollbars": "4.2.1",
"react-dom": "16.6.0",
"react-dom": "~16.12.0",
"react-portal-tooltip": "2.4.0",
"react-redux": "^7.2.0",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-scripts": "^3.4.0",
"react-spinners": "^0.6.0",
"react-syntax-highlighter": "^11.0.2",
"react-test-renderer": "16.6.0",
"react-vis": "^1.11.7",
"reactstrap": "6.3.0"
"reactstrap": "6.3.0",
"redux": "^4.0.5"
},
"devDependencies": {
"@testing-library/dom": "^6.12.2",
"@testing-library/jest-dom": "^4.0.0",
"@testing-library/react": "^9.3.2",
"enzyme": "3.7.0",
"enzyme-adapter-react-16": "1.6.0",
"enzyme-to-json": "^3.3.5",
"expect-puppeteer": "^4.4.0",
"jest": "^24.9.0",
"jest-dev-server": "^4.4.0",
"jest-environment-node": "^25.3.0",
"jest-environment-puppeteer": "^4.4.0",
"jest-puppeteer": "^4.4.0",
"moxios": "0.4.0",
"npm-force-resolutions": "0.0.3"
"puppeteer": "^2.0.0",
"serve": "^11.0.0"
},
"scripts": {
"serve": "serve -d -s -l 5000 build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "eslint --ext .js src",
"lint:fix": "eslint --ext .js src --fix",
"lint": "eslint --ext .js --ext .jsx src",
"lint:fix": "eslint --ext .js --ext .jsx src --fix",
"eject": "react-scripts eject"
},
"homepage": "/",
Expand All @@ -58,9 +76,49 @@
]
},
"jest": {
"globalSetup": "jest-environment-puppeteer/setup",
"globalTeardown": "jest-environment-puppeteer/teardown",
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
},
"proxy": "http://localhost:4000"
"optionalDependencies": {
"@babel/cli": "^7.4.4",
"@babel/node": "^7.5.0",
"@babel/register": "^7.9.0",
"@types/bootstrap": "^3.3.37",
"@types/cheerio": "^0.22.11",
"@types/enzyme": "^3.1.16",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/enzyme-to-json": "^1.5.1",
"@types/expect-puppeteer": "^3.3.1",
"@types/history": "^4.7.5",
"@types/jest": "^24.9.0",
"@types/jest-environment-puppeteer": "^4.3.1",
"@types/jquery": "^3.3.32",
"@types/lodash": "^4.14.149",
"@types/node": "^13.11.0",
"@types/prop-types": "^15.7.3",
"@types/puppeteer": "^2.0.1",
"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.5",
"@types/react-redux": "^7.1.0",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"@types/react-syntax-highlighter": "^11.0.2",
"@types/react-test-renderer": "^16.0.2",
"@types/reactstrap": "^8.0.1",
"@types/sizzle": "^2.3.2",
"@types/testing-library__dom": "^6.12.0",
"@types/testing-library__react": "^9.1.2",
"@types/webpack-dev-server": "^3.9.0",
"@types/webpack-env": "^1.14.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^6.8.0",
"qs": "^6.9.1",
"react-devtools": "^3.6.1",
"redux-mock-store": "^1.5.3",
"typescript": "^3.8.3"
}
}
11 changes: 9 additions & 2 deletions testplan/web_ui/testing/public/index.html
Expand Up @@ -4,9 +4,16 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/testplan-logo.png">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"
rel="stylesheet"
integrity="sha384-X7L1bhgb36bF1iFvaqvhgpaGpayKM+vXNNYRlF89BFA5s3vi1qZ8EX9086RlZjy1"
crossorigin="anonymous">
<% if(process.env.NODE_ENV !== 'production') { %>
<% if(process.env.REACT_APP_DEVTOOLS) { %>
<script src="http://localhost:8097/"></script>
<% } %>
<% } %>
<title>Testplan</title>
</head>
<body style="overflow: hidden">
Expand Down
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import {css, StyleSheet} from 'aphrodite';
import {CardHeader, Tooltip} from 'reactstrap';
import {library} from '@fortawesome/fontawesome-svg-core';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome/index.es';
import {faLayerGroup} from '@fortawesome/free-solid-svg-icons';

library.add(faLayerGroup);
Expand Down
4 changes: 2 additions & 2 deletions testplan/web_ui/testing/src/AssertionPane/AssertionPane.js
Expand Up @@ -2,7 +2,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {css, StyleSheet} from 'aphrodite';
import {library} from '@fortawesome/fontawesome-svg-core';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome/index.es';
import {
faMinusCircle,
faPlusCircle,
Expand Down Expand Up @@ -157,7 +157,7 @@ AssertionPane.propTypes = {
descriptionEntries: PropTypes.arrayOf(PropTypes.string),
};

const styles = StyleSheet.create({
export const styles = StyleSheet.create({
icon: {
margin: '0rem .75rem 0rem 0rem',
cursor: 'pointer',
Expand Down
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {Button, ButtonGroup} from 'reactstrap';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome/index.es';
import {library} from '@fortawesome/fontawesome-svg-core';
import {
faSortAmountUp,
Expand Down Expand Up @@ -159,4 +159,4 @@ DictButtonGroup.propTypes = {
};


export default DictButtonGroup;
export default DictButtonGroup;

0 comments on commit 0669a3f

Please sign in to comment.