-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Run e2e tests against emulator from URL or firmware branch #15689
base: develop
Are you sure you want to change the base?
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.
this is definitely a nice step forward. maybe cc @szymonlesisz who asked for this feature.
@@ -22,10 +22,33 @@ export interface StartEmu { | |||
model?: Model; | |||
} | |||
|
|||
interface StartEmuFromUrl extends Omit<StartEmu, 'version'> { | |||
interface StartEmuType extends StartEmu { | |||
type?: 'emulator-start'; |
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.
should type
be optional here?
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.
also for StartEmuType
should wipe and model be optional?
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.
type
needs to be optional here so everything is working in runtime and is typescript
-correct in packages/connect/e2e/common.setup.ts
. Crucial lines are below:
const emulatorStartOpts: EmuStartOptsType =
(process.env.emulatorStartOpts as any) || global.emulatorStartOpts || {};
const emuStartType = emulatorStartOpts.type;
switch (emuStartType) {
case 'emulator-start':
case undefined:
...
For runtime, it is possible that the process.env.emulatorStartOpts
is empty, so it will try to take global.emulatorStartOpts
... I did not know where it is defined, I see only the interface:
var emulatorStartOpts: {
version: string;
model: 'T1B1' | 'T2T1' | 'T2B1' | 'T3T1';
};
So one possibility is to add type: 'emulator-start'
there, and the second one was to make it optional and account for the undefined
in switch.
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.
Good point, in StartEmuType
almost all parameters are needed - version
, model
, wipe
- that probably means not extending from StartEmu
, as it overrides almost everything
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.
Correction - it was now possible to get rid of the type
optionality - 3eddfc5
However, now the version
needs to be optional, because it is potentially undefined
in this case:
const latest = getLatestFirmware(model);
const version = firmwareArg
? firmwareArg?.endsWith('-latest')
? latest
: firmwareArg
: latest;
emulatorStartOpts = {
type: 'emulator-start',
wipe: true,
version,
model,
};
…L or from specific firmware branch
…from URL or from specific firmware branch
Allow for running
e2e
tests not only with emulators hardcoded intenv
, but also from:The way of running these is either:
packages/connect/e2e/run.ts
:NOTE: for local development, emulators from branches do not support
ARM
, so it will work for you only in CI