pinafore/tests/spec/101-reblog-unreblog.js
Nolan Lawson 0964442815
chore(travis): update to mastodon v2.6.1 (#630)
* chore(travis): update to mastodon v2.6.1

* check if mastodon v2.6.1 has a race condition

* apparently in 2.6.1 direct messages no longer appear in home timeline

* Revert "check if mastodon v2.6.1 has a race condition"

This reverts commit dde8ef8be58eda0563170e6b73165fdcbea54f6b.

* try to fix tests

* fix more tests
2018-11-12 12:59:47 -08:00

82 lines
2.5 KiB
JavaScript

import {
getNthReblogButton, getNthReblogged, getNthStatus, getReblogsCount, getUrl, homeNavButton,
notificationsNavButton,
scrollToBottomOfTimeline, scrollToTopOfTimeline
} from '../utils'
import { loginAsFoobar } from '../roles'
fixture`101-reblog-unreblog.js`
.page`http://localhost:4002`
test('reblogs a status', async t => {
await loginAsFoobar(t)
await t
.hover(getNthStatus(0))
.expect(getNthReblogged(0)).eql('false')
.click(getNthReblogButton(0))
.expect(getNthReblogged(0)).eql('true')
// scroll down and back up to force an unrender
await scrollToBottomOfTimeline(t)
await scrollToTopOfTimeline(t)
await t
.hover(getNthStatus(0))
.expect(getNthReblogged(0)).eql('true')
.click(notificationsNavButton)
.click(homeNavButton)
.expect(getNthReblogged(0)).eql('true')
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.click(homeNavButton)
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthReblogged(0)).eql('true')
.click(getNthReblogButton(0))
.expect(getNthReblogged(0)).eql('false')
})
test('unreblogs a status', async t => {
await loginAsFoobar(t)
await t
.hover(getNthStatus(3))
.expect(getNthReblogged(3)).eql('false')
.click(getNthReblogButton(3))
.expect(getNthReblogged(3)).eql('true')
.click(getNthReblogButton(3))
.expect(getNthReblogged(3)).eql('false')
// scroll down and back up to force an unrender
await scrollToBottomOfTimeline(t)
await scrollToTopOfTimeline(t)
await t
.hover(getNthStatus(3))
.expect(getNthReblogged(3)).eql('false')
.click(notificationsNavButton)
.click(homeNavButton)
.expect(getNthReblogged(3)).eql('false')
.click(notificationsNavButton)
.navigateTo('/')
.expect(getNthReblogged(3)).eql('false')
.click(getNthReblogButton(3))
.expect(getNthReblogged(3)).eql('true')
})
test('Keeps the correct reblogs count', async t => {
await loginAsFoobar(t)
await t
.hover(getNthStatus(3))
.expect(getNthReblogged(3)).eql('true')
.click(getNthStatus(3))
.expect(getUrl()).contains('/status')
.expect(getNthReblogged(0)).eql('true')
.expect(getReblogsCount()).eql(2)
.click(homeNavButton)
.expect(getUrl()).eql('http://localhost:4002/')
.hover(getNthStatus(3))
.click(getNthReblogButton(3))
.expect(getNthReblogged(3)).eql('false')
.click(getNthStatus(3))
.expect(getUrl()).contains('/status')
.expect(getNthReblogged(0)).eql('false')
.expect(getReblogsCount()).eql(1)
})