2018-03-10 16:21:10 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { foobarRole } from '../roles'
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  clickToNotificationsAndBackHome, forceOffline, forceOnline, getNthStatus, getUrl, homeNavButton,
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-20 17:41:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  notificationsNavButton
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								} from '../utils'
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { deleteAs, postAs, postReplyAs } from '../serverActions'
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 16:21:10 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fixture`105-deletes.js`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  .page`http://localhost:4002`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('deleted statuses are removed from the timeline', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let timeout = 20000
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 16:21:10 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t.useRole(foobarRole)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let status = await postAs('admin', "I'm gonna delete this")
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(0).innerText).contains("I'm gonna delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await deleteAs('admin', status.id)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(0).innerText).notContains("I'm gonna delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await clickToNotificationsAndBackHome(t)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(0).innerText).notContains("I'm gonna delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.navigateTo('/notifications')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await forceOffline()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t.click(homeNavButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(0).innerText).notContains("I'm gonna delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await forceOnline()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .navigateTo('/')
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(0).innerText).notContains("I'm gonna delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('deleted statuses are removed from threads', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let timeout = 20000
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.useRole(foobarRole)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let status = await postAs('admin', "I won't delete this")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  let reply = await postReplyAs('admin', 'But I will delete this', status.id)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(0).innerText).contains('But I will delete this', {timeout})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(1).innerText).contains("I won't delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(getNthStatus(1))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/statuses')
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(0).innerText).contains("I won't delete this", {timeout})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(1).innerText).contains('But I will delete this', {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await deleteAs('admin', reply.id)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(1).exists).notOk()
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(0).innerText).contains("I won't delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.navigateTo('/')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await forceOffline()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t.click(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/statuses')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(1).exists).notOk()
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatus(0).innerText).contains("I won't delete this", {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 20:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await forceOnline()
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 16:21:10 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 21:05:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('deleted statuses result in deleted notifications', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let timeout = 20000
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 21:05:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.useRole(foobarRole)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let status = await postAs('admin', "@foobar yo yo foobar what's up")
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (1)', {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 10:06:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await deleteAs('admin', status.id)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-19 18:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications', {timeout})
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-10 21:05:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								})
							 |