fix lint issues
This commit is contained in:
parent
391455bee4
commit
5c2dc4c421
|
@ -40,4 +40,8 @@ Lint:
|
||||||
|
|
||||||
Run integration tests:
|
Run integration tests:
|
||||||
|
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
|
Automatically fix most linting issues:
|
||||||
|
|
||||||
|
npx standard --fix
|
|
@ -51,4 +51,4 @@ export const favorites = [
|
||||||
{content: 'notification of followers-only message'},
|
{content: 'notification of followers-only message'},
|
||||||
{content: 'notification of unlisted message'},
|
{content: 'notification of unlisted message'},
|
||||||
{content: 'pinned toot 1'}
|
{content: 'pinned toot 1'}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Selector as $, Role } from 'testcafe'
|
import { Selector as $, Role } from 'testcafe'
|
||||||
import { addInstanceButton, getUrl, instanceInput } from './utils'
|
import { addInstanceButton, getUrl, instanceInput } from './utils'
|
||||||
|
|
||||||
function login(t, username, password) {
|
function login (t, username, password) {
|
||||||
return t.typeText(instanceInput, 'localhost:3000')
|
return t.typeText(instanceInput, 'localhost:3000')
|
||||||
.click(addInstanceButton)
|
.click(addInstanceButton)
|
||||||
.expect(getUrl()).eql('http://localhost:3000/auth/sign_in')
|
.expect(getUrl()).eql('http://localhost:3000/auth/sign_in')
|
||||||
|
@ -15,4 +15,4 @@ function login(t, username, password) {
|
||||||
|
|
||||||
export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => {
|
export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => {
|
||||||
await login(t, 'foobar@localhost:3000', 'foobarfoobar')
|
await login(t, 'foobar@localhost:3000', 'foobarfoobar')
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Selector as $ } from 'testcafe'
|
import { Selector as $ } from 'testcafe'
|
||||||
import { getUrl, settingsButton } from '../utils'
|
import { getUrl, settingsButton } from '../utils'
|
||||||
|
|
||||||
fixture `01-basic-spec.js`
|
fixture`01-basic-spec.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
test('has the correct <h1>', async t => {
|
test('has the correct <h1>', async t => {
|
||||||
await t
|
await t
|
||||||
|
@ -30,4 +30,4 @@ test('navigates to settings/instances', async t => {
|
||||||
.expect(getUrl()).contains('/settings/instances')
|
.expect(getUrl()).contains('/settings/instances')
|
||||||
.expect($('.container').innerText)
|
.expect($('.container').innerText)
|
||||||
.contains("You're not logged in to any instances")
|
.contains("You're not logged in to any instances")
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Selector as $ } from 'testcafe'
|
import { Selector as $ } from 'testcafe'
|
||||||
import { addInstanceButton, getUrl, instanceInput, login, settingsButton } from '../utils'
|
import { addInstanceButton, getUrl, instanceInput, settingsButton } from '../utils'
|
||||||
|
|
||||||
fixture `02-login-spec.js`
|
fixture`02-login-spec.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
const formError = $('.form-error')
|
const formError = $('.form-error')
|
||||||
|
|
||||||
function manualLogin(t, username, password) {
|
function manualLogin (t, username, password) {
|
||||||
return t.click($('a').withText('log in to an instance'))
|
return t.click($('a').withText('log in to an instance'))
|
||||||
.expect(getUrl()).contains('/settings/instances/add')
|
.expect(getUrl()).contains('/settings/instances/add')
|
||||||
.typeText(instanceInput, 'localhost:3000')
|
.typeText(instanceInput, 'localhost:3000')
|
||||||
|
@ -49,4 +49,4 @@ test('Logs out', async t => {
|
||||||
.click($('#modal-dialog button').withText('OK'))
|
.click($('#modal-dialog button').withText('OK'))
|
||||||
.expect($('.container').innerText)
|
.expect($('.container').innerText)
|
||||||
.contains("You're not logged in to any instances")
|
.contains("You're not logged in to any instances")
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Selector as $ } from 'testcafe'
|
import { Selector as $ } from 'testcafe'
|
||||||
import { getUrl, login, validateTimeline } from '../utils'
|
import { getUrl, validateTimeline } from '../utils'
|
||||||
import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures'
|
import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures'
|
||||||
import { foobarRole } from '../roles'
|
import { foobarRole } from '../roles'
|
||||||
|
|
||||||
fixture `03-basic-timeline-spec.js`
|
fixture`03-basic-timeline-spec.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
const firstArticle = $('.virtual-list-item[aria-hidden=false] .status-article')
|
const firstArticle = $('.virtual-list-item[aria-hidden=false] .status-article')
|
||||||
|
|
||||||
|
@ -52,4 +52,4 @@ test('Shows favorites', async t => {
|
||||||
.expect(getUrl()).contains('/favorites')
|
.expect(getUrl()).contains('/favorites')
|
||||||
|
|
||||||
await validateTimeline(t, favorites)
|
await validateTimeline(t, favorites)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Selector as $ } from 'testcafe'
|
import { Selector as $ } from 'testcafe'
|
||||||
import { getUrl, login } from '../utils'
|
import { getUrl } from '../utils'
|
||||||
import { foobarRole } from '../roles'
|
import { foobarRole } from '../roles'
|
||||||
|
|
||||||
fixture `04-pinned-statuses.js`
|
fixture`04-pinned-statuses.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
test("shows a user's pinned statuses", async t => {
|
test("shows a user's pinned statuses", async t => {
|
||||||
await t.useRole(foobarRole)
|
await t.useRole(foobarRole)
|
||||||
|
@ -32,4 +32,4 @@ test("shows pinned statuses on a user's account page 2", async t => {
|
||||||
.expect($('.pinned-statuses .status-article').innerText).contains('pinned toot 1')
|
.expect($('.pinned-statuses .status-article').innerText).contains('pinned toot 1')
|
||||||
.expect($('.pinned-statuses .status-article[aria-posinset="1"]').getAttribute('aria-setsize')).eql('2')
|
.expect($('.pinned-statuses .status-article[aria-posinset="1"]').getAttribute('aria-setsize')).eql('2')
|
||||||
.expect($('.pinned-statuses .status-article[aria-posinset="1"]').innerText).contains('pinned toot 2')
|
.expect($('.pinned-statuses .status-article[aria-posinset="1"]').innerText).contains('pinned toot 2')
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getNthVirtualArticle } from '../utils'
|
import { getNthVirtualArticle } from '../utils'
|
||||||
import { foobarRole } from '../roles'
|
import { foobarRole } from '../roles'
|
||||||
|
|
||||||
fixture `05-status-types.js`
|
fixture`05-status-types.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
test('shows direct vs followers-only vs regular', async t => {
|
test('shows direct vs followers-only vs regular', async t => {
|
||||||
await t.useRole(foobarRole)
|
await t.useRole(foobarRole)
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { Selector as $ } from 'testcafe'
|
||||||
import { getNthVirtualArticle } from '../utils'
|
import { getNthVirtualArticle } from '../utils'
|
||||||
import { foobarRole } from '../roles'
|
import { foobarRole } from '../roles'
|
||||||
|
|
||||||
fixture `06-tabindex.js`
|
fixture`06-tabindex.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
test('shows correct tabindex in home timeline', async t => {
|
test('shows correct tabindex in home timeline', async t => {
|
||||||
await t.useRole(foobarRole)
|
await t.useRole(foobarRole)
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { Selector as $ } from 'testcafe'
|
||||||
import { getUrl } from '../utils'
|
import { getUrl } from '../utils'
|
||||||
import { foobarRole } from '../roles'
|
import { foobarRole } from '../roles'
|
||||||
|
|
||||||
fixture `07-account-profile.js`
|
fixture`07-account-profile.js`
|
||||||
.page `http://localhost:4002`
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
test('shows account profile', async t => {
|
test('shows account profile', async t => {
|
||||||
await t.useRole(foobarRole)
|
await t.useRole(foobarRole)
|
||||||
|
|
|
@ -10,7 +10,7 @@ export function getNthVirtualArticle (n) {
|
||||||
return $(`.virtual-list-item[aria-hidden="false"] article[aria-posinset="${n}"]`)
|
return $(`.virtual-list-item[aria-hidden="false"] article[aria-posinset="${n}"]`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function validateTimeline(t, timeline) {
|
export async function validateTimeline (t, timeline) {
|
||||||
for (let i = 0; i < timeline.length; i++) {
|
for (let i = 0; i < timeline.length; i++) {
|
||||||
let status = timeline[i]
|
let status = timeline[i]
|
||||||
if (status.content) {
|
if (status.content) {
|
||||||
|
@ -40,4 +40,4 @@ export async function validateTimeline(t, timeline) {
|
||||||
await t.expect($('.loading-footer').exist).notOk()
|
await t.expect($('.loading-footer').exist).notOk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue