Skip to content

Commit 2a6960d

Browse files
author
James Fuqian
authored
Merge pull request #22 from CMSgov/jfuqian/BB2-1597-Add-selenium-tests-for-python-sample-app
[BB2-1597] Add selenium tests for python sample app
2 parents 64291ec + 44a58cd commit 2a6960d

File tree

17 files changed

+353
-110
lines changed

17 files changed

+353
-110
lines changed

.github/pull_request_template.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
You've got a Pull Request you want to submit? Awesome!
3+
This PR template is here to help ensure you're setup for success:
4+
please fill it out to help ensure that your PR is complete and ready for approval.
5+
-->
6+
7+
**JIRA Ticket:**
8+
[SOMEPROJECT-42](https://jira.cms.gov/browse/SOMEPROJECT-42)
9+
10+
**User Story or Bug Summary:**
11+
12+
<!-- Please copy-paste the brief user story or bug description that this PR is intended to address. -->
13+
14+
### What Does This PR Do?
15+
16+
<!--
17+
Add detailed description & discussion of changes here.
18+
The contents of this section should be used as your commit message (unless you merge the PR via a merge commit, of course).
19+
20+
Please follow standard Git commit message guidelines:
21+
* First line should be a capitalized, short (50 chars or less) summary.
22+
* The rest of the message should be in standard Markdown format, wrapped to 72 characters.
23+
* Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behavior.
24+
* List all relevant Jira issue keys, one per line at the end of the message, per: <https://confluence.atlassian.com/jirasoftwarecloud/processing-issues-with-smart-commits-788960027.html>.
25+
26+
Reference: <https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project>.
27+
-->
28+
29+
### What Should Reviewers Watch For?
30+
31+
<!--
32+
Add some items to the following list, or remove the entire section if it doesn't apply for some reason.
33+
34+
Common items include:
35+
* Is this likely to address the goals expressed in the user story?
36+
* Are any additional documentation updates needed?
37+
* Are there any unhandled and/or untested edge cases you can think of?
38+
* Is user input properly sanitized & handled?
39+
* Does this make any backwards-incompatible changes that might break end user clients?
40+
* Can you find any bugs if you run the code locally and test it manually?
41+
-->
42+
43+
If you're reviewing this PR, please check these things, in particular:
44+
45+
- TODO

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ Debugging server component
5959
--------------------------
6060
debugpy remote debugging enabled on port 5678 for server in docker compose, developer can attach to server from IDE e.g. vscode.
6161

62+
## Run selenium tests in docker
63+
64+
Configure the remote target BB2 instance where the tested app is registered (as described above "Running the Back-end & Front-end")
65+
66+
Go to local repository base directory and run docker compose as below:
67+
68+
docker-compose -f docker-compose.selenium.yml up --abort-on-container-exit
69+
70+
Note: --abort-on-container-exit will abort client and server containers when selenium tests ends
71+
72+
## Visual trouble shoot
73+
74+
Install VNC viewer and point browser to http://localhost:5900 to monitor web UI interactions
75+
6276
Error Responses and handling:
6377
-----------------------------
6478
[See ErrorResponses.md](./ErrorResponses.md)

client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14.17.1
1+
FROM node:16.17.1
22

33
LABEL version="1.0"
44
LABEL description="Demo of a Medicare claims data sample app"

client/package.json

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,61 @@
11
{
2-
"name": "my-app",
3-
"version": "0.1.0",
4-
"private": true,
5-
"proxy": "http://server:3001",
6-
"dependencies": {
7-
"@cmsgov/design-system": "^2.7.3",
8-
"@testing-library/jest-dom": "^5.11.4",
9-
"@testing-library/react": "^11.1.0",
10-
"@testing-library/user-event": "^12.1.10",
11-
"@types/jest": "^26.0.15",
12-
"@types/node": "^12.0.0",
13-
"@types/react": "^17.0.0",
14-
"@types/react-dom": "^17.0.0",
15-
"axios": "^0.21.2",
16-
"http-proxy-middleware": "^1.3.1",
17-
"node-sass": "^7.0.0",
18-
"react": "^17.0.2",
19-
"react-dom": "^17.0.2",
20-
"react-router-dom": "^5.2.0",
21-
"react-scripts": "4.0.3",
22-
"typescript": "^4.1.2",
23-
"web-vitals": "^1.0.1"
24-
},
25-
"scripts": {
26-
"start": "react-scripts start",
27-
"build": "react-scripts build",
28-
"test": "react-scripts test",
29-
"eject": "react-scripts eject"
30-
},
31-
"eslintConfig": {
32-
"extends": [
33-
"react-app",
34-
"react-app/jest"
35-
]
36-
},
37-
"browserslist": {
38-
"production": [
39-
">0.2%",
40-
"not dead",
41-
"not op_mini all"
42-
],
43-
"development": [
44-
"last 1 chrome version",
45-
"last 1 firefox version",
46-
"last 1 safari version"
47-
]
48-
},
49-
"devDependencies": {
50-
"@types/react-router-dom": "^5.1.7"
51-
}
52-
}
2+
"name": "my-app",
3+
"version": "0.1.0",
4+
"private": true,
5+
"proxy": "http://localhost:3001",
6+
"dependencies": {
7+
"@cmsgov/design-system": "^2.7.3",
8+
"@types/node": "^12.0.0",
9+
"@types/react": "^17.0.0",
10+
"@types/react-dom": "^17.0.0",
11+
"axios": "^0.21.2",
12+
"http-proxy-middleware": "^1.3.1",
13+
"react": "^18.2.0",
14+
"react-dom": "^18.2.0",
15+
"react-router-dom": "^6.4.2",
16+
"react-scripts": "5.0.1",
17+
"node-sass": "7.0.3",
18+
"typescript": "^4.8.4",
19+
"web-vitals": "^3.0.3"
20+
},
21+
"scripts": {
22+
"start": "REACT_APP_CTX=docker react-scripts start",
23+
"start-native": "REACT_APP_CTX=native react-scripts start",
24+
"lint": "eslint --ext .ts --ext .js --ext .tsx .",
25+
"build": "react-scripts build",
26+
"test": "react-scripts test",
27+
"eject": "react-scripts eject"
28+
},
29+
"eslintConfig": {
30+
"extends": [
31+
"react-app",
32+
"react-app/jest"
33+
]
34+
},
35+
"browserslist": {
36+
"production": [
37+
">0.2%",
38+
"not dead",
39+
"not op_mini all"
40+
],
41+
"development": [
42+
"last 1 chrome version",
43+
"last 1 firefox version",
44+
"last 1 safari version"
45+
]
46+
},
47+
"devDependencies": {
48+
"@testing-library/jest-dom": "^5.16.5",
49+
"@testing-library/react": "^13.4.0",
50+
"@testing-library/user-event": "^13.5.0",
51+
"@types/jest": "^29.1.2",
52+
"@types/react-router-dom": "^5.3.3",
53+
"@typescript-eslint/eslint-plugin": "^5.12.0",
54+
"@typescript-eslint/parser": "^5.12.0",
55+
"eslint-config-react-app": "^7.0.0",
56+
"eslint-plugin-react": "^7.28.0"
57+
},
58+
"resolutions": {
59+
"@types/react": "^17.0.2"
60+
}
61+
}

