Skip to content

Commit e1c4635

Browse files
committed
Merge remote-tracking branch 'origin/master' into HEAD
2 parents 86a6e6e + a4c3443 commit e1c4635

File tree

78 files changed

+1115
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1115
-264
lines changed

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ module.exports = {
199199
name: 'fs',
200200
message: 'Avoid node:fs and use shared/fs/fs.ts when possible.',
201201
},
202+
{
203+
name: 'child_process',
204+
message:
205+
'Avoid child_process, use ChildProcess from `shared/utilities/processUtils.ts` instead.',
206+
},
202207
],
203208
},
204209
],

buildspec/linuxE2ETests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ phases:
3737
commands:
3838
- export HOME=/home/codebuild-user
3939
# Ignore failure until throttling issues are fixed.
40-
- xvfb-run npm run testE2E || true
40+
- xvfb-run npm run testE2E
4141
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4242
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
4343
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"

docs/arch_develop.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ await tester.result(items[0].data) // Execute the actions, asserting the final r
444444

445445
Abstractly, a 'wizard' is a collection of discrete, linear steps (subroutines), where each step can potentially be dependent on prior steps, that results in some final state. Wizards are extremely common in top-level flows such as creating a new resource, deployments, or confirmation messages. For these kinds of flows, we have a shared `Wizard` class that handles the bulk of control flow and state management logic for us.
446446

447-
### Creating a Wizard (Quick Picks)
447+
### 1. `Wizard` Class
448448

449449
Create a new wizard by extending the base `Wizard` class, using the template type to specify the
450450
shape of the wizard state. All wizards have an internal `form` property that is used to assign
@@ -482,6 +482,41 @@ class ExampleWizard extends Wizard<ExampleState> {
482482
}
483483
```
484484

485+
### 2. `CompositeWizard` Class
486+
487+
`CompositeWizard` extends `Wizard` to create and manage a collection of nested/child wizards.
488+
489+
Extend this class to create a wizard that contains other wizards as part of a prompter flow.
490+
Use `this.createWizardPrompter()` to use a wizard as a prompter in the `CompositeWizard`.
491+
492+
Example:
493+
494+
```ts
495+
496+
// Child wizard
497+
class ChildWizard extends Wizard<ChildWizardForm> {...}
498+
499+
500+
// Composite wizard
501+
interface SingleNestedWizardForm {
502+
...
503+
singleNestedWizardNestedProp: string
504+
...
505+
}
506+
507+
class SingleNestedWizard extends CompositeWizard<SingleNestedWizardForm> {
508+
constructor() {
509+
super()
510+
...
511+
this.form.singleNestedWizardNestedProp.bindPrompter(() =>
512+
this.createWizardPrompter<ChildWizard, ChildWizardForm>(ChildWizard)
513+
)
514+
...
515+
}
516+
}
517+
518+
```
519+
485520
### Executing
486521

487522
Wizards can be ran by calling the async `run` method:
@@ -495,6 +530,8 @@ Note that all wizards can potentially return `undefined` if the workflow was can
495530

496531
### Testing
497532

533+
#### Using `WizardTester`
534+
498535
Use `createWizardTester` on an instance of a wizard. Tests can then be constructed by asserting both the user-defined and internal state. Using the above `ExampleWizard`:
499536

500537
```ts
@@ -505,6 +542,70 @@ tester.foo.applyInput('Hello, world!') // Manipulate 'user' state
505542
tester.bar.assertShow() // True since 'foo' has a defined value
506543
```
507544

545+
#### Using `PrompterTester`
546+
547+
Use `PrompterTester` to simulate user behavior (click, input and selection) on prompters to test end-to-end flow of a wizard.
548+
549+
Example:
550+
551+
```ts
552+
// 1. Register PrompterTester handlers
553+
const prompterTester = PrompterTester.init()
554+
.handleInputBox('Input Prompter title 1', (inputBox) => {
555+
// Register Input Prompter handler
556+
inputBox.acceptValue('my-source-bucket-name')
557+
})
558+
.handleQuickPick('Quick Pick Prompter title 2', (quickPick) => {
559+
// Register Quick Pick Prompter handler
560+
561+
// Optional assertion can be added as part of the handler function
562+
assert.strictEqual(quickPick.items.length, 2)
563+
assert.strictEqual(quickPick.items[0].label, 'Specify required parameters and save as defaults')
564+
assert.strictEqual(quickPick.items[1].label, 'Specify required parameters')
565+
// Choose item
566+
quickPick.acceptItem(quickPick.items[0])
567+
})
568+
.handleQuickPick(
569+
'Quick Pick Prompter with various handler behavior title 3',
570+
(() => {
571+
// Register handler with dynamic behavior
572+
const generator = (function* () {
573+
// First call, choose '**'
574+
yield async (picker: TestQuickPick) => {
575+
await picker.untilReady()
576+
assert.strictEqual(picker.items[1].label, '**')
577+
picker.acceptItem(picker.items[1])
578+
}
579+
// Second call, choose BACK button
580+
yield async (picker: TestQuickPick) => {
581+
await picker.untilReady()
582+
picker.pressButton(vscode.QuickInputButtons.Back)
583+
}
584+
// Third and subsequent call
585+
while (true) {
586+
yield async (picker: TestQuickPick) => {
587+
await picker.untilReady()
588+
picker.acceptItem(picker.items[1])
589+
}
590+
}
591+
})()
592+
593+
return (picker: TestQuickPick) => {
594+
const next = generator.next().value
595+
return next(picker)
596+
}
597+
})()
598+
)
599+
.build()
600+
601+
// 2. Run your wizard class
602+
const result = await wizard.run()
603+
604+
// 3. Assert your tests
605+
prompterTester.assertCallAll()
606+
prompterTester.assertCallOrder('Input Prompter title 1', 1)
607+
```
608+
508609
## Module path debugging
509610

510611
Node has an environment variable `NODE_DEBUG=module` that helps to debug module imports. This can be helpful on windows, which can load node modules into uppercase or lower case drive letters, depending on the drive letter of the parent module.

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present"
4040
},
4141
"devDependencies": {
42-
"@aws-toolkits/telemetry": "^1.0.287",
42+
"@aws-toolkits/telemetry": "^1.0.289",
4343
"@playwright/browser-chromium": "^1.43.1",
4444
"@stylistic/eslint-plugin": "^2.11.0",
4545
"@types/he": "^1.2.3",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/review: Apply fix removes other issues in the same file."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Fix(Amazon Q Code Transformation): show correct diff when running consecutive transformations"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Improve when the welcome page is shown in amazon q chat"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Chat: When navigating to previous prompts, code attachments are sometimes displayed incorrectly"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Chat: When writing a prompt without sending it, navigating via up/down arrows sometimes deletes the unsent prompt."
4+
}

0 commit comments

Comments
 (0)