Skip to content

fix(e2e): delete elasticbeanstalk app in After call #3958

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

Merged
merged 1 commit into from
Sep 15, 2022
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
1 change: 0 additions & 1 deletion features/elasticbeanstalk/elasticbeanstalk.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Feature: AWS Elastic Beanstalk
And I describe the Elastic Beanstalk application
Then the result should contain the Elastic Beanstalk application version
And the result should contain the Elastic Beanstalk application name
And I delete the Elastic Beanstalk application

Scenario: Error handling
Given I create an Elastic Beanstalk application with name prefix ""
Expand Down
40 changes: 21 additions & 19 deletions features/elasticbeanstalk/step_definitions/elasticbeanstalk.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
const { Before, Given, Then } = require("@cucumber/cucumber");
const { After, Before, Given, Then } = require("@cucumber/cucumber");

Before({ tags: "@elasticbeanstalk" }, function (scenario, callback) {
Before({ tags: "@elasticbeanstalk" }, function () {
const { ElasticBeanstalk } = require("../../../clients/client-elastic-beanstalk");
this.service = new ElasticBeanstalk({});
callback();
});

Given("I create an Elastic Beanstalk application with name prefix {string}", function (prefix, callback) {
After({ tags: "@elasticbeanstalk" }, async function () {
if (this.appName) {
await this.service.deleteApplication({ ApplicationName: this.appName });
this.appName = undefined;
}
});

Given("I create an Elastic Beanstalk application with name prefix {string}", async function (prefix) {
this.appName = this.uniqueName(prefix);
const params = { ApplicationName: this.appName };
this.request(null, "createApplication", params, callback, false);
try {
this.data = await this.service.createApplication({ ApplicationName: this.appName });
} catch (error) {
this.error = error;
}
});

Given("I create an Elastic Beanstalk application version with label {string}", function (label, callback) {
Given("I create an Elastic Beanstalk application version with label {string}", async function (label) {
this.appVersion = label;
const params = {
ApplicationName: this.appName,
VersionLabel: this.appVersion,
};
this.request(null, "createApplicationVersion", params, callback);
await this.service.createApplicationVersion(params);
});

Given("I describe the Elastic Beanstalk application", function (callback) {
Given("I describe the Elastic Beanstalk application", async function () {
const params = { ApplicationNames: [this.appName] };
this.request(null, "describeApplications", params, callback);
this.data = await this.service.describeApplications(params);
});

Then("the result should contain the Elastic Beanstalk application version", function (callback) {
Then("the result should contain the Elastic Beanstalk application version", function () {
this.assert.deepEqual(this.data.Applications[0].Versions, [this.appVersion]);
callback();
});

Then("the result should contain the Elastic Beanstalk application name", function (callback) {
Then("the result should contain the Elastic Beanstalk application name", function () {
this.assert.equal(this.data.Applications[0].ApplicationName, this.appName);
callback();
});

Then("I delete the Elastic Beanstalk application", function (callback) {
const params = { ApplicationName: this.appName };
this.request(null, "deleteApplication", params, callback);
});