mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	integration-test: Create authentication setup
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -25,3 +25,4 @@ images/app-icons/mac/*.png | |||||||
| /playwright-report/ | /playwright-report/ | ||||||
| /blob-report/ | /blob-report/ | ||||||
| /playwright/.cache/ | /playwright/.cache/ | ||||||
|  | /playwright/.auth/ | ||||||
							
								
								
									
										17
									
								
								integration-tests/auth.setup.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								integration-tests/auth.setup.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | import { test as setup, expect } from '@playwright/test'; | ||||||
|  |  | ||||||
|  | const authFile = 'playwright/.auth/user.json'; | ||||||
|  |  | ||||||
|  | const ROOT_URL = "http://localhost:8080"; | ||||||
|  | const LOGIN_PASSWORD = "eliandoran"; | ||||||
|  |  | ||||||
|  | // Reference: https://playwright.dev/docs/auth#basic-shared-account-in-all-tests  | ||||||
|  |  | ||||||
|  | setup("authenticate", async ({ page }) => { | ||||||
|  |     await page.goto(ROOT_URL); | ||||||
|  |     await expect(page).toHaveURL(`${ROOT_URL}/login`); | ||||||
|  |  | ||||||
|  |     await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD); | ||||||
|  |     await page.getByRole("button", { name: "Login"}).click(); | ||||||
|  |     await page.context().storageState({ path: authFile });     | ||||||
|  | }); | ||||||
| @@ -7,14 +7,6 @@ test("Can insert equations", async ({ page }) => { | |||||||
|     await page.setDefaultTimeout(60_000); |     await page.setDefaultTimeout(60_000); | ||||||
|     await page.setDefaultNavigationTimeout(60_000); |     await page.setDefaultNavigationTimeout(60_000); | ||||||
| 
 | 
 | ||||||
|     await page.goto(ROOT_URL); |  | ||||||
|     await expect(page).toHaveURL(`${ROOT_URL}/login`); |  | ||||||
| 
 |  | ||||||
|     // Log in
 |  | ||||||
|     await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD); |  | ||||||
|     await page.getByRole("button", { name: "Login"}).click(); |  | ||||||
|     await page.waitForURL(/\/#root\//); |  | ||||||
| 
 |  | ||||||
|     // Create a new note
 |     // Create a new note
 | ||||||
|     // await page.locator("button.button-widget.bx-file-blank")
 |     // await page.locator("button.button-widget.bx-file-blank")
 | ||||||
|     //     .click();    
 |     //     .click();    
 | ||||||
							
								
								
									
										5
									
								
								integration-tests/update_check.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								integration-tests/update_check.spec.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | import { test, expect } from '@playwright/test'; | ||||||
|  |  | ||||||
|  | test("Displays update badge when there is a version available", async ({ page }) => { | ||||||
|  |     await page.goto("http://localhost:8080"); | ||||||
|  | }); | ||||||
| @@ -34,13 +34,17 @@ export default defineConfig({ | |||||||
|   /* Configure projects for major browsers */ |   /* Configure projects for major browsers */ | ||||||
|   projects: [ |   projects: [ | ||||||
|     { |     { | ||||||
|       name: 'chromium', |       name: "setup", | ||||||
|       use: { ...devices['Desktop Chrome'] }, |       testMatch: /.*\.setup\.ts/ | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     { |     { | ||||||
|       name: 'firefox', |       name: "firefox", | ||||||
|       use: { ...devices['Desktop Firefox'] }, |       use: { | ||||||
|  |         ...devices[ "Desktop Firefox" ], | ||||||
|  |         storageState: "playwright/.auth/user.json" | ||||||
|  |       }, | ||||||
|  |       dependencies: [ "setup" ] | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     /* Test against mobile viewports. */ |     /* Test against mobile viewports. */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user