Commit graph

169 commits

Author SHA1 Message Date
Michael Telatynski
8fdb41412f Use URLSearchParams instead of transitive dependency querystring
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-12 01:45:58 +01:00
J. Ryan Stinnett
c70bfe1f91 Update loading test for JS SDK IDB change
Part of https://github.com/vector-im/riot-web/issues/12207
2020-02-27 14:57:52 +00:00
J. Ryan Stinnett
fb77bcf762 Remove spinner check
We may no longer see a spinner for some login paths with the changes to add a
complete security step.

Part of https://github.com/vector-im/riot-web/issues/11214
2020-01-16 16:07:49 +00:00
Travis Ralston
3fb6b1ed63 Remove excessive sleep now that we're not using chrome 2020-01-15 15:31:08 -07:00
Travis Ralston
bcda501864 Replace usages of expect.toStartWith with boolean checks 2020-01-15 14:44:46 -07:00
Travis Ralston
84439cff86 Import the cryptostore from the right place 2020-01-15 14:06:44 -07:00
Travis Ralston
e37da08730 Replace beforeEach with just a cleanLocalstorage call
The rest isn't needed anymore.
2020-01-15 14:06:24 -07:00
Travis Ralston
3c9c0ec447 Leave the language handler setup to the test init scripts 2020-01-15 14:05:55 -07:00
Travis Ralston
161a1342b2 Swap over to Jest, breaking everything 2020-01-15 13:24:19 -07:00
Travis Ralston
a978a6734f Fix CI tests
There's a bunch of generated files that webpack relies on to work, and Karma works off webpack. To make both happy we've added
a new `build:genfiles` script which takes care of this for us. We also have to install and build our other layers to get the
same effect (like generating the react-sdk's component index, while we still have one).

This commit also fixes all the imports in the tests because they were just wrong. They should have been caught in the ES6ification
earlier, but were missed.
2020-01-13 20:40:00 -07:00
Travis Ralston
17e332bb48 Import from src/ for the react-sdk and js-sdk
We compile directly for accuracy of sourcemaps.
2019-12-23 20:02:11 -07:00
Michael Telatynski
73990acf7a use function over const lambda 2019-11-25 12:53:07 +00:00
Michael Telatynski
0a209fc340 Use promises in tests properly 2019-11-22 14:08:45 +00:00
Michael Telatynski
6452cdca04 Don't oversubscribe mocha resolution methods v2.1 2019-11-04 13:28:53 +00:00
Michael Telatynski
c3ce52a6c0 Don't oversubscribe mocha resolution methods v2 2019-11-04 13:22:02 +00:00
Michael Telatynski
86eb601c34 Don't oversubscribe mocha resolution methods 2019-11-04 13:11:44 +00:00
Michael Telatynski
10e1d9093e transform-async-to-promises: get rid of bluebird 2019-11-04 12:46:28 +00:00
Michael Telatynski
06e7a48aaf Switch to React 16.8
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-08-01 15:31:33 +01:00
Travis Ralston
f3e82b56e9 Remove unused disable_identity_server config flag
Fixes https://github.com/vector-im/riot-web/issues/10229
2019-07-11 15:11:59 -06:00
Travis Ralston
c68a621a71 Fix tests for liveliness checks 2019-06-05 09:53:22 -06:00
Travis Ralston
fc5c93ab5f Fix unit tests for new login
Supply a server config to the component and adjust the wait logic to be less of a race. The Login component will noop onPasswordLogin if it is "busy", and it is busy when it requests the login flows.
2019-05-03 16:27:41 -06:00
Travis Ralston
a5092dc763 Fix tests to use new server config options 2019-05-03 11:06:32 -06:00
J. Ryan Stinnett
eb1d1517ca Setup crypto store for restore session tests
The new storage consistency work expects a crypto store exist together with
local storage. This updates the loading tests to create them together.

Needed for https://github.com/vector-im/riot-web/issues/9109
2019-03-29 18:01:04 +00:00
J. Ryan Stinnett
fef69b54fb Use on_logged_in action in tests
This changes the way tests wait for login to complete from a timer-based system
(which can cause intermittent failures) to an action-based system. The lifecycle
code dispatches the action `on_logged_in` when login completes which we can wait
for in the tests as a much better indication that work is done.
2019-03-26 15:21:53 +00:00
J. Ryan Stinnett
5112b33af2 Remove unused test helper 2019-03-26 14:41:10 +00:00
J. Ryan Stinnett
f321aba4ac Convert away from Promise.defer
`Promise.defer` is deprecated in Bluebird and it logs loudly each time it's
called. This cleans up testing logs significantly by converting away from it.
2019-03-26 12:46:26 +00:00
David Baker
ad95ca4e86 Add home page to fix loading tests 2019-02-14 13:29:57 +00:00
J. Ryan Stinnett
585d28692d Fix loading tests for welcome page 2019-02-11 15:18:29 +00:00
J. Ryan Stinnett
50baa09f5e Revert "Disable even more tests"
This was only done because CI was missing
matrix-org/matrix-react-sdk@5977859dd9.

This reverts commit e55ceef905.
2019-02-11 10:06:44 +00:00
David Baker
fdb7a781e0
Merge pull request #8466 from vector-im/jryans/add-welcome-page
Add configurable welcome page
2019-02-08 17:17:24 +00:00
J. Ryan Stinnett
e55ceef905 Disable even more tests 2019-02-08 16:57:08 +00:00
J. Ryan Stinnett
ec83f792ad Fix / disable tests after welcome page 2019-02-08 16:35:39 +00:00
Bruno Windels
758723256e fix app tests after force enabling lazy loading + removing feature flag 2019-02-08 11:48:06 +00:00
Travis Ralston
cec8a77d52 Disable room directory test because it doesn't work
See enclosed comments.
2019-01-30 00:11:01 -07:00
J. Ryan Stinnett
2d360eab74 Remove support for team servers 2019-01-25 16:14:04 -06:00
J. Ryan Stinnett
e98346e7cd Rename login directory to auth 2019-01-21 17:46:03 -06:00
David Baker
0e580635eb Update tests for new platform layout 2018-12-18 18:13:51 +00:00
Richard van der Hoff
6ca0b3ad03 Update the tests to match https://github.com/matrix-org/matrix-react-sdk/pull/2340
See the react-sdk PR for some context.
2018-12-11 16:14:17 +00:00
David Baker
1dfaf70562
Revert "Revert "Run lint on travis builds and use modern node versions"" 2018-11-22 18:25:55 +00:00
David Baker
f701e2601a
Revert "Run lint on travis builds and use modern node versions" 2018-11-22 18:17:09 +00:00
Aaron Raimist
70fe4f67ee
eslint --fix on test/ 2018-10-19 20:59:07 -05:00
Matthew Hodgson
c8b26a1002 fix tests 2018-04-16 00:23:34 +01:00
Matthew Hodgson
8757c8cae0 move notif UTs to sdk 2018-04-12 20:24:44 +01:00
Michael Telatynski
f7a26ddb91
fix (race?) broken tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-11-19 20:46:40 +00:00
Matthew Hodgson
b9cf2c6b6c remove 'return to app' test 2017-10-26 18:08:42 +01:00
David Baker
c32e736754 Comment why we don't expect joining flag to reset 2017-09-19 10:23:12 +01:00
David Baker
30efd02d22 Fix test for new behaviour of 'joining' flag
It's no longer reset when the join request completes, so don't
assert it. (The important test is later, asserting that the room
object is non-null).
2017-09-15 15:57:37 +01:00
Richard van der Hoff
238afde00a Increase the timeout for clearing indexeddbs
Chrome seems to take ages (like, 1500ms regularly) to clear out the indexeddbs,
and that's causing test timeouts. Bump the timeout to hack around it.

Also: clear both dbs in parallel (can't hurt, right?) and improve diagnostics
on the process.
2017-07-20 11:01:27 +01:00
Richard van der Hoff
66ddf25977 Deflake the joining test
Just give the client longer to get started (it seems to be taking a long time
to get started talking to indexeddb)
2017-07-14 16:14:42 +01:00
Richard van der Hoff
32ef273f9d use flushAllExpected in joining test
It won't do much to help with the vm stopping for 300ms, but it should make the
code and logs clearer.
2017-07-13 13:23:10 +01:00
Richard van der Hoff
76181f4771 Merge remote-tracking branch 'origin/develop' into rav/bluebird 2017-07-13 12:04:54 +01:00
Richard van der Hoff
69eb1a49d4 Fix a broken test
turns out that you could call defer.resolve on q defers as an unbound function,
whereas that doesn't work with bluebird promises.
2017-07-13 00:56:13 +01:00
Richard van der Hoff
4c5b5ca0ba replace q.Promise with new Promise 2017-07-13 00:50:01 +01:00
Richard van der Hoff
d5b550f89a replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-13 00:50:01 +01:00
Richard van der Hoff
b29b4a959b q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-13 00:50:01 +01:00
Richard van der Hoff
10decf95f6 replace imports of q with bluebird
update `package.json`

```
find src test -name '*.js' |
    xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
    xargs perl -i -pe 'if (/import [qQ] /) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-13 00:48:31 +01:00
Richard van der Hoff
b2403d59b7 loading tests: wait for login component
Rather than a fixed delay, use matrix-react-test-utils to wait for the login
component to appear. Hopefully this will deflakify some tests.
2017-07-13 00:18:49 +01:00
Richard van der Hoff
bd1196716a Use external mock-request
mock-request is now factored out to matrix-mock-request; use it
2017-07-04 15:59:21 +01:00
Richard van der Hoff
ca3399df77 Clean up some log outputs from the integ tests 2017-06-20 17:41:21 +01:00
Richard van der Hoff
abf21675d5 Add some more logging to the tests
... to help diagnose when they fail
2017-06-20 16:24:04 +01:00
Richard van der Hoff
557d4ae4c1 Test 'return-to-app' functionality
Add a test for the 'log in as user' functionality, as well as the 'return to
app' functionality.
2017-06-19 10:47:36 +01:00
Richard van der Hoff
5a8a41ad50 Merge branch 'develop' into rav/fix_token_redirect 2017-06-19 09:05:19 +01:00
Richard van der Hoff
60be24c665 Rename promise 2017-06-19 09:04:24 +01:00
Richard van der Hoff
6df1574b8b onLoadCompleted is now onTokenLoginCompleted 2017-06-16 15:05:14 +01:00
Richard van der Hoff
f5b2a92e84 Give the login panel a bit longer to appear 2017-06-15 18:17:00 +01:00
Richard van der Hoff
1fcd462660 Tweak tests to match updates to matrixchat
Mostly this is just making it look at the `view` state rather than the
individual boolean flags.

One other tweak merits explanation: we now implement the initial
couldn't-register-as-guest login with an explicit switch to the LOGIN view,
which means that the URL gets updated to #/login.
2017-06-15 17:52:18 +01:00
Richard van der Hoff
584e4c04da Merge pull request #4313 from vector-im/rav/deflakify_joining_test
Attempts to deflakify the joining test
2017-06-15 16:29:37 +01:00
Richard van der Hoff
a7a7ffd84b Merge pull request #4315 from vector-im/rav/test_rts_login
Add a test for the login flow when there is a teamserver
2017-06-15 16:13:05 +01:00
Richard van der Hoff
a28af8bcc6 Extend timeouts in joining tests again
this seems to work? maybe?
2017-06-15 16:01:26 +01:00
Richard van der Hoff
43f56483aa Merge branch 'develop' into rav/deflakify_joining_test 2017-06-15 15:48:13 +01:00
Richard van der Hoff
ca736cfce8 fix test description
logs in, not registers
2017-06-15 14:54:32 +01:00
Richard van der Hoff
98e694646c Add a test for the login flow when there is a teamserver
- just to check it keeps working.
2017-06-15 02:17:24 +01:00
Richard van der Hoff
6f2eee1f03 Attempts to deflakify the joining test
Treat the waitTime passed into `flush` as a timeout rather than a
time-between-loops, so that we can pass in bigger times and not slow the tests
down too much.

Bump the timeout when waiting for /publicRooms and /initialSync in the joining
test.
2017-06-14 22:58:12 +01:00
Richard van der Hoff
4ca009b9f7 Remove onload simulator from loading test
This used to exist to reproduce the functionality in the window.onload handler
in vector/index.js -- which got removed in 31915db. Having it here is confusing
at best.
2017-06-14 18:01:44 +01:00
Richard van der Hoff
5ff59b0c23 Tests: delete indexeddbs after running 2017-06-14 17:08:49 +01:00
Richard van der Hoff
27d5704978 Improve logging in mock-request
Try to make it a bit more obvious what's been going on in mock-request: add
timestamps to lines, and an identifier so that where we have two flushes in
parallel, we can see what's what.
2017-06-14 16:59:46 +01:00
Richard van der Hoff
59da904353 Check that we don't register a guest account on /#/login (#4306)
If you go straight to a /#/login link, we shoudn't go registering guest
accounts or reanimating the saved creds.
2017-06-14 16:59:00 +01:00
Richard van der Hoff
aa07266f12 Test that we handle stored mx_last_room_id correctly
* Do we show the last room correctly on resume?
 * Do we show the home page if we have no last room?
 * If we follow a login link, and re-log-in, do we correctly vape the
   mx_last_room_id (#4283)
2017-06-13 12:52:35 +01:00
Luke Barnard
de334cccfd Expect to see HTTP /join/#some:alias when we the view knows it 2017-06-08 18:01:55 +01:00
David Baker
8e288e14bf Add more hacky q.delays
To work around the fact that we now do more trips around the
event loop to update view state (because of going vis the store).
Also add comment saying how horrible this is.
2017-06-06 15:59:24 +01:00
David Baker
15d0bd9271 Partially revert https://github.com/vector-im/riot-web/pull/4201
The q.delay is needed to make sure (or at least reasonably
sure...) that the login component has appeared by that point. The
done handler needs to be the error callback too otherwise failures
result in timeouts rather than the actual failure.
2017-06-06 15:54:45 +01:00
Luke Barnard
feaff9d99d Fix tests for new-guest-access
This time the test wasn't being flaky, but it does inspect a lot of the internal of RoomView, which has had some modifications recently. I've updated the test to reflect this and it passes locally.

Also, fix a bug in HomePage with an undeclared "error" which should be "err".

Let's see what Travis thinks of this!
2017-06-05 20:16:44 +01:00
Luke Barnard
6cc7fa3a36 Expect a HomePage now instead of a directory, because one is now shown by default 2017-05-30 12:55:50 +01:00
David Baker
e07f9a8bc9 Pass through i18n keys in karma tests 2017-05-26 15:29:58 +01:00
David Baker
9c7731e141 Don't include src in the test resolve root
As https://github.com/matrix-org/matrix-react-sdk/pull/931
2017-05-26 14:02:03 +01:00
Richard van der Hoff
ea67fa9c16 More riot-web test deflakification
Two changes:

1. wait longer for /sync to arrive in the loading tests, via an
   `expectAndAwaitSync` method.

2. https://github.com/matrix-org/matrix-react-sdk/pull/773 made it possible for
   MatrixChat to not show its syncing spinner despite `loading` being
   false. Update `awaitSyncingSpinner` accordingly, so that it doesn't fail
   when it happens to check MatrixChat at just taht moment.
2017-05-19 13:33:50 +01:00
Richard van der Hoff
f16086bbea Attempt to deflakify joining test
give the client a bit longer to get started.
2017-05-18 13:39:33 +01:00
Richard van der Hoff
f60773ae1f mock-request: improve logging
attempt to make the logging a bit more comprehensible
2017-05-18 13:37:23 +01:00
Richard van der Hoff
a39a7c8334 Update to more recent mock-request
Just copy-and-paste the updated version from js-sdk in here.
2017-05-18 12:18:57 +01:00
Richard van der Hoff
593e101521 Fix a flaky test
Depending on timing, the first `httpBackend.flush()` could end up just flushing
a '/presence' call rather than the initial sync. The fix to that is simply to
not set the expectation on /presence.

While we're there, split out the flushes of /publicRooms and
/thirdparty/protocols, so that we can be sure that they happen.

There is probably still a bunch of flakiness there, but this should fix one
particular instance.
2017-04-18 13:45:31 +01:00
Luke Barnard
e40d3852ff Fix tests to reflect recent changes
This is an attempt to reduce flakiness (see https://github.com/matrix-org/matrix-react-sdk/pull/781 also)
2017-03-29 16:07:11 +01:00
David Baker
c4d3d66f31 Support for phone number registration/signin, mk2
Changes from https://github.com/vector-im/riot-web/pull/3381
2017-03-14 14:45:54 +00:00
Richard van der Hoff
e5b3ec83b3 Revert "Support for phone number registration / signin (#3381)"
This reverts commit 271fedd1e9.

This breaks against the current synapse release. We need to think more
carefully about backwards compatibility.
2017-03-09 20:41:11 +00:00
David Baker
271fedd1e9 Support for phone number registration / signin (#3381)
* WIP msisdn signin (css)

* Changed how highlights are done

to support keyboard based navigation

* Support for new InteractiveAuth registration

* CSS for msisdn auth entry component

* CSS tweaks for msisdn login

* Fix tests
2017-03-09 10:58:58 +00:00
Kegan Dougal
d876e4482b Fix broken tests caused by adding IndexedDB support
This test assumed that `/sync` would be called immediately after rendering
`<MatrixChat />` but this isn't true in an IndexedDB world: it bounces via
`store.startup()` first.

It looks like the tests resolve this by adding `q.delay(1)` so that's what
I've done: in the future it would be better to extend `HttpBackend` to have
a `waitFor(req) Promise` function so we can removing timing from the tests.
2017-02-17 14:32:08 +00:00
Richard van der Hoff
5368c87dc1 Fix tests to run crypto code
Return a device_id from /login requests, so that all the crypto logic works.
2017-02-02 23:41:49 +00:00
Richard van der Hoff
fe64b04339 More test resilience
Give the tests more than one chance for the roomview to load.
2017-01-24 13:35:41 +00:00
Richard van der Hoff
597705716b Hopefully, fix intermittent test failure
This seeks to fix the intermittent failure of the "MatrixClient rehydrated from
stored credentials" tests.

The problem appears to be that the 'load_completed' is sometimes taking a while
to come through from the dispatcher - or rather, it is taking a long time to
get *sent* to the dispatcher: the chain of `q().then().catch().done()` in
componentDidMount can take a while to happen.

As a workaround, give the test a few goes when waiting for us to start
syncing. It's not ideal to be poking into the internal state of MatrixChat like
this, but it'll do for now.
2017-01-24 11:26:09 +00:00
David Baker
bc714ba3a0 Add eslint config
An early start that gets some linting in place.
2017-01-23 14:22:54 +00:00
David Baker
161978ab05 Fix tests 2016-12-16 15:20:52 +00:00