Skip to content

Conversation

@gonfunko
Copy link
Contributor

@gonfunko gonfunko commented Jun 14, 2021

This change also migrates the generator tests to run in Chrome instead of Firefox.

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Proposed Changes

This PR uses the selenium-standalone-service module to automatically start and stop Selenium when running test cases, instead of the old commands in package.json to coordinate doing so. It also uses Chrome to run the generator tests (consistent with the Mocha tests) instead of Firefox.

Behavior Before Change

npm run test would run the test suite, but hang and never terminate since it was blocking on a child Selenium process.

Behavior After Change

npm run test runs the test suite and terminates when it is done.

Reason for Changes

The test suite had to be manually stopped with ^C.

Test Coverage

Change is to the test suite itself; ran the test suite and confirmed that all tests pass.

@gonfunko gonfunko requested a review from rachel-fenichel June 14, 2021 17:38
package.json Outdated
"dependencies": {
"jsdom": "15.2.1"
"jsdom": "15.2.1",
"typescript": "^4.3.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Did this make it in by accident? or is typescript a required dependency here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was added automatically by the tooling; the dependencies tab on the package's page on npm doesn't indicate typescript is a dependency, but I'm not sure how I'd otherwise tell?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I'm curious how that was added. Try removing it and re-running npm install and seeing if everything works fine without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried removing it, npm install was happy, but re-running the tests added it back.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suspect this is related to npm test regenerating the TypeScript typing files in typings/.

I'm unclear on whether rebuilding these during test is desirable or not, but in any case if typescript is needed it ought to be installed in the devDependencies section rather than dependencies and—and probably permanently, so that we can be alerted to vulnerabilities, rather than being added ad-hoc by the build/test scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, moving it to devDependencies seems to do the trick - it doesn't get added back to dependencies that way. Updated accordingly!

Copy link
Contributor

@samelhusseini samelhusseini Jun 14, 2021

Choose a reason for hiding this comment

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

Oh yeah that makes sense @cpcallen.
Re-building is important as it tells you whether there is a problem with the closure to typescript conversion. Adding it to devDependencies makes sense to me given that requirement.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would probably be good to find the code that was previously adding it, and remove it.

var options = {
capabilities: {
browserName: 'firefox'
browserName: 'chrome',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update the comments for this function to not say that it's using firefox.

Looking forward, should this entire file/set of functions move into gulp scripts? Is there any reason we should keep it as a separate thing? It looks kind of like it went manual testing -> bash script -> node script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, and perhaps? I'm not familiar enough with the tooling to have a useful opinion, but simplifying/using the standard approach SGTM.

cpcallen and others added 9 commits June 14, 2021 19:41
- Do the (hopefully now) correct test to check we are on macOS.
- Fix brew command-line syntax for installing google-chrome.
Chrome comes pre-installed on GitHub hosted macOS runners, and while
`Xvfb` does not seem to be installed neither does it seem to be needed.
I have been unable to resolve the mocha test issues, so leave macOS
disabled for the moment.
@google-cla
Copy link

google-cla bot commented Jun 14, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Jun 14, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@cpcallen
Copy link
Collaborator

@googlebot I consent.

@gonfunko gonfunko merged commit 8d8309e into RaspberryPiFoundation:develop Jun 14, 2021
@gonfunko gonfunko deleted the test-suite branch June 14, 2021 21:11
cpcallen added a commit to cpcallen/blockly that referenced this pull request Nov 14, 2022
The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR RaspberryPiFoundation#4906.
cpcallen added a commit to cpcallen/blockly that referenced this pull request Nov 16, 2022
The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR RaspberryPiFoundation#4906.
cpcallen added a commit to cpcallen/blockly that referenced this pull request Nov 16, 2022
The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR RaspberryPiFoundation#4906.
cpcallen added a commit to cpcallen/blockly that referenced this pull request Jan 5, 2023
The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR RaspberryPiFoundation#4906.
cpcallen added a commit that referenced this pull request Jan 9, 2023
* chore(tests): Enable testing on node.js v18.x on GitHub CI

* chore(tests): Remove outdated calls to test:prepare npm script

The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR #4906.

* chore(deps): Fix alphabetisation in package.json
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