Commit Graph

33 Commits (5f413ddf8bd3cc376eedf2664067ae3ecca2bac3)

Author SHA1 Message Date
Luke Barnard d3f9a3aeb5 Run eslint --fix
Fixing 1000s of lint issues. Some rules cannot be `--fix`ed but this goes some way to linting the entire codebase.
2017-10-11 17:56:17 +01:00
David Baker 609d61d53c Revert "Implement sticky date separators" 2017-09-06 17:40:58 +01:00
Luke Barnard 69bce6aee5 Update tests to reflect not supressing first date separator 2017-08-30 17:35:26 +01:00
Richard van der Hoff 0d7cc59d99 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-12 18:05:40 +01:00
Richard van der Hoff 0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff a06bd84213 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-12 18:05:08 +01:00
Richard van der Hoff 1139dd2be5 Fix a flaky test in the timelinepanel code
Sometimes it was possible for there to be a scroll event before the initial
pagination completed, which then upset the rest of the test. Just give it a few
ms to sort itself out instead.
2017-07-11 17:34:46 +01:00
Richard van der Hoff cd1cf09dc9 Make tests pass on Chrome again
It seems that a number of the tests had started failing when run in
Chrome. They were fine under PhantomJS, but the MegolmExport tests only work
under Chrome, and I need them to work...

Mostly the problems were timing-related, where assumptions made about how
quickly the `then` handler on a promise would be called were no longer
valid. Possibly Chrome 55 has made some changes to the relative priorities of
setTimeout and sendMessage calls.

One of the TimelinePanel tests was failing because it was expecting the contents
of a div to take up more room than they actually were. It's possible this is
something very environment-specific; hopefully the new value will work on a
wider range of machines.

