pinafore/tests/spec/011-reblog-favorites-count.js

40 wiersze
1.6 KiB
JavaScript
Czysty Zwykły widok Historia

2018-02-22 02:39:53 +00:00
import { Selector as $ } from 'testcafe'
import {
favoritesCountElement, getFavoritesCount, getNthStatus, getReblogsCount, getUrl,
reblogsCountElement
} from '../utils'
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 => {
await loginAsFoobar(t)
await t
2018-02-22 02:39:53 +00:00
.click(getNthStatus(0))
2018-03-06 06:36:54 +00:00
.expect(getUrl()).contains('/statuses/')
2018-02-24 22:49:28 +00:00
.expect(getFavoritesCount()).eql(2)
.expect(favoritesCountElement.getAttribute('aria-label')).eql('Favorited 2 times')
2018-02-22 02:39:53 +00:00
.expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true')
.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 => {
await loginAsFoobar(t)
await t
2018-02-22 02:39:53 +00:00
.click(getNthStatus(0))
2018-03-06 06:36:54 +00:00
.expect(getUrl()).contains('/statuses/')
2018-02-24 22:49:28 +00:00
.expect(getReblogsCount()).eql(1)
.expect(reblogsCountElement.getAttribute('aria-label')).eql('Boosted 1 time')
2018-02-22 02:39:53 +00:00
.expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false')
.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')
})