2019-05-29 05:46:01 +00:00
|
|
|
import {
|
|
|
|
settingsNavButton,
|
|
|
|
homeNavButton,
|
|
|
|
disableInfiniteScroll,
|
|
|
|
scrollToStatus,
|
|
|
|
loadMoreButton, getFirstVisibleStatus, scrollFromStatusToStatus, sleep, getActiveElementAriaPosInSet
|
|
|
|
} from '../utils'
|
|
|
|
import { loginAsFoobar } from '../roles'
|
|
|
|
import { Selector as $ } from 'testcafe'
|
2021-01-25 02:26:40 +00:00
|
|
|
import { homeTimeline } from '../fixtures'
|
2019-05-29 05:46:01 +00:00
|
|
|
|
|
|
|
fixture`036-disable-infinite-load.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Can disable loading items at bottom of timeline', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t.click(settingsNavButton)
|
|
|
|
.click($('a').withText('General'))
|
|
|
|
.click(disableInfiniteScroll)
|
|
|
|
.expect(disableInfiniteScroll.checked).ok()
|
|
|
|
.click(homeNavButton)
|
|
|
|
.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql('20')
|
|
|
|
await scrollToStatus(t, 20)
|
|
|
|
await t
|
|
|
|
.click(loadMoreButton)
|
|
|
|
.expect(getActiveElementAriaPosInSet()).eql('20')
|
|
|
|
.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql('40')
|
|
|
|
await scrollFromStatusToStatus(t, 20, 40)
|
|
|
|
await t
|
|
|
|
.click(loadMoreButton)
|
|
|
|
.expect(getActiveElementAriaPosInSet()).eql('40')
|
2021-01-25 02:26:40 +00:00
|
|
|
.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql(homeTimeline.length.toString())
|
2019-05-29 05:46:01 +00:00
|
|
|
await scrollFromStatusToStatus(t, 40, 47)
|
|
|
|
await t
|
|
|
|
.click(loadMoreButton)
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
|
|
|
.expect(loadMoreButton.exists).ok()
|
2021-01-25 02:26:40 +00:00
|
|
|
.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql(homeTimeline.length.toString())
|
2019-05-29 05:46:01 +00:00
|
|
|
})
|