Commit Graph

112 Commits (9be700afa45c26d7e9e7d466c7919a8ba9533074)

Author SHA1 Message Date
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 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 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
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 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 161978ab05 Fix tests 2016-12-16 15:20:52 +00:00
David Baker 67cf4230ac Fix broken tests
Promises are now not being resolved within the same tick, so give
another tick for the UI to update after all the HTTP calls have
flushed through. This is fairly terrible, but I can't immediately
see a better way of doing this.
2016-12-09 14:27:41 +00:00
David Baker d65374f7f9 Make the 'loading' tests work in isolation
The 'loading' tests only worked when run with the other tests and
failed if you just ran the file by itself, because the skin was
loading in the 'joining' tests, but not here.
2016-12-09 10:31:26 +00:00
David Baker 3938abc5dd add webkit vendor prefixed properties
for mavericks safari
2016-09-23 17:18:52 +01:00
David Baker d0618c4f49 Update test now that /publicRooms is a post 2016-09-16 20:49:28 +01:00
Richard van der Hoff 244265d52b Make sure that we clear localstorage before *all* tests
This was causing flaky tests, as sometimes the joining test would inherit an
"mx_is_guest" setting from a previous test run.
2016-08-11 11:42:29 +01:00
Richard van der Hoff da7a556629 More tests for the loading process:
1. Check that localstorage is correctly updated on successful login (test for
   https://github.com/matrix-org/matrix-react-sdk/pull/404)

2. Check that the saved HS isused for guest registration (test for
   https://github.com/matrix-org/matrix-react-sdk/pull/405)

3. Test loginToken handling (test for
   https://github.com/matrix-org/matrix-react-sdk/pull/406 /
   https://github.com/vector-im/vector-web/pull/1946)
2016-08-11 02:00:27 +01:00
Richard van der Hoff dd6868c255 Fix joining test
This had been broken by
https://github.com/matrix-org/matrix-react-sdk/pull/399. Change the way we
populate the matrixclient used for the joining tests.
2016-08-10 22:39:53 +01:00
Richard van der Hoff fe4bb3e413 More app-loading tests
1. fix the 'Clean load' tests which had been broken by
https://github.com/matrix-org/matrix-react-sdk/pull/399: make sure we clear
localStorage between tests.

2. Test the session rehydration properly by setting the localStorage rather
than setting up the MatrixClientPeg before loading the app.

3. Add some tests for the auto-guest-registration flows.
2016-08-10 14:37:30 +01:00
Richard van der Hoff afc889ff4d Some tests of the application load process 2016-08-10 00:15:04 +01:00
David Baker c9ab977d73 Fix unit tests
ReplaceUsingAccessToken was, uh, replaced with replacedUsingCreds
2016-08-05 14:38:10 +01:00
David Baker 607923b58f Fix test since we peek by room ID, not alias 2016-06-17 17:49:36 +01:00
Richard van der Hoff bf31d6d5fa Karma test tweaks
* Make sure we only get one js-sdk (and update runtime config to match)
* Don't verifyNoOutstandingRequests (since it is hard to be certain which we
  will get, and makes the tests too dependent on implementation-specifics).
* Disable color for npm test, to avoid confusing Jenkins
2016-04-13 17:41:23 +01:00
Richard van der Hoff 181a6a61ff tests: Don't add the div to the DOM 2016-04-13 17:20:06 +01:00
Richard van der Hoff 322af6513d Run some tests under karma
Including a regression test for
https://github.com/vector-im/vector-web/issues/1314
2016-04-13 17:20:06 +01:00
Richard van der Hoff 69ce3c43cf Revert "Merge branch 'develop' into rav/karma"
The karma tests don't pass yet, and aren't ready to land on develop.

This reverts commit 438453e61a, reversing
changes made to 50f94eb040.
2016-04-13 17:17:45 +01:00
Richard van der Hoff a512e600a7 tests: Don't add the div to the DOM 2016-04-13 11:16:38 +01:00
Richard van der Hoff 429d110212 Run some tests under karma
Including a regression test for
https://github.com/vector-im/vector-web/issues/1314
2016-04-13 10:15:04 +01:00