2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { Selector as $ } from 'testcafe'
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 12:28:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { communityNavButton, getNthPinnedStatus, getUrl } from '../utils'
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { loginAsFoobar } from '../roles'
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-06 21:32:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fixture`004-pinned-statuses.js`
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:25:59 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  .page`http://localhost:4002`
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test("shows a user's pinned statuses", async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 12:28:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click(communityNavButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/community')
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 12:28:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .click($('a[href="/pinned"]'))
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/pinned')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect($('.status-article').getAttribute('aria-posinset')).eql('0')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect($('.status-article').getAttribute('aria-setsize')).eql('1')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect($('.status-article .status-content').innerText).contains('this is unlisted')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test("shows pinned statuses on a user's account page", async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .navigateTo('/accounts/2')
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 12:28:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).getAttribute('aria-posinset')).eql('0')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('1')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).innerText).contains('this is unlisted')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test("shows pinned statuses on a user's account page 2", async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .navigateTo('/accounts/3')
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-29 12:28:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).getAttribute('aria-posinset')).eql('0')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('2')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(0).innerText).contains('pinned toot 1')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(1).getAttribute('aria-setsize')).eql('2')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthPinnedStatus(1).innerText).contains('pinned toot 2')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-19 18:25:59 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								})
							 |