add another focus test
This commit is contained in:
		
							parent
							
								
									a25dd048b6
								
							
						
					
					
						commit
						c0a2a1e8bf
					
				
					 2 changed files with 29 additions and 2 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| import { | ||||
|   getNthStatus, scrollToStatus, closeDialogButton, modalDialogContents, getActiveElementClass, goBack, getUrl | ||||
|   getNthStatus, scrollToStatus, closeDialogButton, modalDialogContents, getActiveElementClass, goBack, getUrl, | ||||
|   goBackButton, getActiveElementInnerText | ||||
| } from '../utils' | ||||
| import { foobarRole } from '../roles' | ||||
| 
 | ||||
|  | @ -21,5 +22,26 @@ test('timeline preserves focus', async t => { | |||
|     .expect(getUrl()).contains('/statuses/') | ||||
| 
 | ||||
|   await goBack() | ||||
|   await t.expect(getActiveElementClass()).eql('status-article status-in-timeline') | ||||
|   await t.expect(getUrl()).eql('http://localhost:4002/') | ||||
|     .expect(getActiveElementClass()).eql('status-article status-in-timeline') | ||||
| }) | ||||
| 
 | ||||
| test('timeline link preserves focus', async t => { | ||||
|   await t.useRole(foobarRole) | ||||
|     .click(getNthStatus(0).find('.status-header a')) | ||||
|     .expect(getUrl()).contains('/accounts/') | ||||
|     .click(goBackButton) | ||||
|     .expect(getUrl()).eql('http://localhost:4002/') | ||||
|     .expect(getActiveElementInnerText()).eql('admin') | ||||
| }) | ||||
| 
 | ||||
| test('notification timeline preserves focus', async t => { | ||||
|   await t.useRole(foobarRole) | ||||
|     .navigateTo('/notifications') | ||||
|   await scrollToStatus(t, 5) | ||||
|   await t.click(getNthStatus(5).find('.status-header a')) | ||||
|     .expect(getUrl()).contains('/accounts/') | ||||
|     .click(goBackButton) | ||||
|     .expect(getUrl()).eql('http://localhost:4002/notifications') | ||||
|     .expect(getActiveElementInnerText()).eql('quux') | ||||
| }) | ||||
|  |  | |||
|  | @ -31,6 +31,7 @@ export const accountProfileName = $('.account-profile .account-profile-name') | |||
| export const accountProfileUsername = $('.account-profile .account-profile-username') | ||||
| export const accountProfileFollowedBy = $('.account-profile .account-profile-followed-by') | ||||
| export const accountProfileFollowButton = $('.account-profile .account-profile-follow button') | ||||
| export const goBackButton = $('.dynamic-page-go-back') | ||||
| 
 | ||||
| export const favoritesCountElement = $('.status-favs-reblogs:nth-child(3)').addCustomDOMProperties({ | ||||
|   innerCount: el => parseInt(el.innerText, 10) | ||||
|  | @ -48,6 +49,10 @@ export const getActiveElementClass = exec(() => | |||
|   document.activeElement ? document.activeElement.getAttribute('class') : '' | ||||
| ) | ||||
| 
 | ||||
| export const getActiveElementInnerText = exec(() => | ||||
|   document.activeElement && document.activeElement.innerText | ||||
| ) | ||||
| 
 | ||||
| export const goBack = exec(() => window.history.back()) | ||||
| 
 | ||||
| export const forceOffline = exec(() => window.store.set({online: false})) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue