This commit is contained in:
Nolan Lawson 2018-02-18 15:30:42 -08:00
parent f4eeacdc1c
commit 03073ac846
7 changed files with 39 additions and 34 deletions

View File

@ -19,7 +19,7 @@ const mastodonDir = path.join(dir, '../mastodon')
let childProc
async function cloneMastodon() {
async function cloneMastodon () {
try {
await stat(mastodonDir)
} catch (e) {
@ -30,7 +30,7 @@ async function cloneMastodon() {
}
}
async function restoreMastodonData() {
async function restoreMastodonData () {
console.log('Restoring mastodon data...')
try {
await exec('dropdb mastodon_development', {cwd: mastodonDir})
@ -46,7 +46,7 @@ async function restoreMastodonData() {
await exec(`tar -xzf "${tgzFile}"`, {cwd: systemDir})
}
async function runMastodon() {
async function runMastodon () {
console.log('Running mastodon...')
let cmds = [
'gem install bundler',
@ -71,7 +71,7 @@ async function runMastodon() {
await waitForMastodonToStart()
}
async function main() {
async function main () {
await cloneMastodon()
await restoreMastodonData()
await runMastodon()

View File

@ -1,6 +1,6 @@
const fetch = require('node-fetch')
async function waitForMastodonToStart() {
async function waitForMastodonToStart () {
while (true) {
try {
let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json())
@ -22,4 +22,4 @@ if (require.main === module) {
console.error(err)
process.exit(1)
})
}
}

View File

@ -1,11 +1,11 @@
describe('Basic spec', () => {
beforeEach(() => {
cy.visit('/')
})
beforeEach(() => {
cy.visit('/')
})
it('has the correct <h1>', () => {
cy.contains('h1', 'Pinafore')
})
it('has the correct <h1>', () => {
cy.contains('h1', 'Pinafore')
})
it('navigates to about', () => {
cy.get('nav a').contains('Settings').click()
@ -15,10 +15,10 @@ describe('Basic spec', () => {
cy.contains('h1', 'About Pinafore')
})
it('navigates to /settings/instances/add', () => {
cy.contains('log in to an instance').click()
cy.url().should('contain', '/settings/instances/add')
})
it('navigates to /settings/instances/add', () => {
cy.contains('log in to an instance').click()
cy.url().should('contain', '/settings/instances/add')
})
it('navigates to settings/instances', () => {
cy.get('nav a').contains('Settings').click()
@ -27,5 +27,4 @@ describe('Basic spec', () => {
cy.url().should('contain', '/settings/instances')
cy.contains("You're not logged in to any instances")
})
})
})

View File

@ -1,10 +1,10 @@
describe('Login spec', () => {
beforeEach(() => {
cy.visit('/')
})
beforeEach(() => {
cy.visit('/')
})
it('Cannot log in to a fake instance', () => {
cy.get('a').contains('log in to an instance').click()
it('Cannot log in to a fake instance', () => {
cy.get('a').contains('log in to an instance').click()
cy.get('#instanceInput').clear().type('fake.nolanlawson.com')
cy.get('.add-new-instance').submit()
@ -13,7 +13,7 @@ describe('Login spec', () => {
cy.get('.form-error').should('not.exist')
cy.get('#instanceInput').clear().type('fake.nolanlawson.com')
cy.get('.form-error').should('exist')
})
})
it('Logs in to localhost:3000', () => {
cy.login('foobar@localhost:3000', 'foobarfoobar')
@ -33,5 +33,4 @@ describe('Login spec', () => {
cy.url().should('contain', '/settings/instances')
cy.contains("You're not logged in to any instances")
})
})
})

View File

@ -25,9 +25,9 @@ describe('Basic timeline spec', () => {
cy.getNthVirtualArticle(10).get('.status-content p').should('contain', "here's a secret kitten")
cy.getNthVirtualArticle(11).get('.status-content p').should('contain', "here's a kitten")
cy.getNthVirtualArticle(11).scrollIntoView()
cy.getNthVirtualArticle(12).get('.status-content p').should('contain', "hello admin")
cy.getNthVirtualArticle(13).get('.status-content p').should('contain', "hello foobar")
cy.getNthVirtualArticle(14).get('.status-content p').should('contain', "hello world")
cy.getNthVirtualArticle(12).get('.status-content p').should('contain', 'hello admin')
cy.getNthVirtualArticle(13).get('.status-content p').should('contain', 'hello foobar')
cy.getNthVirtualArticle(14).get('.status-content p').should('contain', 'hello world')
cy.getNthVirtualArticle(14).scrollIntoView()
for (let i = 0; i < 30; i++) {
@ -36,6 +36,5 @@ describe('Basic timeline spec', () => {
}
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize', (30 + 15).toString())
})
})
})

View File

@ -49,4 +49,4 @@ Cypress.Commands.add('login', (email, password) => {
Cypress.Commands.add('getNthVirtualArticle', (n) => {
return cy.get(`.virtual-list-item[aria-hidden=false] .status-article[aria-posinset=${n}]`)
})
})

View File

@ -91,11 +91,19 @@
"caches",
"__routes__",
"__shell__",
"__assets__"
"__assets__",
"cy",
"Cypress",
"expect",
"before",
"beforeEach",
"after",
"afterEach",
"describe",
"it"
],
"ignore": [
"dist",
"cypress",
"routes/_utils/asyncModules.js"
]
}