This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
EVG-19948: Support EC2 On-Demand on provider settings page #2071
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
59193d0
EVG-19948: Support EC2 On-Demand on provider settings page
minnakt 645c0ad
Merge branch 'main' into EVG-19948
minnakt 0a127e1
Add description for sshKeyName
minnakt d0b2fa3
Add more missing descriptions, consolidate schemas
minnakt 84cbbb2
Merge branch 'main' into EVG-19948
minnakt fb25c9a
Last tweaks
minnakt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ describe("provider section", () => { | |
cy.contains("button", "Add host").click(); | ||
cy.getInputByLabel("Name").type("host-1234"); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert fields to original values. | ||
cy.getInputByLabel("User Data").clear(); | ||
|
@@ -32,7 +32,7 @@ describe("provider section", () => { | |
cy.dataCy("delete-item-button").first().click(); | ||
cy.dataCy("delete-item-button").first().click(); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
}); | ||
}); | ||
|
||
|
@@ -71,7 +71,7 @@ describe("provider section", () => { | |
force: true, | ||
}); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert fields to original values. | ||
cy.selectLGOption("Image Build Method", "Import"); | ||
|
@@ -83,7 +83,7 @@ describe("provider section", () => { | |
force: true, | ||
}); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
}); | ||
}); | ||
|
||
|
@@ -127,7 +127,7 @@ describe("provider section", () => { | |
cy.getInputByLabel("Device Name").type("device name"); | ||
cy.getInputByLabel("Size").type("200"); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert fields to original values. | ||
cy.selectLGOption("Region", "us-east-1"); | ||
|
@@ -138,7 +138,7 @@ describe("provider section", () => { | |
cy.dataCy("delete-item-button").click(); | ||
}); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
}); | ||
|
||
it("can add and delete region settings", () => { | ||
|
@@ -155,12 +155,89 @@ describe("provider section", () => { | |
cy.contains("button", "Add security group").click(); | ||
cy.getInputByLabel("Security Group ID").type("security-group-1234"); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert to original state by deleting the new region. | ||
cy.dataCy("delete-item-button").first().click(); | ||
save(); | ||
cy.validateToast("success"); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
cy.contains("button", "Add region settings").should("exist"); | ||
}); | ||
}); | ||
|
||
describe("ec2 on-demand", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/ubuntu1604-parent/settings/provider"); | ||
}); | ||
|
||
it("shows and hides fields correctly", () => { | ||
// VPC options. | ||
cy.dataCy("use-vpc").should("be.checked"); | ||
cy.contains("Default VPC Subnet ID").should("exist"); | ||
cy.contains("VPC Subnet Prefix").should("exist"); | ||
|
||
cy.dataCy("use-vpc").uncheck({ force: true }); | ||
cy.contains("Default VPC Subnet ID").should("not.exist"); | ||
cy.contains("VPC Subnet Prefix").should("not.exist"); | ||
Comment on lines
+181
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to take advantage asserting visibility if showing/hiding is a theme of the test. |
||
}); | ||
|
||
it("successfully updates ec2 on-demand provider fields", () => { | ||
cy.dataCy("provider-select").contains("EC2 On-Demand"); | ||
|
||
// Correct section is displayed. | ||
cy.dataCy("ec2-on-demand-provider-settings").should("exist"); | ||
cy.dataCy("region-select").contains("us-east-1"); | ||
|
||
// Change field values. | ||
cy.selectLGOption("Region", "us-west-1"); | ||
cy.getInputByLabel("EC2 AMI ID").as("amiInput"); | ||
cy.get("@amiInput").clear(); | ||
cy.get("@amiInput").type("ami-1234560"); | ||
cy.getInputByLabel("SSH Key Name").as("keyNameInput"); | ||
cy.get("@keyNameInput").clear(); | ||
cy.get("@keyNameInput").type("my ssh key"); | ||
cy.getInputByLabel("User Data").type("<powershell></powershell>"); | ||
cy.getInputByLabel("Merge with existing user data").check({ | ||
force: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably better to not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above |
||
}); | ||
save(); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert fields to original values. | ||
cy.selectLGOption("Region", "us-east-1"); | ||
cy.get("@amiInput").clear(); | ||
cy.get("@amiInput").type("ami-0000"); | ||
cy.get("@keyNameInput").clear(); | ||
cy.get("@keyNameInput").type("mci"); | ||
cy.getInputByLabel("User Data").clear(); | ||
cy.getInputByLabel("Merge with existing user data").uncheck({ | ||
force: true, | ||
}); | ||
save(); | ||
cy.validateToast("success", "Updated distro."); | ||
}); | ||
|
||
it("can add and delete region settings", () => { | ||
cy.dataCy("ec2-on-demand-provider-settings").should("exist"); | ||
|
||
// Add item for new region. | ||
cy.contains("button", "Add region settings").click(); | ||
cy.contains("button", "Add region settings").should("not.exist"); | ||
|
||
// Save new region. | ||
cy.selectLGOption("Region", "us-west-1"); | ||
cy.getInputByLabel("EC2 AMI ID").type("ami-1234"); | ||
cy.getInputByLabel("Instance Type").type("m5.xlarge"); | ||
cy.contains("button", "Add security group").click(); | ||
cy.getInputByLabel("Security Group ID").type("security-group-1234"); | ||
save(); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
// Revert to original state by deleting the new region. | ||
cy.dataCy("delete-item-button").first().click(); | ||
save(); | ||
cy.validateToast("success", "Updated distro."); | ||
|
||
cy.contains("button", "Add region settings").should("exist"); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think it's reliable to use
force
when making assertions on components related to the test description. Usingforce
prevents testing if theuse-vpc
button is actually available to click. Ifuse-vpc
is disabled or hidden, this code will pass through. I thinkforce
usage is okay when setting the page up in a particular state to begin testing because those assertions are less important then.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.
Using
force
is pretty much required for LG checkboxes since they have a styling that makes them hidden and unclickable