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

test(amplify-e2e-tests): add layerAndFunctionExist param to trigger capability selection #7784

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/amplify-e2e-core/src/categories/lambda-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ const coreFunction = (
selectTemplate(chain, settings.functionTemplate, runtime);
}
} else {
if (settings.layerOptions && settings.layerOptions.layerAndFunctionExist) {
chain.wait('Select which capability you want to update:').sendCarriageReturn() // lambda function
}
chain.wait('Select the Lambda function you want to update').sendCarriageReturn(); // assumes only one function configured in the project
}

Expand Down Expand Up @@ -358,6 +361,7 @@ export const removeFunction = (cwd: string, funcName: string) =>

export interface LayerOptions {
select?: string[]; // list options to select
layerAndFunctionExist?: boolean; // whether this test involves both a function and a layer
expectedListOptions?: string[]; // the expected list of all layers
versions?: Record<string, { version: number; expectedVersionOptions: number[] }>; // map with keys for each element of select that determines the verison and expected version for each layer
customArns?: string[]; // external ARNs to enter
Expand Down
2 changes: 2 additions & 0 deletions packages/amplify-e2e-tests/src/__tests__/layer-2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ describe('amplify add lambda layer with changes', () => {
expectedListOptions: [fullLayerName],
versions: { [fullLayerName]: { version: 1, expectedVersionOptions: [1] } },
skipLayerAssignment: true,
layerAndFunctionExist: true,
},
};

Expand All @@ -277,6 +278,7 @@ describe('amplify add lambda layer with changes', () => {
layerName,
projName,
layerOptions: {
layerAndFunctionExist: true,
layerWalkthrough: (chain: ExecutionContext): void => {
chain
.wait('Provide existing layers')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ describe('test lambda layer migration flow introduced in v5.0.0', () => {
layerOptions: {
select: [],
expectedListOptions: [layerName],
layerAndFunctionExist: true,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ describe('amplify function migration', () => {
layerOptions: {
select: [projName + layerName],
expectedListOptions: [projName + layerName],
layerAndFunctionExist: true,
},
name: function1,
testingWithLatestCodebase: true,
Expand Down