 a975b6ab94
			
		
	
	
	a975b6ab94
	
	
	
		
			
			As per https://codeberg.org/forgejo/forgejo/pulls/6400, the after hook runs for every test, resulting in duplicated screenshots.
Not all tests are supposed to generate screenshots, especially because they could be flaky (also see 206d4cfb7a ).
Additionally, the implicit behaviour might have caused confusion, so we now create screenshots explicitly, adding the statements from the tests that already generated screenshots.
		
	
			
		
			
				
	
	
		
			46 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // document is a global in evaluate, so it's safe to ignore here
 | |
| // eslint playwright/no-conditional-in-test: 0
 | |
| 
 | |
| // @watch start
 | |
| // templates/explore/**
 | |
| // web_src/modules/fomantic/**
 | |
| // @watch end
 | |
| 
 | |
| import {expect} from '@playwright/test';
 | |
| import {save_visual, test} from './utils_e2e.ts';
 | |
| 
 | |
| test('Explore view taborder', async ({page}) => {
 | |
|   await page.goto('/explore/repos');
 | |
| 
 | |
|   const l1 = page.locator('[href="https://forgejo.org"]');
 | |
|   const l2 = page.locator('[href="/assets/licenses.txt"]');
 | |
|   const l3 = page.locator('[href*="/stars"]').first();
 | |
|   const l4 = page.locator('[href*="/forks"]').first();
 | |
|   let res = 0;
 | |
|   const exp = 15; // 0b1111 = four passing tests
 | |
| 
 | |
|   for (let i = 0; i < 150; i++) {
 | |
|     await page.keyboard.press('Tab');
 | |
|     if (await l1.evaluate((node) => document.activeElement === node)) {
 | |
|       res |= 1;
 | |
|       continue;
 | |
|     }
 | |
|     if (await l2.evaluate((node) => document.activeElement === node)) {
 | |
|       res |= 1 << 1;
 | |
|       continue;
 | |
|     }
 | |
|     if (await l3.evaluate((node) => document.activeElement === node)) {
 | |
|       res |= 1 << 2;
 | |
|       continue;
 | |
|     }
 | |
|     if (await l4.evaluate((node) => document.activeElement === node)) {
 | |
|       res |= 1 << 3;
 | |
|       continue;
 | |
|     }
 | |
|     if (res === exp) {
 | |
|       break;
 | |
|     }
 | |
|   }
 | |
|   expect(res).toBe(exp);
 | |
|   await save_visual(page);
 | |
| });
 |