mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	chore(e2e): test eslint errors
This commit is contained in:
		
							parent
							
								
									db66998107
								
							
						
					
					
						commit
						74b2643c28
					
				| @ -5,10 +5,9 @@ test("Displays lint warnings for backend script", async ({ page }) => { | |||||||
|     const app = new App(page); |     const app = new App(page); | ||||||
|     await app.goto(); |     await app.goto(); | ||||||
|     await app.closeAllTabs(); |     await app.closeAllTabs(); | ||||||
|     await app.goToNoteInNewTab("Backend script with lint warning"); |     await app.goToNoteInNewTab("Backend script with lint warnings"); | ||||||
| 
 | 
 | ||||||
|     const codeEditor = app.currentNoteSplit.locator(".CodeMirror"); |     const codeEditor = app.currentNoteSplit.locator(".CodeMirror"); | ||||||
|     expect(await app.currentNoteSplit.locator(".note-title").inputValue()).toBe("Backend script with lint warnings"); |  | ||||||
| 
 | 
 | ||||||
|     // Expect two warning signs in the gutter.
 |     // Expect two warning signs in the gutter.
 | ||||||
|     expect(codeEditor.locator(".CodeMirror-gutter-wrapper .CodeMirror-lint-marker-warning")).toHaveCount(2); |     expect(codeEditor.locator(".CodeMirror-gutter-wrapper .CodeMirror-lint-marker-warning")).toHaveCount(2); | ||||||
| @ -22,6 +21,22 @@ test("Displays lint warnings for backend script", async ({ page }) => { | |||||||
|     await expectTooltip(page, "'world' is defined but never used."); |     await expectTooltip(page, "'world' is defined but never used."); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | test("Displays lint errors for backend script", async ({ page }) => { | ||||||
|  |     const app = new App(page); | ||||||
|  |     await app.goto(); | ||||||
|  |     await app.closeAllTabs(); | ||||||
|  |     await app.goToNoteInNewTab("Backend script with lint errors"); | ||||||
|  | 
 | ||||||
|  |     const codeEditor = app.currentNoteSplit.locator(".CodeMirror"); | ||||||
|  | 
 | ||||||
|  |     // Expect two warning signs in the gutter.
 | ||||||
|  |     expect(codeEditor.locator(".CodeMirror-gutter-wrapper .CodeMirror-lint-marker-error")).toHaveCount(1); | ||||||
|  | 
 | ||||||
|  |     // Hover over hello
 | ||||||
|  |     await codeEditor.getByText("world").first().hover(); | ||||||
|  |     await expectTooltip(page, "Parsing error: Unexpected token world"); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| async function expectTooltip(page: Page, tooltip: string) { | async function expectTooltip(page: Page, tooltip: string) { | ||||||
|     await expect(page.locator(".CodeMirror-lint-tooltip:visible", { |     await expect(page.locator(".CodeMirror-lint-tooltip:visible", { | ||||||
|         "hasText": tooltip |         "hasText": tooltip | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran