Skip to content
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

fix(e2e): local e2e test hanging for sendYes #13010

Closed
wants to merge 5 commits into from

Conversation

0618
Copy link
Contributor

@0618 0618 commented Jul 26, 2023

Description of changes

Issue: Local e2e test for hanging sendYes when amplify_push

Error message:

[6.536,"o","\u001b[32m?\u001b[39m \u001b[1mAre you sure you want to continue?\u001b[22m\u001b[0m \u001b[0m\u001b[2m(Y/n) \u001b[22m"]
[6.536,"o","\u001b[43D\u001b[43C"]
[6.538,"o","\u001b[2K\u001b[G"]
[6.538,"o","\u001b[32m?\u001b[39m \u001b[1mAre you sure you want to continue?\u001b[22m\u001b[0m \u001b[0m\u001b[2m(Y/n) \u001b[22mY\u001b[44D"]

Y was sent, but no return.

Short term fix: add .sendCarriageReturn()

Long term fix: migrate from enquirer(npm), which is no longer under maintained. (We implemented enquirer in #7774 because it's lighter than inquirer (npm) and has some list filtering feature we wanted).

Other changes:

  • update the sample.env file

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0618 0618 requested a review from a team as a code owner July 26, 2023 18:35
# Used for cleanup script
CIRCLECI_TOKEN = '<your token>' # Token used for querying CircleCI to get the build details
CIRCLE_PROJECT_USERNAME='<your github username>'
CIRCLE_PROJECT_REPONAME='amplify-cli'

AMPLIFY_PATH=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comment that explains what this does.

Something like # A path to Amplify CLI executable. When working locally it should be set to bin/amplify file in the workspace, for example <insert example here> if running regular e2e test. If working locally with migration test it should point to older version of amplify. Absolute paths are recommended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 295ec90

@@ -44,10 +44,12 @@ export const amplifyPush = async (cwd: string, testingWithLatestCodebase = false
const pushArgs = ['push', ...(opts?.minify ? ['--minify'] : [])];
// Test amplify push
await spawn(getCLIPath(testingWithLatestCodebase), pushArgs, { cwd, stripColors: true, noOutputTimeout: pushTimeoutMS })
.wait('Are you sure you want to continue?')
.wait('Are you sure you want to continue "amplify push"?')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct change?
If e2e tests pass then it's fine I guess.
Otherwise the wait argument can be subset of prompt for example Are you sure you want to continue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I accidentally commit this change..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it passed the e2e test and it's sort of useful, I'll just leave it here

Copy link
Member

@sobolk sobolk Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all e2e tests? if pipeline is green good to keep this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all e2e tests tho 🫢

Ok...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.
if you want to capture both variants then either
.wait('Are you sure you want to continue')
OR .wait(/<some awesome regex to capture both/)
see

wait: (expectation: string | RegExp, cb?: (data: string) => void) => ExecutionContext;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure if we have 2 variants)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it simple, I just removed the change 😂 4ad7631

@codecov-commenter
Copy link

Codecov Report

Merging #13010 (295ec90) into dev (ec9a2ba) will increase coverage by 48.38%.
Report is 261 commits behind head on dev.
The diff coverage is 55.55%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff             @@
##              dev   #13010       +/-   ##
===========================================
+ Coverage    0.00%   48.38%   +48.38%     
===========================================
  Files        1296      840      -456     
  Lines      149743    38069   -111674     
  Branches     1296     7787     +6491     
===========================================
+ Hits            0    18419    +18419     
+ Misses     148447    18056   -130391     
- Partials     1296     1594      +298     
Files Changed Coverage Δ
...rmation/auth-stack-builder/auth-stack-transform.ts 89.22% <ø> (+89.22%) ⬆️
.../src/provider-utils/awscloudformation/constants.ts 100.00% <ø> (+100.00%) ⬆️
...e-walkthrough-types/awsCognito-user-input-types.ts 100.00% <ø> (+100.00%) ⬆️
...vice-walkthrough-types/cognito-user-input-types.ts 100.00% <ø> (+100.00%) ⬆️
...y-category-function/src/commands/function/build.ts 0.00% <0.00%> (ø)
...ify-category-function/src/events/prePushHandler.ts 33.33% <0.00%> (+33.33%) ⬆️
...ider-utils/awscloudformation/utils/layerHelpers.ts 21.80% <0.00%> (+21.80%) ⬆️
...er-utils/awscloudformation/utils/storeResources.ts 30.38% <ø> (+30.38%) ⬆️
...ib/S3AndCloudFront/helpers/configure-CloudFront.js 87.06% <ø> (+87.06%) ⬆️
...lify-category-hosting/lib/S3AndCloudFront/index.js 89.65% <ø> (+89.65%) ⬆️
... and 60 more

... and 1237 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@0618
Copy link
Contributor Author

0618 commented Jul 28, 2023

No longer needed.

@0618 0618 closed this Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants