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

Add unit tests for Room Creation #55

Closed
estellecomment opened this issue Apr 19, 2022 · 10 comments · Fixed by #120
Closed

Add unit tests for Room Creation #55

estellecomment opened this issue Apr 19, 2022 · 10 comments · Fixed by #120
Assignees
Labels

Comments

@estellecomment
Copy link
Contributor

Reuse the test setup that element has, and write a new unit test for TchapCreateRoomDialog.

Sprint goal : #46

@github-actions github-actions bot added the web label Apr 19, 2022
@odelcroi
Copy link
Member

odelcroi commented Apr 21, 2022

I see multiple tests requirements for this use case :

  • non react component : I've created a separate file for the room creation function, it allows to unit-test easily (no react context needed, pure ts).

  • react component events and renders : test component state update based on user input

  • test view rendering (html..) with snapshots (todo)

  • end to end tests including in matrix-react-sdk

#52

@odelcroi
Copy link
Member

odelcroi commented Apr 21, 2022

In order to run the UT properly we need to "yarn link" the matrix-react-sdk-v4, I managed to do it locally like this
⚠️ Beware to unlink previous version of matrix-react-sdk before ⚠️

  • checkout project matrix-react-sdk-v4, tag element-v3.42.0
  • yarn link

I set in package.json :
"matrix-react-sdk": "github:tchapgouv/matrix-react-sdk-v4#ac3a907",

  • yarn link matrix-react-sdk
  • yarn test

Before to make any more commit or branch I'd like to discuss with you if this approach seems the right path

@odelcroi
Copy link
Member

odelcroi commented Apr 22, 2022

Though, I am not able to run the tests within the folder /node_modules/matrix-react-sdk/test/..

It does not seem trivial : jestjs/jest#11084 -> it should be allowed in jest 28 (now using jest 26)

@odelcroi odelcroi self-assigned this May 2, 2022
@odelcroi odelcroi removed their assignment Jun 27, 2022
@estellecomment
Copy link
Contributor Author

Adding "blocked" : we should not invest in testing this until we have decided it's our final solution. (we could do design work to see if it would be possible to reuse element's creation dialogs.)

@jdauphant
Copy link
Contributor

@estellecomment
Copy link
Contributor Author

@jdauphant du coup on peut enlever le "blocked" ?

@jdauphant
Copy link
Contributor

Oui

@estellecomment
Copy link
Contributor Author

@odelcroi : Discussing this with @mcalinghee : we already have unit tests which verify that the rooms are valid tchap-types.
Next, we need to avoid regressions when we catch up with element.
So what we need is end-to-end tests on this.
Closing this ticket in favor of #117

@odelcroi odelcroi self-assigned this Jul 18, 2022
@odelcroi odelcroi reopened this Jul 18, 2022
@odelcroi
Copy link
Member

I'm submitting a more integrated approach to test React components. This allow to test the logic inside the component as well as the externalized logic.
I agree that end to end testing is a must go, though it is costly in terms of development and resources to run. For the present case, component testing is enough imho

@odelcroi
Copy link
Member

Key learnings :

  • The actual configuration does not work with jest 27 or jest 28. It is stuck to jest 26 with an error of typescript transcompilation I guess (babel..).

  • The configuration of enzyme is not taken from matrix-react-sdk for an unknown reason. It has been duplicated to a proper setupTests.js file. Though the rest of the configuration from matrix-react-sdk seems to be taken into account.

import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure } from "enzyme";
configure({ adapter: new Adapter() });
  • only the unit tests are executed to alleviate pressure on computer ressources
"testMatch": [
      "<rootDir>/test/unit-tests/**/*-test.[tj]s?(x)"
    ]
  • the transformIgnorePatterns has been updated in order to work properly :
"transformIgnorePatterns": [
      "\/node_modules\/(?!matrix-js-sdk|matrix-react-sdk).+$"
    ]

@odelcroi odelcroi linked a pull request Jul 18, 2022 that will close this issue
MarcWadai pushed a commit that referenced this issue Oct 8, 2024
…9d90..892a9e658e8

