Commit Graph

294 Commits

Author SHA1 Message Date
Joe Previte 3b50bfc17d
fix: sanitize password and cookie key 2021-06-08 14:33:17 -07:00
Joe Previte 8c2bb61af9
refactor: parse options with multiple = in cli
There was a case with the hashed-password which had multiple equal signs in the
value and it wasn't being parsed correctly. This uses a new function and adds a
few tests.
2021-06-08 14:33:17 -07:00
Joe Previte 531b7c0c25
feat: add splitOnFirstEquals function 2021-06-08 14:33:16 -07:00
Joe Previte 517aaf71c5
docs: update FAQ with new hashing instructions 2021-06-08 14:33:16 -07:00
Joe Previte 6020480b30
feat: add isCookieValid function and tests 2021-06-08 14:33:16 -07:00
Joe Previte a14ea39c4a
feat: add handlePasswordValidation + tests 2021-06-08 14:33:15 -07:00
Joe Previte 7ff4117531
feat: add getPasswordMethod & test for it 2021-06-08 14:33:15 -07:00
Joe Previte ffa5c16e51
feat: update cli and test for hashed-password 2021-06-08 14:33:15 -07:00
Joe Previte 788b958e20
refactor: update hash fn in test config 2021-06-08 14:33:14 -07:00
Joe Previte fd3cb6cfa0
refactor: update unit tests for hash fns
Since the hash and isHashMatch are now async, I had to update the tests
accordingly. Now everything is working.
2021-06-08 14:33:13 -07:00
Joe Previte 51f8341959
chore: update to argon2 in test 2021-06-08 14:33:13 -07:00
Joe Previte fc3326f1f2
feat: add tests using real hashes 2021-06-08 14:33:12 -07:00
Joe Previte aaf044728f
refactor: add functions to check hash password 2021-06-08 14:33:12 -07:00
Joe Previte f35120c0a3
feat: add unit test for hash function 2021-06-08 14:33:12 -07:00
Joe Previte 17be8c5cd3
refactor: use bcrypt in e2e setup 2021-06-08 14:33:12 -07:00
dependabot[bot] 0832df1a3f
chore(deps): bump ws from 7.4.2 to 7.4.6 in /test (#3510)
Bumps [ws](https://github.com/websockets/ws) from 7.4.2 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.2...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-31 20:12:53 +05:30
dependabot[bot] 20874c1833
chore(deps): bump browserslist from 4.16.4 to 4.16.6 in /test
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.4 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.4...4.16.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 21:28:37 +00:00
Joe Previte 46fe77d464
chore: update CHANGELOG 2021-05-13 12:10:22 -07:00
Joe Previte 2a657ab930
feat: add tests for getEnvPaths 2021-05-13 12:10:21 -07:00
Akash Satheesan adc9b57080
chore: reformat with new prettier 2021-05-12 01:14:04 +05:30
dependabot[bot] 65c2510faa
chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 in /test (#3312)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-08 00:04:25 +05:30
Asher 4f320ad3e0
Merge pull request #3297 from code-asher/test-static 2021-05-06 18:24:44 -05:00
Asher e8443e2602
Fix helpers not working in e2e tests
It errors that jest is not defined so put it behind a function instead
of immediately creating the mock (this is probably a better pattern
anyway).

The constant tests had to be reworked a little. Since the logger mock is
hoisted it runs before createLoggerMock is imported. I moved it into a
beforeAll which means the require call also needed to be moved
there (since we need to mock the logger before requiring the constants
or it'll pull the non-mocked logger).

This means getPackageJson needs to be a let and assigned afterward. To
avoid having to define a type for getPackageJson I just added a let var
set to the type of the imported constants file and modified the other
areas to use the same paradigm.

I also replaced some hardcoded strings with the mocked package.json
object.
2021-05-06 15:01:35 -05:00
dependabot[bot] 14dbd16a7a
chore(deps): bump lodash from 4.17.20 to 4.17.21 in /test (#3300)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-07 01:30:47 +05:30
Asher ad4a70c684
Use warn log level for integration tests
Just to limit all the noise from code-server's startup output.
2021-05-06 14:27:16 -05:00
Asher 4925e97080
Add static route tests 2021-05-06 14:27:11 -05:00
Asher 1789cd1bcb
Move temp test dirs under a `tests` sub-directory
This is to match the other tests that create temp directories. It also
lets you clean up test temp directories all at once separately from
other non-test temporary directories.
2021-05-06 14:25:51 -05:00
Asher 52cf2fcf29
Move tmpdir test helper to test helpers file 2021-05-06 14:25:50 -05:00
Asher 0e4672f6b9
Move health route tests to routes directory 2021-05-06 14:25:49 -05:00
Joe Previte cb5ab48d48
fix: coveragePathIgnorePatterns to /out
We were accidentally ignoring `node/routes` because we had "out"
instead of "/out" in `coveragePathIgnorePatterns` which caused
us to not collect coverage for those files. Now we do.
2021-05-06 11:53:17 -07:00
Joe Previte 027106a5e1
feat(testing): add test for constants "version" and commit 2021-05-05 15:34:48 -07:00
Asher a882be5748
Refactor integration tests to use main entry point 2021-05-05 12:24:41 -05:00
Asher 083400b50a
Add flag to enable permessage-deflate 2021-05-05 12:24:34 -05:00
Asher 8b2c78c4a4
Re-enable update tests 2021-05-04 13:29:42 -05:00
Asher 10babb4a0c
Replace console with logger in sw register 2021-05-04 13:29:41 -05:00
Asher a48ac5080b
Share common util code with VS Code
This lets us re-use the normalized base path so when we expire/clear the
cookie we use the same base path.
2021-05-04 13:29:40 -05:00
Joe Previte 8e6c10e7ff
Merge pull request #3263 from cdr/jsjoeio/fix-e2e-test
fix(testing): reduce flakiness of terminal.test.ts and use 1 worker for e2e tests
2021-04-30 15:38:32 -07:00
Joe Previte cde30579c4
refactor: change to reloadUntilEditorIsReady 2021-04-30 13:44:16 -07:00
Joe Previte 2cb499385a
feat: add isConnected method to CodeServer model 2021-04-30 13:36:46 -07:00
Joe Previte 7309ea9d10
fix(e2e): use one worker to reduce flakiness 2021-04-29 16:27:19 -07:00
Joe Previte 17f4c4c330
fix(e2e): remove quotes from terminal type command 2021-04-29 16:22:21 -07:00
Joe Previte d07317ad01
docs: add maintaining.md with workflow 2021-04-28 11:25:25 -07:00
Joe Previte 449c6da77c
refactor: add timeout to terminal.test.ts 2021-04-27 14:35:31 -07:00
Joe Previte 8c727d96d6
refactor: make CodeServer methods more stable 2021-04-27 14:35:09 -07:00
Joe Previte 07d682392e
Merge pull request #3169 from cdr/jsjoeio/add-terminal-e2e-test
feat(testing): add e2e tests for code-server and terminal
2021-04-26 15:16:06 -07:00
Joe Previte 83746c8a1f
refactor: remove null check in register.ts options.base
Inside registerServiceWorker, we were originally using the nullash coalescing
operator to check if options.base was null or undefined. However, I realized
this check is not necessary.

If you look at getOptions' return value, we return an object with a key "base"
which is of type "string". We get that value by calling resolveBase which always
returns a string.

As a result, we didn't need to check if options.base was null or undefined
because it never can be.
2021-04-23 17:09:03 -07:00
Joe Previte 7bfdd13cb3
refactor: tmpdir and add to test utils 2021-04-23 16:40:39 -07:00
Joe Previte 6f2709bcaa
feat: add tests for registerServiceWorker 2021-04-23 16:31:56 -07:00
Joe Previte b0ecff338f
refactor: globalSetup to use CodeServer model 2021-04-23 14:35:33 -07:00
Joe Previte cb65590b98
refactor: move tmpdir into src/node/constants 2021-04-23 14:35:32 -07:00
Joe Previte cc99fddf24
feat: add test for terminal echo to file 2021-04-23 14:35:32 -07:00
Joe Previte 2bf0a0e76e
refactor: fix tests to check visibility correctly 2021-04-23 14:35:31 -07:00
Joe Previte 2665a4f61b
feat: add CodeServer page object for e2e tests 2021-04-23 14:35:31 -07:00
Joe Previte f80d5c3764
refactor: rateLimiter.canTry logic to check >= 1 2021-04-19 13:14:19 -07:00
Joe Previte 958f01262b
refactor: check errorMessage in login e2e test 2021-04-19 11:11:52 -07:00
Joe Previte a3f18d6158
refactor: change limiter.Try() to .removeToken() 2021-04-19 10:57:50 -07:00
Joe Previte 7928dc2bff
feat: add test for limiter.canTry() 2021-04-19 10:41:00 -07:00
Joe Previte a8719e1f79
refactor: change config to save all e2e videos 2021-04-19 10:40:59 -07:00
Joe Previte 1e6f4f2a14
feat(testing): add test for rate limiter 2021-04-19 10:40:59 -07:00
Joe Previte 83cfbf82cf
feat: increase timeout for playwright tests 2021-04-19 10:40:59 -07:00
Joe Previte faaa0a9e60
feat(testing): add e2e tests for password 2021-04-19 10:40:59 -07:00
Joe Previte ebbabc6e04
refactor(testing): combine loginPage with login 2021-04-19 10:40:58 -07:00
Joe Previte 58e17c5e50
feat(testing): add tests for RateLimiter 2021-04-19 10:40:58 -07:00
Joe Previte 450fcd5ba7
refactor: pass all args to test-e2e script 2021-04-15 11:46:45 -07:00
Joe Previte d6f0725399
fix: update path for e2e videos 2021-04-15 11:46:45 -07:00
Joe Previte c9fa931a0b
fix: add retry 2 for failing e2e tests 2021-04-15 11:46:44 -07:00
Joe Previte 92b7c1e9a8
refactor: test-e2e.sh script 2021-04-15 11:46:44 -07:00
Joe Previte 6c3bb101cd
chore(deps): add resolution for newest playwright 2021-04-15 11:46:44 -07:00
Joe Previte 7ea6d22b3e
refactor: add login to config.js for e2e tests 2021-04-15 11:46:44 -07:00
Joe Previte 52586706c4
refactor: use playwright-test syntax for e2e tests 2021-04-15 11:46:43 -07:00
Joe Previte 08cd2d8191
refactor: add new e2e config 2021-04-15 11:46:43 -07:00
Joe Previte 0a090bf12b
chore(deps): add @playwright/test 2021-04-15 11:46:43 -07:00
Joe Previte ad0f12e664
refactor: check for editor consistently in tests 2021-04-06 15:46:58 -07:00
Joe Previte dd80eed5b0
feat: add logger to tests 2021-04-06 15:46:57 -07:00
Joe Previte fd69f2db88
refactor: logout test 2021-04-06 15:46:57 -07:00
Joe Previte c666b47668
refactor: globalSetup and create cookie manually 2021-04-06 15:46:56 -07:00
Joe Previte 51010e73cb
feat: add test for globalSetup 2021-04-06 15:46:56 -07:00
Joe Previte 4b703cbd4d
refactor: e2e tests based on jest-playwright 2021-04-06 15:46:56 -07:00
Joe Previte 1782f2a239
refactor: rename e2e test to loginPage 2021-04-06 15:46:56 -07:00
Joe Previte bd55cb94be
refactor: move test dir to jest e2e config 2021-04-06 15:46:56 -07:00
Joe Previte 6b3db06c7a
feat: add new e2e test to test browser 2021-04-06 15:46:56 -07:00
Joe Previte 3db19843e2
chore: add eslint plugin for jest-playwright 2021-04-06 15:46:55 -07:00
Joe Previte b4193b8c68
feat: add jest-playwright and packages 2021-04-06 15:46:55 -07:00
Joe Previte 9eff1f0702
fix: add timeout to logout test 2021-03-23 12:14:42 -07:00
Joe Previte 090687d057
feat: add e2e test for logout 2021-03-23 10:02:03 -07:00
Joe Previte 071c8e15fc
Merge branch 'main' into jsjoeio/upgrade-vscode-1.54 2021-03-17 13:51:27 -07:00
Joe Previte 36714da613
fixup: move openHelpAbout 2021-03-17 11:25:33 -07:00
Joe Previte d3df963d39
Merge branch 'main' into jsjoeio/upgrade-vscode-1.54 2021-03-16 14:42:51 -07:00
Joe Previte 481dd1f1d6
fixup: rename test 2021-03-16 14:36:31 -07:00
Joe Previte 608871eba1
wip: change name back to goHome 2021-03-16 14:26:04 -07:00
Joe Previte 3d9d2e592d
refactor: add helpAbout test instead of goHome 2021-03-16 14:25:28 -07:00
Joe Previte bcdca86539
refactor: change goHome test to helpAbout 2021-03-16 14:25:28 -07:00
Joe Previte 0c2708302d
refactor: remove --home flag/feature
We are removing this because it was removed upstream in PR~115599.
2021-03-16 14:25:28 -07:00
Asher 964ebe8d0a
Replace fs-extra with fs.promises
Remove the Mac directory copy instead of refactoring it since we've had
this for a long time now and I think it's safe to assume that users
running code-server on Mac don't have the old directory anymore.
2021-03-16 12:51:08 -05:00
Asher f33402c503
Remove extra awaits from tests 2021-03-15 15:34:44 -05:00
Joe Previte 7e23575978
chore: update code-server path in tsconfig 2021-03-12 12:00:57 -07:00
Joe Previte 9ee2556dd1
chore: update gitignore with test dirs 2021-03-12 12:00:57 -07:00
Joe Previte 6fd30d91ea
feat: add jest e2e config 2021-03-12 12:00:57 -07:00
Joe Previte d10da3f7c3
refactor: move test-plugin 2021-03-12 12:00:56 -07:00
Joe Previte cf6fdb90eb
refactor: create test/utils 2021-03-12 12:00:56 -07:00