2018-02-21 18:39:53 -08:00
|
|
|
import { Selector as $ } from 'testcafe'
|
2018-04-17 18:38:27 -07:00
|
|
|
import {
|
2019-11-09 17:25:26 -05:00
|
|
|
favoritesCountElement,
|
|
|
|
getFavoritesCount,
|
2019-11-17 21:23:32 -05:00
|
|
|
getNthFavoritedLabel,
|
|
|
|
getNthRebloggedLabel,
|
2019-11-09 17:25:26 -05:00
|
|
|
getNthStatus,
|
|
|
|
getReblogsCount,
|
|
|
|
getUrl,
|
2018-04-17 18:38:27 -07:00
|
|
|
reblogsCountElement
|
|
|
|
} from '../utils'
|
2018-05-26 13:51:41 -07:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-02-21 18:39:53 -08:00
|
|
|
|
2018-03-06 21:32:51 -08:00
|
|
|
fixture`011-reblog-favorites-count.js`
|
2018-02-21 18:39:53 -08:00
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('shows favorites', async t => {
|
2018-05-26 13:51:41 -07:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 08:56:25 -08:00
|
|
|
.click(getNthStatus(1))
|
2018-03-05 22:36:54 -08:00
|
|
|
.expect(getUrl()).contains('/statuses/')
|
2019-11-09 17:25:26 -05:00
|
|
|
.expect(getNthStatus(1).exists).ok()
|
2018-02-24 14:49:28 -08:00
|
|
|
.expect(getFavoritesCount()).eql(2)
|
2018-04-17 18:38:27 -07:00
|
|
|
.expect(favoritesCountElement.getAttribute('aria-label')).eql('Favorited 2 times')
|
2019-11-17 21:23:32 -05:00
|
|
|
.expect(getNthFavoritedLabel(1)).eql('Unfavorite')
|
2018-08-26 15:38:45 -07:00
|
|
|
.click(favoritesCountElement)
|
2018-03-05 23:56:48 -08:00
|
|
|
.expect(getUrl()).match(/\/statuses\/[^/]+\/favorites/)
|
2018-02-21 18:39:53 -08:00
|
|
|
.expect($('.search-result-account-name').nth(0).innerText).eql('foobar')
|
|
|
|
.expect($('.search-result-account-username').nth(0).innerText).eql('@foobar')
|
|
|
|
.expect($('.search-result-account-name').nth(1).innerText).eql('admin')
|
|
|
|
.expect($('.search-result-account-username').nth(1).innerText).eql('@admin')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('shows boosts', async t => {
|
2018-05-26 13:51:41 -07:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 08:56:25 -08:00
|
|
|
.click(getNthStatus(1))
|
2018-03-05 22:36:54 -08:00
|
|
|
.expect(getUrl()).contains('/statuses/')
|
2019-11-09 17:25:26 -05:00
|
|
|
.expect(getNthStatus(1).exists).ok()
|
2018-02-24 14:49:28 -08:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
2018-04-17 18:38:27 -07:00
|
|
|
.expect(reblogsCountElement.getAttribute('aria-label')).eql('Boosted 1 time')
|
2019-11-17 21:23:32 -05:00
|
|
|
.expect(getNthRebloggedLabel(1)).eql('Boost')
|
2018-08-26 15:38:45 -07:00
|
|
|
.click(reblogsCountElement)
|
2018-03-05 23:56:48 -08:00
|
|
|
.expect(getUrl()).match(/\/statuses\/[^/]+\/reblogs/)
|
2018-02-21 18:39:53 -08:00
|
|
|
.expect($('.search-result-account-name').nth(0).innerText).eql('admin')
|
|
|
|
.expect($('.search-result-account-username').nth(0).innerText).eql('@admin')
|
|
|
|
})
|