test: add test
This commit is contained in:
parent
08593d0dbb
commit
5bbbc91747
|
@ -14,7 +14,7 @@ import {
|
|||
getActiveElementTagName,
|
||||
getActiveElementClassList,
|
||||
getNthStatusSensitiveMediaButton,
|
||||
getActiveElementAriaLabel, settingsNavButton, getActiveElementHref, communityNavButton
|
||||
getActiveElementAriaLabel, settingsNavButton, getActiveElementHref, communityNavButton, getActiveElementId
|
||||
} from '../utils'
|
||||
import { loginAsFoobar } from '../roles'
|
||||
import { Selector as $ } from 'testcafe'
|
||||
|
@ -73,6 +73,22 @@ test('timeline link preserves focus', async t => {
|
|||
.expect(getActiveElementInsideNthStatus()).eql('1')
|
||||
})
|
||||
|
||||
test('timeline link preserves focus - reblogger avatar', async t => {
|
||||
await loginAsFoobar(t)
|
||||
await t
|
||||
.expect(getNthStatus(1).exists).ok({ timeout: 20000 })
|
||||
|
||||
const avatar = `${getNthStatusSelector(1)} .status-header-avatar a`
|
||||
const id = await $(avatar).getAttribute('id')
|
||||
await t
|
||||
.click($(avatar))
|
||||
.expect(getUrl()).contains('/accounts/')
|
||||
.click(goBackButton)
|
||||
.expect(getUrl()).eql('http://localhost:4002/')
|
||||
.expect(getNthStatus(1).exists).ok()
|
||||
.expect(getActiveElementId()).eql(id)
|
||||
})
|
||||
|
||||
test('notification timeline preserves focus', async t => {
|
||||
await loginAsFoobar(t)
|
||||
await t
|
||||
|
|
|
@ -169,6 +169,10 @@ export const getActiveElementInnerText = exec(() =>
|
|||
(document.activeElement && document.activeElement.innerText) || ''
|
||||
)
|
||||
|
||||
export const getActiveElementId = exec(() =>
|
||||
(document.activeElement && document.activeElement.id) || ''
|
||||
)
|
||||
|
||||
export const getActiveElementRectTop = exec(() => (
|
||||
(document.activeElement && document.activeElement.getBoundingClientRect().top) || -1
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue