2018-02-28 22:45:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { Role } from 'testcafe'
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-21 13:06:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  addInstanceButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  authorizeInput, emailInput, getUrl, instanceInput, mastodonLogInButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  passwordInput
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								} from './utils'
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 17:18:40 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:25:59 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function login (t, username, password) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-28 22:45:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return t.typeText(instanceInput, 'localhost:3000', {paste: true})
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-21 13:06:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(addInstanceButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-21 14:57:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).eql('http://localhost:3000/auth/sign_in', {timeout: 30000})
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-28 22:45:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .typeText(emailInput, username, {paste: true})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .typeText(passwordInput, password, {paste: true})
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-21 13:06:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(mastodonLogInButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 17:18:40 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/oauth/authorize')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-28 22:45:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(authorizeInput)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-21 14:57:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).eql('http://localhost:4002/', {timeout: 30000})
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 17:18:40 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await login(t, 'foobar@localhost:3000', 'foobarfoobar')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:25:59 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								})
							 |