2018-11-25 09:20:58 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-12-01 19:53:20 +00:00
|
|
|
import {
|
|
|
|
generalSettingsButton,
|
|
|
|
getNthShowOrHideButton,
|
|
|
|
getNthStatus, homeNavButton,
|
|
|
|
notificationsNavButton,
|
|
|
|
scrollToStatus,
|
|
|
|
settingsNavButton
|
|
|
|
} from '../utils'
|
|
|
|
import { Selector as $ } from 'testcafe'
|
2019-03-31 17:21:57 +01:00
|
|
|
|
2018-11-25 09:20:58 +00:00
|
|
|
import { homeTimeline } from '../fixtures'
|
|
|
|
|
|
|
|
fixture`022-status-aria-label.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('basic aria-labels for statuses', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/quux, pinned toot 1, .+ ago, @quux, Unlisted, Boosted by admin/i
|
|
|
|
)
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(2).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/admin, @foobar notification of unlisted message, .* ago, @admin, Unlisted/i
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('aria-labels for CWed statuses', async t => {
|
|
|
|
await loginAsFoobar(t)
|
2019-08-03 21:49:37 +01:00
|
|
|
const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
2019-02-28 16:56:25 +00:00
|
|
|
await scrollToStatus(t, 1 + kittenIdx)
|
2018-11-25 09:20:58 +00:00
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/foobar, Content warning: kitten CW, .* ago, @foobar, Public/i
|
|
|
|
)
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthShowOrHideButton(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/foobar, here's a kitten with a CW, .* ago, @foobar, Public/i
|
|
|
|
)
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthShowOrHideButton(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/foobar, Content warning: kitten CW, .* ago, @foobar, Public/i
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('aria-labels for notifications', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.click(notificationsNavButton)
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2020-11-29 22:13:27 +00:00
|
|
|
/admin favorited your toot, foobar, this is unlisted, .* ago, @foobar, Unlisted/i
|
2018-11-25 09:20:58 +00:00
|
|
|
)
|
|
|
|
.hover(getNthStatus(2))
|
|
|
|
.expect(getNthStatus(2).getAttribute('aria-label')).match(
|
2020-11-29 22:13:27 +00:00
|
|
|
/admin boosted your toot, foobar, this is unlisted, .* ago, @foobar, Unlisted/i
|
2018-11-25 09:20:58 +00:00
|
|
|
)
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(3))
|
|
|
|
.expect(getNthStatus(3).getAttribute('aria-label')).match(
|
|
|
|
/admin, @foobar notification of unlisted message, .* ago, @admin, Unlisted/i
|
2018-11-25 09:20:58 +00:00
|
|
|
)
|
|
|
|
await scrollToStatus(t, 5)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(5))
|
|
|
|
.expect(getNthStatus(5).getAttribute('aria-label')).match(
|
2019-02-28 16:56:25 +00:00
|
|
|
/admin, @foobar notification of direct message, .* ago, @admin, Direct/i
|
|
|
|
)
|
|
|
|
await scrollToStatus(t, 6)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(6))
|
|
|
|
.expect(getNthStatus(6).getAttribute('aria-label')).match(
|
2018-11-25 09:20:58 +00:00
|
|
|
/quux followed you, @quux/i
|
|
|
|
)
|
|
|
|
})
|
2018-12-01 19:53:20 +00:00
|
|
|
|
|
|
|
test('can shorten aria-labels', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.click(settingsNavButton)
|
|
|
|
.click(generalSettingsButton)
|
|
|
|
.click($('#choice-disable-long-aria-labels'))
|
|
|
|
.click(homeNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2020-11-29 22:13:27 +00:00
|
|
|
/Unlisted toot by quux/
|
2018-12-01 19:53:20 +00:00
|
|
|
)
|
|
|
|
.click(settingsNavButton)
|
|
|
|
.click(generalSettingsButton)
|
|
|
|
.click($('#choice-disable-long-aria-labels'))
|
|
|
|
.click(homeNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2018-12-01 19:53:20 +00:00
|
|
|
/quux, pinned toot 1, .+ ago, @quux, Unlisted, Boosted by admin/i
|
|
|
|
)
|
|
|
|
})
|