add another test

This commit is contained in:
Nolan Lawson 2018-04-29 11:42:17 -07:00
parent 3afd095fe0
commit cb4580875b
2 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import { foobarRole } from '../roles'
import { postAs } from '../serverActions'
import {
avatarInComposeBox, getNthDialogOptionsOption, getNthPinnedStatus, getNthStatus,
avatarInComposeBox, getNthDialogOptionsOption, getNthPinnedStatus, getNthPinnedStatusFavoriteButton, getNthStatus,
getNthStatusOptionsButton, getUrl, sleep
} from '../utils'
import { users } from '../users'
@ -38,3 +38,14 @@ test('Can pin statuses', async t => {
.expect(getNthPinnedStatus(0).innerText).contains('this is unlisted')
.expect(getNthStatus(0).innerText).contains('I am going to pin this')
})
test('Can favorite a pinned status', async t => {
await t.useRole(foobarRole)
.click(avatarInComposeBox)
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('1')
.expect(getNthPinnedStatusFavoriteButton(0).getAttribute('aria-pressed')).eql('false')
.click(getNthPinnedStatusFavoriteButton(0))
.expect(getNthPinnedStatusFavoriteButton(0).getAttribute('aria-pressed')).eql('true')
.click(getNthPinnedStatusFavoriteButton(0))
.expect(getNthPinnedStatusFavoriteButton(0).getAttribute('aria-pressed')).eql('false')
})

View File

@ -229,6 +229,10 @@ export function getNthPinnedStatus (n) {
return $(`.pinned-statuses article[aria-posinset="${n}"]`)
}
export function getNthPinnedStatusFavoriteButton (n) {
return getNthPinnedStatus(n).find('.status-toolbar button:nth-child(3)')
}
export async function validateTimeline (t, timeline) {
for (let i = 0; i < timeline.length; i++) {
let status = timeline[i]