Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webex Mock Service APPEALS-28105 #19266

Merged
merged 36 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2d1354e
APPEALS-28105 Initial adding of WEBEX Mockservice
breedbah Aug 14, 2023
6f2e8e0
APPEALS-28105 start of webex custom server
breedbah Aug 16, 2023
717b69c
APPEALS-28105 Adding error messages
breedbah Aug 16, 2023
2f671d1
APPEALS-28105 Completed adding errors to server
breedbah Aug 16, 2023
1b8b8fb
APPEALS-28105 changes to webex server
breedbah Aug 17, 2023
05c620b
APPEALS-28105 Started autogenerate data functionality
breedbah Aug 17, 2023
8cf7856
APPEALS-28105 Updated error handling
breedbah Aug 17, 2023
1a55e14
APPEALS-28105 Updated routes
breedbah Aug 17, 2023
9eb4e8c
Merge branch 'master' into b_reed/APPEALS-28105
breedbah Aug 17, 2023
e2858be
APPEALS-28105 Got the api webex-generation working
breedbah Aug 18, 2023
38ddb28
APPEALS-25108 removed dummy data
breedbah Aug 18, 2023
28b27ed
APPEALS-28105 return the conference link object
breedbah Aug 21, 2023
fe87289
APPEALS-28105 Removed webex-mock.json file
breedbah Aug 21, 2023
38d7010
APPEALS-28105 added the webex-mock.json to .gitignore
breedbah Aug 21, 2023
88a7435
APPEALS-28105 update linting errors
breedbah Aug 21, 2023
a45deef
APPEALS-28105 Completed addressing linting errors
breedbah Aug 21, 2023
6802591
APPEALS-28105 Updated the Readme.md
breedbah Aug 21, 2023
94719fe
APPEALS-28105 Addressed Code Climate errors
breedbah Aug 21, 2023
45e6eed
APPEALS-28105 Addressed linting errors
breedbah Aug 21, 2023
55c6410
APPEALS-28105 removed commented code
breedbah Aug 22, 2023
d8ab350
Merge branch 'master' into b_reed/APPEALS-28105
breedbah Aug 22, 2023
e4bb5f3
APPEALS-28105 Updated readme.md with installation resolution
breedbah Aug 23, 2023
eb9b151
Merge branch 'feature/APPEALS-26734' into b_reed/APPEALS-28105
breedbah Aug 23, 2023
75f563d
APPEALS-28105 Revert back to Addressed lint errors
breedbah Aug 24, 2023
c625480
Merge branch 'b_reed/APPEALS-28105' of https://github.com/department-…
breedbah Aug 24, 2023
99c1ee9
APPEALS-28105 cleaned up and completed mock server update
breedbah Aug 25, 2023
ffef0db
APPEALS-28105 Updated and modified meeting data
breedbah Aug 25, 2023
afdca04
Merge branch 'master' into b_reed/APPEALS-28105
breedbah Aug 25, 2023
6828546
Merge branch 'master' into b_reed/APPEALS-28105
breedbah Aug 25, 2023
d28988c
Merge branch 'feature/APPEALS-26734' into b_reed/APPEALS-28105
breedbah Aug 25, 2023
c69cb9c
resolve conflict
breedbah Aug 28, 2023
fa95ea2
Merge branch 'feature/APPEALS-26734' into b_reed/APPEALS-28105
breedbah Aug 28, 2023
d79c0c5
APPEALS-28105 removed space routes.json
breedbah Aug 28, 2023
ce501b0
APPEALS-28105 fixed conferenceSelectionVisibility
breedbah Aug 29, 2023
5944f05
APPEALS-28105 corrected radio button page display
breedbah Aug 29, 2023
38709f6
APPEALS-28105 updated jest test for correct organization
breedbah Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ client/junit.xml
!/reports/sql_queries
!/reports/.keep
credstash.log
client/mocks/webex-mocks/webex-mock.json
# Ignore MS Office temp files
~$*

Expand Down
22 changes: 5 additions & 17 deletions client/app/queue/OrganizationUsers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,11 @@ export default class OrganizationUsers extends React.PureComponent {
organization={this.props.organization}
user={user} />
</div>
{this.state.organizationName === 'Hearing Admin' &&
!conferenceSelectionVisibility && (
<div
{...radioContainerStyle}
>
<SelectConferenceTypeRadioField
key={`${user.id}-conference-selection`}
name={user.id}
/>
</div>
)}
</div>
)}
</ul>
</div>
</React.Fragment>
);
}
</div> }
</ul>
</div>
</React.Fragment>;
});

return <React.Fragment>
Expand Down
59 changes: 59 additions & 0 deletions client/mocks/webex-mocks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Setup json server

Step 1: Open a terminal

Step 2: Navigate to the caseflow/client

step 3: Run command: [npm install json-server] or [yarn add json-server]

If the [npm install json-server] or [yarn add json-server] returns an error that resembles:

error standard@17.1.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "15.1.0"

extra steps may need to be taken.

for brevity These instructions will follow the happy path. While in the client directory in terminal:
[nodenv install 14.21.2]
[nodenv local 14.21.2]

If for any reason you want to go back to the original nodenv that was used prior to this change you can run, [nodenv local 12.13.0]

If it all succeeds you can attempt the [npm install json-server] or [yarn add json-server] once again.

This time with no issue.
given that the install goes as expected you can continue following the rest of the directions.

If there are still issues in getting this to operate as expected, See your tech lead for asssisstance.

step 4: Make sure casfelow application is running

step 5: Autogenerate test data, run this command: npm run generate-webex(This will also create the json file)

step 6: Run command: npm run webex-server

\*info: You will recieve all available routes within the terminal under 'Resources'

\*info: port must be set on a different port to run due to caseflow running on port 3000

step 7: Open a browser window in chrome and navigate to localhost:3050 [You will get the default page]

\*info: You can use any api endpoint software you want like Postman, but a good lightweight vs code ext. is [Thunder Client]

\*info: reference guides
[https://github.com/typicode/json-server/blob/master/README.md]

Tutorial Resources:
[https://www.youtube.com/watch?v=_1kNqAybxW0&list=PLC3y8-rFHvwhc9YZIdqNL5sWeTCGxF4ya&index=1]

To create a meeting the request body must have all of the keys and hit this endpoint?
[http://localhost:3050/fake.api-usgov.webex.com/v1/meetings]

Get all conferencelinks with this endpoint
[http://localhost:3050/api/v1/conference-links]

Javascript API call Fetch/Axios examples
[https://jsonplaceholder.typicode.com/]




37 changes: 37 additions & 0 deletions client/mocks/webex-mocks/meetingData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const faker = require('faker');

const generateMeetingData = (response) => {

return {
id: faker.random.uuid(),
jwt: {
sub: response.jwt.sub,
Nbf: response.jwt.Nbf,
Exp: response.jwt.Exp,
flow: {
id: faker.random.uuid(),
data: [
{
uri: `${faker.internet.userName()}@intadmin.room.wbx2.com`,
},
{
uri: `${faker.internet.userName()}@intadmin.room.wbx2.com`,
},
],
},
},
aud: faker.random.uuid(),
numGuest: faker.random.number({ min: 1, max: 10 }),
numHost: 1,
provideShortUrls: faker.random.boolean(),
verticalType: faker.company.catchPhrase(),
loginUrlForHost: faker.random.boolean(),
jweAlg: 'PBES2-HS512+A256KW',
saltLength: faker.random.number({ min: 1, max: 16 }),
iterations: faker.random.number({ min: 500, max: 2000 }),
enc: 'A256GCM',
jwsAlg: 'HS512',
};
};

module.exports = generateMeetingData;
5 changes: 5 additions & 0 deletions client/mocks/webex-mocks/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

{
"/api/v1/conference-links": "/conferenceLinks",
"/api/v1/conference-links/:id": "/conferenceLinks/:id"
}
50 changes: 50 additions & 0 deletions client/mocks/webex-mocks/webex-mock-generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const fs = require('fs');
const faker = require('faker');
const generateMeetingData = require('./meetingData.js');

const generateConferenceLinks = () => {
let webexLinks = [];

for (let id = 1; id <= 10; id++) {
const startDate = new Date('2021-01-01T00:00:00Z');
const endDate = new Date('2023-01-01T00:00:00Z');

const randomStartDate = faker.date.between(startDate, endDate);
const randomEndDate = new Date(randomStartDate.getTime());

randomEndDate.setHours(randomEndDate.getHours() + 1);

let startTime = randomStartDate.toISOString().replace('Z', '');
let endTime = randomEndDate.toISOString().replace('Z', '');

let subject = faker.lorem.words();

let updatedValues = {
jwt: {
sub: subject,
Nbf: startTime,
Exp: endTime
}
};

webexLinks.push(generateMeetingData(updatedValues));
}

return webexLinks;
};

// Generate the data
const data = {
conferenceLinks: generateConferenceLinks(),
// ... other data models
};

// Check if the script is being run directly
if (require.main === module) {
fs.writeFileSync(
'mocks/webex-mocks/webex-mock.json',
JSON.stringify(data, null, 2)
);
// eslint-disable-next-line no-console
console.log("Generated new data in webex-mock.json");
}
Loading
Loading