Skip to content

Commit

Permalink
Merge 75dc7a6 into 6a4e964
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi authored Jun 29, 2023
2 parents 6a4e964 + 75dc7a6 commit d6470ba
Showing 1 changed file with 35 additions and 48 deletions.
83 changes: 35 additions & 48 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,68 +92,55 @@ var _ = Describe("odo init interactive command tests", func() {
hasMultipleVersions = true
}
})
It("should allow for personalizing configurations", func() {
command := []string{"odo", "init"}
output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) {

helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")
Context("personalizing configuration", func() {
It("should allow to add and delete a port ", func() {
command := []string{"odo", "init"}
output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) {

helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")

if hasMultipleVersions {
helper.ExpectString(ctx, "Select version")
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
}

helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.ExpectString(ctx, "runtime")
helper.SendLine(ctx, "runtime")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new port")

helper.ExpectString(ctx, "Enter port number:")
helper.SendLine(ctx, "5000")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new environment variable")
if hasMultipleVersions {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}

helper.ExpectString(ctx, "Enter new environment variable name:")
helper.SendLine(ctx, "DEBUG_PROJECT_PORT")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.ExpectString(ctx, "runtime")
helper.SendLine(ctx, "runtime")

helper.ExpectString(ctx, "Enter value for \"DEBUG_PROJECT_PORT\" environment variable:")
helper.SendLine(ctx, "5858")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete environment variable \"DEBUG_PORT\"")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new port")
helper.ExpectString(ctx, "Enter port number:")
helper.SendLine(ctx, "3000")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "NOTHING - configuration is correct")
helper.ExpectString(ctx, "What configuration do you want change")
// Default option is NOTHING - configuration is correct
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")
helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")

helper.ExpectString(ctx, "Enter component name:")
helper.SendLine(ctx, "my-nodejs-app")
helper.ExpectString(ctx, "Enter component name:")
helper.SendLine(ctx, "my-nodejs-app")

helper.ExpectString(ctx, "Your new component 'my-nodejs-app' is ready in the current directory.")
helper.ExpectString(ctx, "Your new component 'my-nodejs-app' is ready in the current directory.")

})
Expect(err).To(BeNil())
Expect(output).To(ContainSubstring("Your new component 'my-nodejs-app' is ready in the current directory."))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "3000")
})
Expect(err).To(BeNil())
Expect(output).To(ContainSubstring("Your new component 'my-nodejs-app' is ready in the current directory."))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "5000")
helper.FileShouldNotContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "3000")
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "DEBUG_PROJECT_PORT")
helper.FileShouldNotContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "DEBUG_PORT")
})
})

Expand Down

0 comments on commit d6470ba

Please sign in to comment.