2018-08-28 15:45:15 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
|
|
|
import {
|
|
|
|
getFavoritesCount,
|
|
|
|
getNthStatus, getNthStatusContent, getReblogsCount, homeNavButton
|
|
|
|
} from '../utils'
|
|
|
|
import { favoriteStatusAs, postAs, reblogStatusAs } from '../serverActions'
|
|
|
|
|
|
|
|
fixture`119-status-counts-update.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Fav stats update', async t => {
|
2019-08-03 22:49:37 +02:00
|
|
|
const status = await postAs('foobar', 'hey hello look at this toot')
|
|
|
|
const statusId = status.id
|
2018-08-28 15:45:15 +02:00
|
|
|
await favoriteStatusAs('admin', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('hey hello look at this toot')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getFavoritesCount()).eql(1)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('quux', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getFavoritesCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getFavoritesCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('LockedAccount', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getFavoritesCount()).eql(4)
|
|
|
|
})
|
|
|
|
|
2019-11-18 03:23:32 +01:00
|
|
|
test('Boost stats update', async t => {
|
2019-08-03 22:49:37 +02:00
|
|
|
const status = await postAs('foobar', 'oh why hello it looks like another toot')
|
|
|
|
const statusId = status.id
|
2018-08-28 15:45:15 +02:00
|
|
|
await reblogStatusAs('admin', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('oh why hello it looks like another toot')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await reblogStatusAs('quux', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await reblogStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
2019-05-06 00:02:14 +02:00
|
|
|
await reblogStatusAs('ExternalLinks', statusId)
|
2018-08-28 15:45:15 +02:00
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(4)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Fav and reblog stats update for a boosted toot', async t => {
|
2019-08-03 22:49:37 +02:00
|
|
|
const status = await postAs('ExternalLinks', 'this will get boosted')
|
|
|
|
const statusId = status.id
|
2018-08-28 15:45:15 +02:00
|
|
|
await reblogStatusAs('admin', statusId)
|
|
|
|
await favoriteStatusAs('admin', statusId)
|
|
|
|
await favoriteStatusAs('quux', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('this will get boosted')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('LockedAccount', statusId)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 15:45:15 +02:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(4)
|
|
|
|
})
|