client/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import Header from './components/header';
23
import Patient from './components/patient';
34
import PatientData from './components/patientData';

client/src/components/header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Badge } from '@cmsgov/design-system';
22
import { Link as RouterLink } from 'react-router-dom';
3+
import React from 'react'
34

45
export default function Header() {
56
return (
@@ -16,4 +17,4 @@ export default function Header() {
1617
</div>
1718
</header>
1819
);
19-
};
20+
}

client/src/components/patient.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import avatar from '../images/patient.png'
2+
import React from 'react'
23

34
export default function Patient() {
45

@@ -20,4 +21,4 @@ export default function Patient() {
2021
</div>
2122
</div>
2223
);
23-
};
24+
}

client/src/components/patientData.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Button } from '@cmsgov/design-system';
22
import axios from 'axios';
33
import chart from '../images/who-charted.png'
44
import { SettingsType } from '../types/settings';
5-
import { useState } from 'react';
5+
import React, { useState } from 'react';
66

77
export default function PatientData() {
88
const [header] = useState('Add your Medicare Prescription Drug data');
@@ -34,8 +34,8 @@ export default function PatientData() {
3434
<div>
3535
<h4>{ header }</h4>
3636
</div>
37-
<Button variation="primary" onClick={goAuthorize}>Authorize</Button>
37+
<Button id="auth_btn" variation="primary" onClick={goAuthorize}>Authorize</Button>
3838
</div>
3939
</div>
4040
);
41-
};
41+
}

client/src/components/records.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Table, TableCaption, TableRow, TableCell, TableHead, TableBody } from '@cmsgov/design-system';
2-
import { useEffect, useState } from 'react';
2+
import React, { useEffect, useState } from 'react';
33

44
export type EOBRecord = {
55
id: string,
@@ -114,4 +114,4 @@ export default function Records() {
114114
</div>
115115
);
116116
}
117-
};
117+
}

client/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import ReactDOM from 'react-dom';
23
import './styles/index.scss';
34

0 commit comments

Comments
 (0)