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