forked from cybrespace/pinafore
		
	fix tests
This commit is contained in:
		
							parent
							
								
									9c14a0abd5
								
							
						
					
					
						commit
						6dfa63ba48
					
				
					 5 changed files with 11 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -79,7 +79,7 @@ async function main () {
 | 
			
		|||
  await waitForMastodonUiToStart()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function shutdownMastodon() {
 | 
			
		||||
function shutdownMastodon () {
 | 
			
		||||
  if (childProc) {
 | 
			
		||||
    console.log('killing child process')
 | 
			
		||||
    childProc.kill()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ if (require.main === module) {
 | 
			
		|||
  Promise.resolve()
 | 
			
		||||
    .then(waitForMastodonApiToStart)
 | 
			
		||||
    .then(waitForMastodonUiToStart).catch(err => {
 | 
			
		||||
    console.error(err)
 | 
			
		||||
    process.exit(1)
 | 
			
		||||
  })
 | 
			
		||||
      console.error(err)
 | 
			
		||||
      process.exit(1)
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { Selector as $ } from 'testcafe'
 | 
			
		||||
import { getUrl, settingsButton } from '../utils'
 | 
			
		||||
import { getUrl, logInToInstanceLink, settingsButton } from '../utils'
 | 
			
		||||
 | 
			
		||||
fixture`001-basic-spec.js`
 | 
			
		||||
  .page`http://localhost:4002`
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ test('navigates to about', async t => {
 | 
			
		|||
})
 | 
			
		||||
 | 
			
		||||
test('navigates to /settings/instances/add', async t => {
 | 
			
		||||
  await t.click($('a').withText('log in to an instance'))
 | 
			
		||||
  await t.click(logInToInstanceLink)
 | 
			
		||||
    .expect(getUrl()).contains('/settings/instances/add')
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import { Selector as $ } from 'testcafe'
 | 
			
		||||
import {
 | 
			
		||||
  authorizeInput, emailInput, formError, getFirstVisibleStatus, getUrl, instanceInput, passwordInput,
 | 
			
		||||
  authorizeInput, emailInput, formError, getFirstVisibleStatus, getUrl, instanceInput, logInToInstanceLink,
 | 
			
		||||
  passwordInput,
 | 
			
		||||
  settingsButton
 | 
			
		||||
} from '../utils'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +9,7 @@ fixture`002-login-spec.js`
 | 
			
		|||
  .page`http://localhost:4002`
 | 
			
		||||
 | 
			
		||||
function manualLogin (t, username, password) {
 | 
			
		||||
  return t.click($('a').withText('log in to an instance'))
 | 
			
		||||
  return t.click(logInToInstanceLink)
 | 
			
		||||
    .expect(getUrl()).contains('/settings/instances/add')
 | 
			
		||||
    .typeText(instanceInput, 'localhost:3000')
 | 
			
		||||
    .pressKey('enter')
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +23,7 @@ function manualLogin (t, username, password) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
test('Cannot log in to a fake instance', async t => {
 | 
			
		||||
  await t.click($('a').withText('log in to an instance'))
 | 
			
		||||
  await t.click(logInToInstanceLink)
 | 
			
		||||
    .expect(getUrl()).contains('/settings/instances/add')
 | 
			
		||||
    .typeText(instanceInput, 'fake.nolanlawson.com', {paste: true})
 | 
			
		||||
    .pressKey('enter')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,7 @@ export const contentWarningButton = $('.compose-box-toolbar button:nth-child(4)'
 | 
			
		|||
export const emailInput = $('input#user_email')
 | 
			
		||||
export const passwordInput = $('input#user_password')
 | 
			
		||||
export const authorizeInput = $('button[type=submit]:not(.negative)')
 | 
			
		||||
export const logInToInstanceLink = $('a[href="/settings/instances/add"]')
 | 
			
		||||
 | 
			
		||||
export const favoritesCountElement = $('.status-favs-reblogs:nth-child(3)').addCustomDOMProperties({
 | 
			
		||||
  innerCount: el => parseInt(el.innerText, 10)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue