-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add import and export capabilities for devices and suites #1268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add import and export capabilities for devices and suites #1268
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You pulled it off so nicely!! 👏🏼
Just a couple of minor things, looks great otherwise!
window.electron.store.set('deviceManager.previewSuites', []); | ||
state.suites = action.payload; | ||
state.activeSuite = action.payload[0].id; | ||
window.electron.store.set('deviceManager.previewSuites', action.payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it will override the existing suites as well, wouldn't that result in a loss of data if the user already had any custom suites?
I just noticed that there was a warning message indicating this, should we try to append it to the existing suites instead of replacing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, should we add also a button to reset the whole thing so they can go to the initial clean state as well?
.all-contributorsrc
Outdated
@@ -739,6 +739,15 @@ | |||
"contributions": [ | |||
"code" | |||
] | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this, as it will be autopopulated by allContributors bot that updates the README as well.
const mockHandleUpload = jest.fn(); | ||
const mockResetUploadedFile = jest.fn(); | ||
|
||
describe('FileUploader', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really appreciate the unit tests! 🫡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to add more on the ManageSuitesTool but I am having issues with the electron store, I can't seem to mock it. Do you have any idea how to mock it properly?
This is the error:
FAIL src/renderer/components/DeviceManager/PreviewSuites/ManageSuitesTool/ManageSuitesTool.test.tsx
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'store')
4 | import { sanitizeSuites } from './utils';
5 |
> 6 | const activeDeviceIds: string[] = window.electron.store.get(
| ^
7 | 'deviceManager.activeDevices'
8 | );
9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to add a mock electron
object to the window before the test runs?
Something like this:
electron-mock.ts
const store = {};
window.electron = {
store: {
get: (key: string) => {
return store[key];
},
set: (key: string, val: any) => {
store[key] = val;
}
}
};
And then import this file at the top of the test file?
(haven't thought this through, just a quick suggestion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, I think we need to add a setup file for jest in the root. I will investigate further in a different pr
onClick={() => setOpen(true)} | ||
> | ||
<Icon | ||
icon="mdi:folder-upload" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards uil:import
and uil:export
for the icons?
As the current ones look more like a folder import/export to me. Wdyt?
Now instead of replacing, it merges whatever was there with the new. replace.mp4Also implements accordion and rearranges UI newui.mp4 |
remove changes
Merging this in now. You pulled it off so great for your first commit to the repo! @violetadev 👏🏼 Thank you so much! Looking forward to more like this in the future. |
@all-contributors Please add @violetadev for code. |
I've put up a pull request to add @violetadev! 🎉 |
✨ Pull Request
📓 Referenced Issue
Fixes: #1258
ℹ️ About the PR
This PR reintroduces import/export capabilities in order to users to back up their settings and import them back.
🖼️ Testing Scenarios / Screenshots
respons.mp4