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