Skip to content

Commit

Permalink
Add more screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Jun 18, 2024
1 parent 7ab399d commit 3f5ee91
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/actions/cloud-slack-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ runs:
SLACK_TESTER_TESTER_BOT_TOKEN: ${{ inputs.slack_tester_bot_token }}
SLACK_BOT_DISPLAY_NAME: ${{ inputs.slack_bot_display_name }}
SLACK_TESTER_BOT_NAME: ${{ inputs.slack_tester_bot_name }}
SLACK_TESTER_MESSAGE_WAIT_TIMEOUT: 90s
SLACK_TESTER_MESSAGE_WAIT_TIMEOUT: 180s


BOTKUBE_CLOUD_API_BASE_URL: ${{ inputs.botkube_cloud_api_base_url }}
Expand Down
42 changes: 27 additions & 15 deletions test/cloud-slack-dev-e2e/botkube_page_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ func (p *BotkubeCloudPage) CreateNewInstance(t *testing.T, name string) {
}

func (p *BotkubeCloudPage) InstallAgentInCluster(t *testing.T, botkubeBinary string) {
t.Log("Installing Botkube using Botkube CLI")

t.Log("Getting Botkube install command")
installCmd := p.page.MustElement("div#install-upgrade-cmd > kbd").MustText()

t.Log("Installing Botkube using Botkube CLI")
args, err := shellwords.Parse(installCmd)
args = append(args, "--auto-approve")
require.NoError(t, err)
Expand All @@ -119,6 +119,7 @@ func (p *BotkubeCloudPage) InstallAgentInCluster(t *testing.T, botkubeBinary str
}

func (p *BotkubeCloudPage) OpenSlackAppIntegrationPage(t *testing.T) {
t.Log("Opening Slack App Integration Page")
p.page.MustElement(`button[aria-label="Add tab"]`).MustClick()
p.page.MustWaitStable()
p.page.MustElementR("button", "^Slack$").MustClick()
Expand Down Expand Up @@ -176,17 +177,17 @@ func (p *BotkubeCloudPage) FinishWizard(t *testing.T) {

p.page.MustElementR("button", "/^Next$/i").
MustWaitEnabled().
// we need to wait, otherwise, we click the same 'Next' button twice, before the query is executed, and we are really
// moved to the next step. If we have the navigation updated for each step, it will be resolved.
MustClick().MustWaitStable()
// We need to wait, otherwise, we click the same 'Next' button twice before the query is executed, and we are not really
// moved to the next step. Updating the navigation would resolve that issue.
MustClick().MustWaitStable()

p.page.Screenshot("after-first-next")

t.Log("Using pre-selected plugins. Navigating to wizard summary")
p.page.MustElementR("button", "/^Next$/i").
MustWaitEnabled().
// we need to wait, otherwise, we click the same 'Next' button twice, before the query is executed, and we are really
// moved to the next step. If we have the navigation updated for each step, it will be resolved.
// We need to wait, otherwise, we click the same 'Next' button twice before the query is executed, and we are not really
// moved to the next step. Updating the navigation would resolve that issue.
MustClick().MustWaitStable()
p.page.Screenshot("after-second-next")

Expand All @@ -198,33 +199,44 @@ func (p *BotkubeCloudPage) FinishWizard(t *testing.T) {

// wait till gql mutation passes, and navigates to install details, otherwise, we could navigate to instance details with state 'draft'
p.page.MustWaitNavigation()
p.page.Screenshot()
p.page.Screenshot("after-deploy-changes-navigation")
}

func (p *BotkubeCloudPage) UpdateKubectlNamespace(t *testing.T) {
t.Log("Updating 'kubectl' namespace property")
p.page.MustElementR(`div[role="tab"]`, "Plugins").MustFocus().MustClick().MustWaitStable()

p.page.MustWaitStable()
p.page.MustElement(`button[id^="botkube/kubectl_"]`).MustClick()
p.page.MustElement(`div[data-node-key="ui-form"]`).MustClick()

p.openKubectlUpdateForm()

p.page.MustElementR("input#root_defaultNamespace", "default").MustSelectAllText().MustInput("kube-system")
p.page.Screenshot("after-changing-namespace-property")
p.page.MustElementR("button", "/^Update$/i").MustClick()
p.page.Screenshot("after-clicking-plugin-update")

t.Log("Submitting changes")
p.page.MustElementR("button", "/^Deploy changes$/i").MustClick().MustWaitStable()
p.page.MustWaitStable()
p.page.MustElementR("button", "/Deploy changes/i").MustClick()
p.page.Screenshot("after-deploying-plugin-changes")
}

func (p *BotkubeCloudPage) VerifyUpdatedKubectlNamespace(t *testing.T) {
t.Log("Verifying that the 'namespace' value was updated and persisted properly")

p.openKubectlUpdateForm()
p.page.MustElementR("input#root_defaultNamespace", "kube-system")
}

func (p *BotkubeCloudPage) openKubectlUpdateForm() {
p.page.Screenshot("before-selecting-plugins-tab")
p.page.MustElementR(`div[role="tab"]`, "Plugins").MustFocus().MustClick().MustWaitStable()

p.page.MustWaitStable()
p.page.Screenshot("after-selecting-plugins-tab")

p.page.MustElement(`button[id^="botkube/kubectl_"]`).MustClick()
p.page.Screenshot("after-opening-kubectl-cfg")

p.page.MustElement(`div[data-node-key="ui-form"]`).MustClick()
p.page.Screenshot("after-selecting-kubectl-cfg-form")
p.page.MustElementR("input#root_defaultNamespace", "kube-system")
}

func appendOrgIDQueryParam(t *testing.T, inURL, orgID string) string {
Expand Down
17 changes: 12 additions & 5 deletions test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,14 @@ func TestCloudSlackE2E(t *testing.T) {
botkubeCloudPage.SetupSlackWorkspace(t, channel.Name())
botkubeCloudPage.FinishWizard(t)
botkubeCloudPage.VerifyDeploymentStatus(t, "Connected")
botkubeCloudPage.UpdateKubectlNamespace(t)
botkubeCloudPage.VerifyDeploymentStatus(t, "Updating")
botkubeCloudPage.VerifyDeploymentStatus(t, "Connected")
botkubeCloudPage.VerifyUpdatedKubectlNamespace(t)

if !isHeadless { // it is flaky on CI, more investigation needed
botkubeCloudPage.UpdateKubectlNamespace(t)
botkubeCloudPage.VerifyDeploymentStatus(t, "Updating")
botkubeCloudPage.VerifyDeploymentStatus(t, "Connected")
botkubeCloudPage.VerifyUpdatedKubectlNamespace(t)
}

})

t.Run("Run E2E tests with deployment", func(t *testing.T) {
Expand Down Expand Up @@ -439,6 +443,9 @@ func removeSourcesAndAddActions(t *testing.T, gql *graphql.Client, existingDeplo

var updatePluginGroup []*gqlModel.PluginConfigurationGroupUpdateInput
for _, createdPlugin := range existingDeployment.Plugins {
if strings.Contains(createdPlugin.Name, "ai") {
continue
}
updatePluginGroup = append(updatePluginGroup, &gqlModel.PluginConfigurationGroupUpdateInput{
ID: &createdPlugin.ID,
Name: createdPlugin.Name,
Expand Down Expand Up @@ -468,7 +475,7 @@ func removeSourcesAndAddActions(t *testing.T, gql *graphql.Client, existingDeplo
ChannelID: "", // this is used for UI only so we don't need to provide it
Name: channel.Name,
Bindings: &gqlModel.BotBindingsUpdateInput{
Sources: []*string{},
Sources: []*string{},
Executors: executors,
},
})
Expand Down
2 changes: 1 addition & 1 deletion test/commplatform/slack_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type SlackConfig struct {
CloudTesterAppToken string `envconfig:"optional"`
CloudTesterName string `envconfig:"default=tester2"`
RecentMessagesLimit int `envconfig:"default=6"`
MessageWaitTimeout time.Duration `envconfig:"default=50s"`
MessageWaitTimeout time.Duration `envconfig:"default=120s"`
}

type SlackChannel struct {
Expand Down

0 comments on commit 3f5ee91

Please sign in to comment.