diff --git a/tests/spec/117-pin-unpin.js b/tests/spec/117-pin-unpin.js index ef2d7088..b4049ea0 100644 --- a/tests/spec/117-pin-unpin.js +++ b/tests/spec/117-pin-unpin.js @@ -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') +}) diff --git a/tests/utils.js b/tests/utils.js index 12ce9bd5..27219590 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -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]