| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  | import { Selector as $ } from 'testcafe' | 
					
						
							| 
									
										
										
										
											2018-03-14 22:14:06 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   accountProfileFollowButton, | 
					
						
							|  |  |  |   accountProfileFollowedBy, accountProfileName, accountProfileUsername, getUrl, | 
					
						
							|  |  |  |   validateTimeline | 
					
						
							|  |  |  | } from '../utils' | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  | import { loginAsFoobar } from '../roles' | 
					
						
							| 
									
										
										
										
											2018-02-20 08:50:48 -08:00
										 |  |  | import { quuxStatuses } from '../fixtures' | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-06 21:32:51 -08:00
										 |  |  | fixture`007-account-profile.js` | 
					
						
							| 
									
										
										
										
											2018-02-19 18:25:59 -08:00
										 |  |  |   .page`http://localhost:4002` | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | test('shows account profile', async t => { | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  |   await loginAsFoobar(t) | 
					
						
							|  |  |  |   await t | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  |     .click($('.status-author-name').withText(('quux'))) | 
					
						
							|  |  |  |     .expect(getUrl()).contains('/accounts/3') | 
					
						
							| 
									
										
										
										
											2018-03-14 22:14:06 -07:00
										 |  |  |     .expect(accountProfileName.innerText).contains('quux') | 
					
						
							|  |  |  |     .expect(accountProfileUsername.innerText).contains('@quux') | 
					
						
							|  |  |  |     .expect(accountProfileFollowedBy.innerText).match(/follows you/i) | 
					
						
							|  |  |  |     .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow') | 
					
						
							|  |  |  |     .expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('false') | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test('shows account profile 2', async t => { | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  |   await loginAsFoobar(t) | 
					
						
							|  |  |  |   await t | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  |     .click($('.status-author-name').withText(('admin'))) | 
					
						
							|  |  |  |     .expect(getUrl()).contains('/accounts/1') | 
					
						
							| 
									
										
										
										
											2018-03-14 22:14:06 -07:00
										 |  |  |     .expect(accountProfileName.innerText).contains('admin') | 
					
						
							|  |  |  |     .expect(accountProfileUsername.innerText).contains('@admin') | 
					
						
							|  |  |  |     .expect(accountProfileFollowedBy.innerText).match(/follows you/i) | 
					
						
							|  |  |  |     .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow') | 
					
						
							|  |  |  |     .expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('true') | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test('shows account profile 3', async t => { | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  |   await loginAsFoobar(t) | 
					
						
							|  |  |  |   await t | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  |     .click($('.mention').withText(('foobar'))) | 
					
						
							|  |  |  |     .expect(getUrl()).contains('/accounts/2') | 
					
						
							| 
									
										
										
										
											2018-03-14 22:14:06 -07:00
										 |  |  |     .expect(accountProfileName.innerText).contains('foobar') | 
					
						
							|  |  |  |     .expect(accountProfileUsername.innerText).contains('@foobar') | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  |     // can't follow or be followed by your own account
 | 
					
						
							| 
									
										
										
										
											2018-03-14 22:14:06 -07:00
										 |  |  |     .expect(accountProfileFollowedBy.innerText).eql('') | 
					
						
							| 
									
										
										
										
											2018-02-19 18:24:22 -08:00
										 |  |  |     .expect($('.account-profile .account-profile-follow').innerText).eql('') | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2018-02-20 08:50:48 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | test('shows account profile statuses', async t => { | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  |   await loginAsFoobar(t) | 
					
						
							|  |  |  |   await t | 
					
						
							| 
									
										
										
										
											2018-02-20 08:50:48 -08:00
										 |  |  |     .click($('.status-author-name').withText(('quux'))) | 
					
						
							|  |  |  |     .expect(getUrl()).contains('/accounts/3') | 
					
						
							|  |  |  |     .expect($('.pinned-statuses .status-article').getAttribute('aria-setsize')).eql('2') | 
					
						
							|  |  |  |     .expect($('.pinned-statuses .status-article').getAttribute('aria-posinset')).eql('0') | 
					
						
							|  |  |  |     .expect($('.timeline .status-article').getAttribute('aria-posinset')).eql('0') | 
					
						
							|  |  |  |   await validateTimeline(t, quuxStatuses) | 
					
						
							|  |  |  |   await t.expect($('.timeline .status-article').getAttribute('aria-setsize')).eql('27') | 
					
						
							|  |  |  | }) |