2018-05-26 22:51:41 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-04-29 21:28:44 +02:00
|
|
|
import {
|
2018-05-26 22:51:41 +02:00
|
|
|
avatarInComposeBox, composeInput, getNthDialogOptionsOption, getNthPinnedStatus, getNthPinnedStatusFavoriteButton,
|
|
|
|
getNthStatus,
|
|
|
|
getNthStatusOptionsButton, getUrl, postStatusButton
|
2018-04-29 21:28:44 +02:00
|
|
|
} from '../utils'
|
|
|
|
import { users } from '../users'
|
|
|
|
|
|
|
|
fixture`117-pin-unpin.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Can pin statuses', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.typeText(composeInput, 'I am going to pin this', {paste: true})
|
|
|
|
.click(postStatusButton)
|
|
|
|
.expect(getNthStatus(0).innerText).contains('I am going to pin this')
|
|
|
|
.click(avatarInComposeBox)
|
2018-04-29 21:28:44 +02:00
|
|
|
.expect(getUrl()).contains(`/accounts/${users.foobar.id}`)
|
|
|
|
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('1')
|
|
|
|
.expect(getNthPinnedStatus(0).innerText).contains('this is unlisted')
|
|
|
|
.expect(getNthStatus(0).innerText).contains('I am going to pin this')
|
|
|
|
.click(getNthStatusOptionsButton(0))
|
|
|
|
.expect(getNthDialogOptionsOption(1).innerText).contains('Delete')
|
|
|
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Pin to profile')
|
|
|
|
.click(getNthDialogOptionsOption(2))
|
|
|
|
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('2')
|
|
|
|
.expect(getNthPinnedStatus(0).innerText).contains('I am going to pin this')
|
|
|
|
.expect(getNthPinnedStatus(1).innerText).contains('this is unlisted')
|
|
|
|
.expect(getNthStatus(0).innerText).contains('I am going to pin this')
|
|
|
|
.click(getNthStatusOptionsButton(0))
|
|
|
|
.expect(getNthDialogOptionsOption(1).innerText).contains('Delete')
|
|
|
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Unpin from profile')
|
|
|
|
.click(getNthDialogOptionsOption(2))
|
|
|
|
.expect(getUrl()).contains(`/accounts/${users.foobar.id}`)
|
|
|
|
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('1')
|
|
|
|
.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 => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-04-29 21:28:44 +02:00
|
|
|
.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')
|
|
|
|
})
|