892a9e658e8 Merge pull request #11 from tchapgouv/upgrade-v3.112.0
7cf9e10e21d Fix merge conflict v3.112.0
ebd1e11d284 Merge tag 'v3.112.0' into upgrade-v3.112.0
933885386ed v3.112.0
e4ed18297cf Upgrade dependency to matrix-js-sdk@34.7.0
3687ee382dd test(sso): add test for email precheck, registration and welcome component
b32de09a709 v3.112.0-rc.0
08b3912de0f Upgrade dependency to matrix-js-sdk@34.7.0-rc.0
dd405ea582d Merge remote-tracking branch 'origin/develop' into staging
f33e802 Fix untranslated keys being rendered in `/help` dialog (#90)
cd850f5be67 v3.111.0
059db4db1b8 Merge pull request #106 from element-hq/backport-95-to-staging
d30645f9084 Allow joining calls and video rooms without enabling the labs flags (#95)
39a0f6e Remove ts-ignores where no longer necessary (#89)
c10bc6c7168 feat(sso): add feature flag to active sso flow
36fae00 Change device isolation mode to set `errorOnVerifiedUserProblems` to `false` (#104)
33c900e Remove right panel toggling behaviour on room header buttons (#100)
81bb56a Simplify Jest runs in CI to share failures with merge queue (#103)
fe402e2 Fix flaky mobile registration tests (#102)
0b3b499 Fix label sync (#101)
bd793a0 Allow joining calls and video rooms without enabling the labs flags (#95)
4f39164 Ensure timeline search results are visible even in video rooms (#96)
f28f1d9 Improve error display for messages sent from insecure devices (#93)
be2c1fc Add labs option to exclude unverified devices (#92)
78cca0201a9 feat(sso): remove existing sso buttons
8962e8c Improve contrast for timestamps, date separators & spotlight trigger (#91)
ef9e310 Pop right panel timeline when unmaximising widget to avoid double timeline (#94)
fed6c34d440 feat(sso): add email domain precheck sso flow
81192f6 Update dependency typescript to v5.6.2 (#71)
34d1875 Open room settings on room header avatar click (#88)
3f67819 Merge pull request #41 from element-hq/t3chguy/wat/230.1
e6404da Update test assertions
9e4348e Update test assertions
dd7479a Merge branch 'develop' of github.com:element-hq/matrix-react-sdk into t3chguy/wat/230.1
ad94c39 Fix accessible label on left panel spotlight trigger (#87)
2e895da Crypto: fix display of device key (#86)
df9d81398ab v3.110.0
1d5d0cc835f Upgrade dependency to matrix-js-sdk@34.6.0
3c267f9 Update snapshots
3620c5a Merge branch 'develop' into t3chguy/wat/230.1
a1bdcee Update dependency @types/node to v18.19.50 (#65)
ef1d4f6 Grant Element Call widget capabilities for "raise hand" feature (#82)
47a9377 Update dependency @types/react to v17.0.82 (#66)
9aa09d4 Maybe fix flakey AddRemoveThreepid test (#81)
d56b9ed Update dependency eslint to v8.57.1 (#68)
a248788 Update peter-evans/create-pull-request digest to 5e91468 (#64)
1f55710 Mobile registration optimizations and tests (#62)
4be5338 Update dependency @sentry/browser to v8.30.0 (#69)
b055908 Update dependency css-tree to v3 (#74)
d4c942d Update playwright monorepo to v1.47.1 (#73)
ed7e02a Update dependency stylelint-scss to v6.6.0 (#70)
5058d66 Update Sibz/github-status-action digest to faaa4d9 (#63)
cf8fe20 Update dependency express to v4.20.0 [SECURITY] (#26)
fe65702 Update to use non deprecated methods to decode recovery key (#54)
490746e Update to use non deprecated methods to derive key from passphrase (#55)
73843e5fe6b v3.110.0-rc.1
4776f87 Ignore chat effect when older than 48h (#48)
0cc0ebe Replace old reference of `matrix-org/matrix-react-sdk` by `element-hq/matrix-react-sdk` (#60)
3dd223c Also add NPM_TOKEN (#57)
1e76313 Playwright: factor out some common code (#49)
154bf33 Manually clear orphaned recaptcha challenge overlay in android webviews (#53)
d04d611f1e8 v3.110.0-rc.0
0bbed85 Pass bot token through explicitly (#56)
6eb332f26d5 Upgrade dependency to matrix-js-sdk@34.6.0-rc.0
49d84a6b0f9 Merge remote-tracking branch 'origin/develop' into staging
7feb5a0 Merge branch 'develop' into t3chguy/wat/230.1
13e67ae Add Release announcement for the pinning message list (#46)
1058af6 Playwright test for E2E messages from deleted devices (#47)
78ac691f50b feat(settings): remove generalusersettingtab and use accountusersetting tabs, hide personal info
c24661f [create-pull-request] automated change (#45)
5985277 Unlabs feature pinning (#22)
74885c9 Merge pull request #42 from element-hq/langleyd/mobile_registeration
20a4f0a Enforce config setting
3d89fc3 Merge branch 'develop' of https://github.com/element-hq/matrix-react-sdk into langleyd/mobile_registeration
62d66f9 Remove accidental paste
0716434 Allow hs_url as param on mobile_register
a89f61a Add error text and title with server name
9426fec Fix timeout type (#40)
be59791 Add support for `org.matrix.cross_signing_reset` UIA stage flow (#34)
8044ce4 Fix tests
b505828 update test to work with newer Rust crypto (#32)
0244aae use window.dispatchEvent
a6dec86 Add mobile registration and dispatch event for mobile postmessage dance
a6e98b0 Use `strong` over `b` for improved a11y semantics
6b384fe Fix huge usage bandwidth and performance issue of pinned message banner. (#37)
5740bdb [create-pull-request] automated change (#39)
0e8cd5b [create-pull-request] automated change (#38)
eae9d9e Add timezone to user profile (#20)
f317763 Reverse pinned message list (#19)
85b4f17 [create-pull-request] automated change (#33)
a701e3a Add config option to force verification (#29)
75918f5 Reduce pinned message banner size (#28)
433c14e Log clearer errors when picklekey goes missing (#27)
d337fba Add labels file (#21)
03004a5 Change settings to true by default (#25)
07125f5 Remove release announcement of new header (#23)
ccb1a61 [create-pull-request] automated change (#24)
51495e7 Remove pinned message list screenshot which are flacky (#17)
24fe2f2 [create-pull-request] automated change (#18)
491f0cd Change license (#13)
4382c67 Change org to element-hq (#7)
461da98 Merge pull request #10 from element-hq/dbkr/changelog_repos
e8c0b65 Merge branch 'develop' into dbkr/changelog_repos
6dd67b3 Merge pull request #11 from element-hq/dbkr/update_org_sonar
c26ce7a Merge branch 'develop' into dbkr/changelog_repos
3a42d2a Merge branch 'develop' into dbkr/update_org_sonar
d4771dd Merge pull request #3 from element-hq/dbkr/codeowners
58331fb Merge pull request #15 from element-hq/actions/localazy-download
0acc7dd [create-pull-request] automated change
272fd75 remove meangingless change
9fb871c poke the CI
caa6f26 Merge pull request #14 from element-hq/actions/playwright-image-updates
92b3eb5 [create-pull-request] automated change
deeeffa Update project key too
35f96b4 Update GH org in the sonar config file
9601be5 Update tests
f8da257 Update repos for changelog fetching
774222f Update codeowners to element-hq teams
78059e1 Merge pull request #1 from element-hq/actions/playwright-image-updates
eb14223 [create-pull-request] automated change
33791ca Merge pull request #12965 from matrix-org/florianduros/pinned-messages/analytics-event
08d1b6c Add analytics event for pinned messages
bce710e Upgrade `@matrix-org/analytics-events` to `0.25.0`
5bfbca9 Migrate all pinning checks and actions into `PinningUtils` (#12964)
2639923 Update browserslist (#12953)
6490742 Log phases in the verification process (#12963)
cdffbdb Add error handling for room publish toggle (#12941)
1e3320d Pinned message list: prevent sender name to overflow pinned event tile (#12947)
ab1e28b Compute with of content of pinned event tile (#12951)
60fe70b Add a prefix to file, poll, image, video and audio in the pinned message banner (#12950)
9d8c5b6 Update dependency @testing-library/jest-dom to v6.5.0 (#12957)
dbc8c9f Update peter-evans/create-pull-request action to v7 (#12960)
33404e4 Update stylelint (#12958)
df82c8a Update dependency @sentry/browser to v8.27.0 (#12956)
892b297 Update babel monorepo (#12955)
4769985 Update dependency @types/node to v18.19.47 (#12954)
8f22eb64432 v3.109.0-rc.0
9c233ef5db3 Upgrade dependency to matrix-js-sdk@34.5.0-rc.0
6bfdb3e Fix read receipt animation (#12923)
5ff3fd6 [create-pull-request] automated change (#12949)
579cb6b Update to 2.37.9 (#12943)
f033b64 Display the indicator even with one message in pinned message banner (#12946)
41686bb Always display last pinned message on the banner (#12945)
1ac533e Don't emit decrypted event for the banner (#12944)
ae15bbe Allow user to set timezone (#12775)
acc7342 [create-pull-request] automated change (#12942)
3d41f5b [create-pull-request] automated change (#12938)
13ec19c Sort the pinning message list in the same order than the banner (#12937)
19f8b44 Implement download_file in widget driver (#12931)
2a450c0 Add `allowImportingTsExtensions` to tsconfig (#12939)
d16ab09 Display pinned messages on a banner at the top of a room (#12917)
8b2ded8 [create-pull-request] automated change (#12935)
6fb8f6e Update all non-major dependencies (#12909)
c6922c9 Fix reply message truncation on 2 lines (#12929)
ea3c5cf Fix pin/unpin slowness and non refresh from the message action bar (#12934)
43941ef Install deja-vu font in docker image (#12932)
71c31bb [create-pull-request] automated change (#12926)
8421022 Rename all the slow reporter stuff to cjs (#12933)
5b91dd8 Reset matrix-js-sdk back to develop branch
e66807e Merge branch 'master' into develop
30f84cd Update playwright image (#12930)
f0a75d8 Add a config option to control the default widget container height (#12893)
e599428 Ignore desktop for minimum browser support. (#12928)
1b70b22 Update typescript-eslint monorepo to v7.18.0 (#12924)
8381e13 Update stylelint (#12922)
5a9d7ba Remove unused CryptoCallbacks implementations (#12919)
69da175 Update babel monorepo (#12920)
0848237 Update dependency @types/sanitize-html to v2.13.0 (#12921)
135d94c Update playwright monorepo to v1.46.1 (#12918)
670ed81 Update dependency @sentry/browser to v8.26.0 (#12915)
35fb068 Update dependency axe-core to v4.10.0 (#12916)
9671545 Update dependency eslint-plugin-unicorn to v55 (#12913)
5e56ce7 Update dependency husky to v9 (#12914)
70665d3 RTE drafts (#12674)
fdc5acd Update dependency @types/react-transition-group to v4.4.11 (#12912)
72d5659 Update dependency @types/node to v18.19.44 (#12911)
2768b9c Set entrypoints to use ./lib rather than ./src (#12906)
a7e907e Add thread information in pinned message list (#12902)
3d80eff Add Pin/Unpin action in quick access of the message action bar (#12897)
4064db1 [create-pull-request] automated change (#12907)
933a9c1 Rename prettier config file to .cjs (#12903)

git-subtree-dir: linked-dependencies/matrix-react-sdk
git-subtree-split: 892a9e658e8a3f6fd225d2104b0e5001cd12ad7f
MarcWadai pushed a commit that referenced this issue Dec 2, 2024
* Replace `deriveKey` call by `deriveRecoveryKeyFromPassphrase`

* Remove `matrix-js-sdk/src/crypto/key_passphrase` import of eslint exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants