Deflake settings persistence desktop test by verifying we have written to the disk before continuing (#4349)
This commit is contained in:
		| @ -266,10 +266,15 @@ test.describe('Testing settings', () => { | ||||
|         process.platform === 'win32', | ||||
|         'TODO: remove this skip https://github.com/KittyCAD/modeling-app/issues/3557' | ||||
|       ) | ||||
|       const { electronApp, page } = await setupElectron({ | ||||
|       const projectName = 'bracket' | ||||
|       const { | ||||
|         electronApp, | ||||
|         page, | ||||
|         dir: projectDirName, | ||||
|       } = await setupElectron({ | ||||
|         testInfo, | ||||
|         folderSetupFn: async (dir) => { | ||||
|           const bracketDir = join(dir, 'bracket') | ||||
|           const bracketDir = join(dir, projectName) | ||||
|           await fsp.mkdir(bracketDir, { recursive: true }) | ||||
|           await fsp.copyFile( | ||||
|             executorInputPath('focusrite_scarlett_mounting_braket.kcl'), | ||||
| @ -281,6 +286,11 @@ test.describe('Testing settings', () => { | ||||
|       await page.setViewportSize({ width: 1200, height: 500 }) | ||||
|  | ||||
|       // Selectors and constants | ||||
|       const tempSettingsFilePath = join( | ||||
|         projectDirName, | ||||
|         projectName, | ||||
|         PROJECT_SETTINGS_FILE_NAME | ||||
|       ) | ||||
|       const userThemeColor = '120' | ||||
|       const projectThemeColor = '50' | ||||
|       const settingsOpenButton = page.getByRole('link', { | ||||
| @ -312,6 +322,13 @@ test.describe('Testing settings', () => { | ||||
|         await themeColorSetting.fill(projectThemeColor) | ||||
|         await expect(logoLink).toHaveCSS('--primary-hue', projectThemeColor) | ||||
|         await settingsCloseButton.click() | ||||
|         // Make sure that the project settings file has been written to before continuing | ||||
|         await expect | ||||
|           .poll(async () => fsp.readFile(tempSettingsFilePath, 'utf-8'), { | ||||
|             message: 'Setting should now be written to the file', | ||||
|             timeout: 5_000, | ||||
|           }) | ||||
|           .toContain(`themeColor = "${projectThemeColor}"`) | ||||
|       }) | ||||
|  | ||||
|       await test.step('Refresh the application and see project setting applied', async () => { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user