Also some logging tweaks.
2017-01-31 22:40:53 +00:00
Luke Barnard 8a6ed1d7e9 Do not assume unpagination will occur during scroll test 2016-11-22 17:43:45 +00:00
Luke Barnard cf41155610 Test TimelinePanel canForwardPaginate (#561)
Fix scroll up, down pagination test

NB: this test may not fail on Travis, although it did fail locally without a fix: #563.

Once the test has scrolled the panel to the top, to the earliest events, it should be able to forward paginate, because some degree of unpagination occurs. This does assume that unpagination will occur when scrolling to the beginning of the events and that unpagination should allow pagination again in the same direction.

Instead of checking that the first event is no longer the first event (varies due to unpagination), check instead that the most recent event can be seen when scrolling all the way down to the bottom of the TimelinePanel.

Scrolling past the bottom of content seems to have strange behaviour, which isn't a useful part of the test. So now the test will scroll down until the last event instead.
2016-11-18 11:44:45 +00:00
Luke Barnard b718f1542c Fix infinite loop when there are a lot of invisible events (#554)
Instead of using a window of a fixed number of events, unpaginate based on the distance of the viewport from the end of the scroll range.

The ScrollPanel uses the scrollTokens to convey to its parent (the TimelinePanel, in this case) the point to unpaginate up to. The TimelinePanel then takes a chunk of events off the front or back of `this.state.events` using `timelineWindow.unpaginate`.

Fixes https://github.com/vector-im/vector-web/issues/2020
2016-11-16 14:25:52 +00:00
Richard van der Hoff 22757cfcd3 Inject MatrixClient into React context in tests
Now that EventTile expects MatrixClient in the context, we had better provide
it.
2016-11-14 18:22:56 +00:00
Richard van der Hoff 388839a094 PR feedback 2016-10-11 14:59:35 +01:00
Richard van der Hoff 24bc90f9cc Fix flaky TimelinePanel test
The 'should load new events even if you are scrolled up' test was sometimes
failing. It turned out that pagination *sometimes* wasn't starting soon enough
after setting the scrollTop, and awaitPaginationCompletion was incorrectly
believing it to have already been and gone.

Add an awaitScroll to make sure that we wait long enough for the pagination to
begin.
2016-10-11 14:20:40 +01:00
Matthew Hodgson 4aef352a5c update to use new API based on js-sdk PR input 2016-09-08 22:48:44 +01:00
Matthew Hodgson 334564c814 unbreak tests 2016-09-07 22:54:38 +01:00
Matthew Hodgson e22d0a53b6 WIP switch-over of TimePanel from taking Rooms to taking EventTimelineSets 2016-09-07 22:54:37 +01:00
Richard van der Hoff dd77cd74d1 Add text prefix to test event content 2016-08-25 15:13:28 +01:00
Richard van der Hoff 6bcf9cc9db TimelinePanel-test: Hackery to make it pass 2016-08-24 17:30:53 +01:00
Richard van der Hoff cdd2902b01 Update annoying TimelinePanel test
* Actually test what we were supposed to be testing (viz, that we can paginate
  back down after we hit the top of the room)

* Make the cap on the number of events we show in the timeline a configurable
  property, so that we can set it in the test

* Use a smaller cap in the test, so that we have to do less paginating to hit
  the cap, to make the test run quicker.

* add some more logging so that we can see how far it's got if it gets stuck.
2016-08-24 16:28:00 +01:00
Richard van der Hoff 70c0290aec Fix TimelinePanel test
https://github.com/matrix-org/matrix-react-sdk/pull/422 made events take up
less vertical space, so we now need more of them to allow us to scroll back.
2016-08-23 14:39:44 +01:00
Richard van der Hoff 8a57881618 Add more logging to TimelinePanel-test
In an attempt to figure out why this is timing out sometimes, add even more
debugging.
2016-08-03 15:24:56 +01:00
David Baker a5272542ef Lengthen timelinepanel test timeout again
It's now hitting this timeout on the jenkins box instead of the browser disconnect timeout
2016-07-14 10:40:12 +01:00
Kegsay 20210e7104 Log scrollTop and scrollHeight to try to debug flakey test
Sometimes it fails because awaitScroll() on :277 isn't resolving because onScroll isn't firing. We need to know if this is because we aren't changing scrollTop
2016-07-14 10:38:24 +01:00
David Baker a2b64798f7 Fix timelinepanel test timeout
The previous fix was adjusting the wrong timeout: it's hitting browserNoActivityTimeout, so revert previous fix & do this instead
2016-07-05 14:35:34 +01:00
David Baker 1c280badde Increase timeout on TimelinePanel test
Since it looks like this timeout sometimes isn't sufficient to scroll all the way up when jenkins is very busy
2016-06-23 18:36:44 +01:00
David Baker dc50a0f24a Add logging to TimelinePanel test
to see where it fails on jenkins
2016-06-23 16:20:40 +01:00
Richard van der Hoff 30f273c611 Merge pull request #283 from matrix-org/rav/issue_1427
Fix bug which stopped us scrolling down after we scrolled up
2016-04-21 14:26:42 +01:00
Richard van der Hoff f551317b5d Unmount TimelinePanel when test completes
... mostly because it seems like a nice idea.
2016-04-21 14:23:41 +01:00
Richard van der Hoff 2f435f4836 Fix bug which stopped us scrolling down after we scrolled up
Make sure that, if we scroll up enough to move the timelinewindow away from the
end of the timeline, we reset the canForwardPaginate flag.
2016-04-21 14:20:12 +01:00
Richard van der Hoff dcd81da856 Fix test failures introduced by last PR 2016-04-19 21:10:23 +01:00
Richard van der Hoff e051d1528c Remember to load new timeline events
Fixes a bug where we wouldn't load new timeline events if they arrived when we
were scrolled up (https://github.com/vector-im/vector-web/issues/1367)
2016-04-11 14:05:04 +01:00
Richard van der Hoff 15d0df5d3b Stop trying to paginate after we get a failure
Once TimelineWindow.paginate fails to return any results, set
can*Paginate=false, and use it as a flag to stop us trying to paginate any
further.
2016-04-08 15:05:15 +01:00