2018-11-25 10:20:58 +01:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-12-01 20:53:20 +01:00
|
|
|
import {
|
|
|
|
generalSettingsButton,
|
|
|
|
getNthShowOrHideButton,
|
2021-04-03 02:01:08 +02:00
|
|
|
getNthStatus, getNthStatusRelativeDateTime, homeNavButton,
|
2018-12-01 20:53:20 +01:00
|
|
|
notificationsNavButton,
|
|
|
|
scrollToStatus,
|
|
|
|
settingsNavButton
|
|
|
|
} from '../utils'
|
|
|
|
import { Selector as $ } from 'testcafe'
|
2019-03-31 18:21:57 +02:00
|
|
|
|
2018-11-25 10:20:58 +01: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 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2018-11-25 10:20:58 +01:00
|
|
|
/quux, pinned toot 1, .+ ago, @quux, Unlisted, Boosted by admin/i
|
|
|
|
)
|
2021-04-03 02:01:08 +02:00
|
|
|
.expect(getNthStatusRelativeDateTime(1).getAttribute('aria-label')).match(
|
|
|
|
/.* ago - click to show thread/i
|
|
|
|
)
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(2).getAttribute('aria-label')).match(
|
2018-11-25 10:20:58 +01: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 22:49:37 +02:00
|
|
|
const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
2019-02-28 17:56:25 +01:00
|
|
|
await scrollToStatus(t, 1 + kittenIdx)
|
2018-11-25 10:20:58 +01:00
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 10:20:58 +01:00
|
|
|
/foobar, Content warning: kitten CW, .* ago, @foobar, Public/i
|
|
|
|
)
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthShowOrHideButton(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 10:20:58 +01:00
|
|
|
/foobar, here's a kitten with a CW, .* ago, @foobar, Public/i
|
|
|
|
)
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthShowOrHideButton(1 + kittenIdx))
|
|
|
|
.expect(getNthStatus(1 + kittenIdx).getAttribute('aria-label')).match(
|
2018-11-25 10:20:58 +01: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 23:13:27 +01:00
|
|
|
/admin favorited your toot, foobar, this is unlisted, .* ago, @foobar, Unlisted/i
|
2018-11-25 10:20:58 +01:00
|
|
|
)
|
|
|
|
.hover(getNthStatus(2))
|
|
|
|
.expect(getNthStatus(2).getAttribute('aria-label')).match(
|
2020-11-29 23:13:27 +01:00
|
|
|
/admin boosted your toot, foobar, this is unlisted, .* ago, @foobar, Unlisted/i
|
2018-11-25 10:20:58 +01:00
|
|
|
)
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(3))
|
|
|
|
.expect(getNthStatus(3).getAttribute('aria-label')).match(
|
|
|
|
/admin, @foobar notification of unlisted message, .* ago, @admin, Unlisted/i
|
2018-11-25 10:20:58 +01:00
|
|
|
)
|
|
|
|
await scrollToStatus(t, 5)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(5))
|
|
|
|
.expect(getNthStatus(5).getAttribute('aria-label')).match(
|
2019-02-28 17:56:25 +01: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 10:20:58 +01:00
|
|
|
/quux followed you, @quux/i
|
|
|
|
)
|
|
|
|
})
|
2018-12-01 20:53:20 +01: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 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2020-11-29 23:13:27 +01:00
|
|
|
/Unlisted toot by quux/
|
2018-12-01 20:53:20 +01:00
|
|
|
)
|
|
|
|
.click(settingsNavButton)
|
|
|
|
.click(generalSettingsButton)
|
|
|
|
.click($('#choice-disable-long-aria-labels'))
|
|
|
|
.click(homeNavButton)
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2018-12-01 20:53:20 +01:00
|
|
|
/quux, pinned toot 1, .+ ago, @quux, Unlisted, Boosted by admin/i
|
|
|
|
)
|
|
|
|
})
|