test: add test

This commit is contained in:
Nolan Lawson 2021-03-21 13:55:18 -07:00
parent 4ded562e93
commit 1b25a1a6dd
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,28 @@
import {
settingsNavButton,
homeNavButton,
getFirstVisibleStatus,
getUrl,
disableRelativeTimestamps, getNthStatus, getNthStatusRelativeDate
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
fixture`041-wellness.js`
.page`http://localhost:4002`
test('Can disable relative time stamps', async t => {
await loginAsFoobar(t)
await t
.expect(getFirstVisibleStatus().exists).ok()
.expect(getNthStatusRelativeDate(1).innerText).match(/\bago\b/i)
.click(settingsNavButton)
.click($('a').withText('Wellness'))
.click(disableRelativeTimestamps)
.expect(disableRelativeTimestamps.checked).ok()
.click(homeNavButton)
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getFirstVisibleStatus().exists).ok()
.expect(getNthStatusRelativeDate(1).innerText).notMatch(/\bago\b/i)
.expect(getNthStatus(1).getAttribute('aria-label')).notMatch(/\bago\b/i)
})

View File

@ -55,6 +55,7 @@ export const neverMarkMediaSensitiveInput = $('#choice-never-mark-media-sensitiv
export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names')
export const disableInfiniteScroll = $('#choice-disable-infinite-scroll')
export const disableUnreadNotifications = $('#choice-disable-unread-notification-counts')
export const disableRelativeTimestamps = $('#choice-disable-relative-timestamps')
export const leftRightChangesFocus = $('#choice-left-right-focus')
export const disableHotkeys = $('#choice-disable-hotkeys')
export const dialogOptionsOption = $('.modal-dialog button')