Skip to content

[BB2-1596] Add selenium tests for node sample app#29

Merged
JFU-GIT merged 5 commits intomasterfrom
jfuqian/BB2-1596-Add-selenium-test-for-node-sample-app
Oct 24, 2022
Merged

[BB2-1596] Add selenium tests for node sample app#29
JFU-GIT merged 5 commits intomasterfrom
jfuqian/BB2-1596-Add-selenium-test-for-node-sample-app

Conversation

@JFU-GIT
Copy link
Copy Markdown
Contributor

@JFU-GIT JFU-GIT commented Oct 8, 2022

JIRA Ticket:
BB2-1596

User Story or Bug Summary:
Context:

With BB2 Node SDK available, and BB2 Node React Sample re-factored to use BB2 Node SDK as the underlying interaction with the BB2 API, it is good to add selenium tests for the sample app, it has the following benefits:

  1. It serves as a real end to end test of the SDK besides the test of the sample app itself.
  2. It can also be used as a automated POST deployment tests against instances on TEST, SBX, PROD

AC:

Selenium tests added to test BB2 authorization and data flows from a node client.

What Does This PR Do?

  1. Added selenium tests to cover the FE and back end Auth Flow and EOB retrieve (dockerized)
  2. Updated readme

What Should Reviewers Watch For?

  1. Does the tests run through as expected?
  2. Is the coverage sufficient?
  3. Check that the drive by fix of EOB unit tests also passing
  4. Verify that the git hub action CI items passing
  5. Also following the readme to run native mode - make sure it works as expected

If you're reviewing this PR, please check these things, in particular:

  • TODO

May be need to add AWS parameter store client side to fetch the app creds on target ENV.

Copy link
Copy Markdown
Contributor

@dtisza1 dtisza1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JFU-GIT I didn't test the selenium part yet, but the main application is broken for me using the PR branch.

I did the following:

  • Tested using the "master" branch and http://localhost:3000 and auth flow. It works and brings in the data.
  • Tested using this PR's branch. It gets the following errors in the logs and doesn't get the data in to the client side:
bluebutton-sample-client-nodejs-react-server-1  | GET /api/authorize/authurl?pkce=true&version=v2&env=sandbox 200 1.253 ms - 229
bluebutton-sample-client-nodejs-react-server-1  | GET /api/bluebutton/callback/?code=M9ZIncLGOe7xteirOdTuwL6PzHEA45&state=-AUZbmFqeQgfTpcsFrKm9mwqv9igpyAibLPthKpMPIM 200 790.164 ms - 249281
bluebutton-sample-client-nodejs-react-server-1  | Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.setHeader (_http_outgoing.js:561:11)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.header (/server/node_modules/express/lib/response.js:794:10)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.location (/server/node_modules/express/lib/response.js:915:15)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.redirect (/server/node_modules/express/lib/response.js:953:18)
bluebutton-sample-client-nodejs-react-server-1  |     at /server/src/routes/Authorize.ts:81:7
bluebutton-sample-client-nodejs-react-server-1  |     at Generator.next (<anonymous>)
bluebutton-sample-client-nodejs-react-server-1  |     at fulfilled (/server/src/routes/Authorize.ts:5:58)
bluebutton-sample-client-nodejs-react-server-1  |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

@JFU-GIT
Copy link
Copy Markdown
Contributor Author

JFU-GIT commented Oct 14, 2022

@JFU-GIT I didn't test the selenium part yet, but the main application is broken for me using the PR branch.

I did the following:

  • Tested using the "master" branch and http://localhost:3000 and auth flow. It works and brings in the data.
  • Tested using this PR's branch. It gets the following errors in the logs and doesn't get the data in to the client side:
bluebutton-sample-client-nodejs-react-server-1  | GET /api/authorize/authurl?pkce=true&version=v2&env=sandbox 200 1.253 ms - 229
bluebutton-sample-client-nodejs-react-server-1  | GET /api/bluebutton/callback/?code=M9ZIncLGOe7xteirOdTuwL6PzHEA45&state=-AUZbmFqeQgfTpcsFrKm9mwqv9igpyAibLPthKpMPIM 200 790.164 ms - 249281
bluebutton-sample-client-nodejs-react-server-1  | Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.setHeader (_http_outgoing.js:561:11)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.header (/server/node_modules/express/lib/response.js:794:10)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.location (/server/node_modules/express/lib/response.js:915:15)
bluebutton-sample-client-nodejs-react-server-1  |     at ServerResponse.redirect (/server/node_modules/express/lib/response.js:953:18)
bluebutton-sample-client-nodejs-react-server-1  |     at /server/src/routes/Authorize.ts:81:7
bluebutton-sample-client-nodejs-react-server-1  |     at Generator.next (<anonymous>)
bluebutton-sample-client-nodejs-react-server-1  |     at fulfilled (/server/src/routes/Authorize.ts:5:58)
bluebutton-sample-client-nodejs-react-server-1  |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

I just tried to run a dockerized sample app (not selenium tests) fresh off the PR, and it works as expected (bring back EOBs)

Looking at the error I was wondering if it's from the inconsistency with the dependencies?

How about remove the ./server/node_modules and start the docker compose ?

Copy link
Copy Markdown
Contributor

@oragame oragame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good James, thanks for walking through the config with me. All tests are passing on selenium. Nice Work!

Copy link
Copy Markdown

@ajshred ajshred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally got this to work for me. Good work James!

Copy link
Copy Markdown
Contributor

@dtisza1 dtisza1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JFU-GIT This looks good to me!

I was finally able to get the tests to work. I was mainly having an issue by using my old config.ts w/o your updates.

There's also an issue running the tests when not on VPN, but works when on VPN. So this is OK.

Good work on this!

@JFU-GIT JFU-GIT merged commit 0097fcc into master Oct 24, 2022
@JFU-GIT JFU-GIT deleted the jfuqian/BB2-1596-Add-selenium-test-for-node-sample-app branch October 24, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants