2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  accountProfileFollowButton,
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-18 15:43:41 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  accountProfileMoreOptionsButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  communityNavButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getNthSearchResult,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getNthStatus,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getNthStatusOptionsButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getNthDialogOptionsOption,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getUrl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  modalDialog,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  closeDialogButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  confirmationDialogOKButton, sleep
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								} from '../utils'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { Selector as $ } from 'testcafe'
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { loginAsFoobar } from '../roles'
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { postAs } from '../serverActions'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fixture`114-mute-unmute.js`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  .page`http://localhost:4002`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('Can mute and unmute an account', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  let post = 'blah blah blah'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await postAs('admin', post)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-28 08:56:25 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await t.expect(getNthStatus(1).innerText).contains(post, { timeout: 20000 })
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthStatusOptionsButton(1))
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(1).innerText).contains('Unfollow @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(2).innerText).contains('Block @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(3).innerText).contains('Mute @admin')
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-24 15:08:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthDialogOptionsOption(3))
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-18 15:43:41 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(confirmationDialogOKButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(modalDialog.exists).notOk()
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-18 15:43:41 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(communityNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click($('a[href="/muted"]'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthSearchResult(1).innerText).contains('@admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthSearchResult(1))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/accounts/1')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(accountProfileMoreOptionsButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(1).innerText).contains('Mention @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(3).innerText).contains('Block @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(4).innerText).contains('Unmute @admin')
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-24 15:08:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthDialogOptionsOption(4))
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-18 15:43:41 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(accountProfileMoreOptionsButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(1).innerText).contains('Mention @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(3).innerText).contains('Block @admin')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthDialogOptionsOption(4).innerText).contains('Mute @admin')
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-24 15:08:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await sleep(1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-19 09:34:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(closeDialogButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 22:18:48 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 |