-
-
Notifications
You must be signed in to change notification settings - Fork 76
test: Add Remix e2e tests with test utils. #649
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
Conversation
83d2cc5
to
f2bf4f4
Compare
8ad89ee
to
074ec99
Compare
package.json
Outdated
"xcode": "3.0.1", | ||
"xml-js": "^1.6.11", | ||
"yargs": "^16.2.0" | ||
"yargs": "^17.7.2" |
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.
Yargs 17 dropped support for Node 14 in yargs/yargs#2384 which is why we didn't bump it earlier. I'd say though that bumping it is probably fine, I would just do it in a separate PR and cut a major release for the wizard (no big deal imo). Does that make sense?
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 had to update it when I was experimenting but it seems we can stay at the current version with what I ended up. So just reverted the version update 👍
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.
Just a first quick pass. Generally love it. I think we should address the two comments I left above and then we can iterate more (although I don't think there is much more necessary).
e2e-tests/utils/index.ts
Outdated
* @param integration | ||
* @param projectDir | ||
*/ | ||
export async function runWizard(integration: Integration, projectDir: string) { |
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.
What if, instead of having all of this functionality in this function, we call this function something like startWizardInstance
and it returns the wizardTestEnv
so you can call stuff on it inside the jest tests? That way, we're a little more dynamic in what we can test and the various permutations we can test for more complicated wizards.
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.
Updated and moved to Jest runner 👍
04d8d03
to
d107969
Compare
d107969
to
475ca82
Compare
preSelectedProject?: { | ||
authToken: string; | ||
selfHosted: boolean; | ||
dsn: string; | ||
projectId: string; | ||
projectSlug: string; | ||
projectName: string; | ||
orgId: string; | ||
orgName: string; | ||
orgSlug: string; | ||
}; |
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.
Note: This overlaps with #671. So if preSelectedProject
is provided, the newly added --orgSlug
and --projectSlug
will not have any effect on the wizard behaviour.
wizardInstance.sendStdin(KEYS.ENTER); | ||
} | ||
|
||
const examplePagePrompted = await wizardInstance.waitForOutput( |
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 don't fully understand why we need the optional
configuration... Would you mind explaining it to me? I feel like I'm missing something. 😄
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.
It's primarily for local development where the test flows can be fragile, for example when the package manager is detected somehow and it's not prompted, or the leftovers from the example page exist and it's not prompted.
I think we can improve the utils in follow-up PRs to make them more debuggable, but this makes writing / debugging tests slightly easier in the meantime.
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.
Seems good! 👍
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.
The tests run suspicously fast 😂 but otherwise lgtm. Would you mind going over the changes I made one more time and make sure that I didn't do anything dumb? Then we can ship this! Sorry for the insane delay - totally on me.
@lforst, the updates look good to me, I just increased the timeout after |
Adds utilities for E2E testing wizard CLI
Non-testing updates
Testing utilities
The flow of the initial e2e test structure is:
stdout
for expected prompts / messages, provide conditionalstdin
In the future, we can also add new utilities to check if the events/transaction from the created example page are sent successfully to Sentry