diff --git a/.github/actions/cloud-slack-e2e/action.yaml b/.github/actions/cloud-slack-e2e/action.yaml index ba78b7ec7..9f529a18d 100644 --- a/.github/actions/cloud-slack-e2e/action.yaml +++ b/.github/actions/cloud-slack-e2e/action.yaml @@ -58,29 +58,16 @@ runs: shell: bash run: "k3d cluster create cloud-slack-e2e-cluster --wait --timeout=5m" - - name: CLI Cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - dist/botkube-cli_linux_amd64_v1/botkube - key: botkube-cli_linux_amd64_v1 - - - name: Install GoReleaser - uses: goreleaser/goreleaser-action@v5 - with: - install-only: true - version: latest - - - name: Build CLI + - name: Download Botkube CLI shell: bash - run: make build-single-arch-cli + run: | + curl -Lo botkube https://github.com/kubeshop/botkube/releases/download/v1.12.0/botkube-linux-amd64 + chmod +x botkube - name: Add Botkube CLI to env shell: bash run: | - echo BOTKUBE_CLI_BINARY_PATH="$PWD/dist/botkube-cli_linux_amd64_v1/botkube" >> $GITHUB_ENV + echo BOTKUBE_CLI_BINARY_PATH="$PWD/botkube" >> $GITHUB_ENV - name: Setup Go modules id: modules diff --git a/.github/workflows/test-ui-e2e-tests.yml b/.github/workflows/test-ui-e2e-tests.yml new file mode 100644 index 000000000..760be16c7 --- /dev/null +++ b/.github/workflows/test-ui-e2e-tests.yml @@ -0,0 +1,49 @@ +name: Test UI E2E tests on PR + +on: + push: + branches: + - extend-ui-tests + +env: + GIT_USER: botkube-dev + HELM_VERSION: v3.9.0 + K3D_VERSION: v5.4.6 + IMAGE_REGISTRY: "ghcr.io" + IMAGE_REPOSITORY: "kubeshop/botkube" + IMAGE_TAG: v9.99.9-dev # TODO: Use commit hash tag to make the predictable builds for each commit on branch + +jobs: + cloud-slack-dev-e2e: + name: Botkube Cloud Slack Dev E2E + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + concurrency: + group: cloud-slack-dev-e2e + cancel-in-progress: false + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run e2e tests + uses: ./.github/actions/cloud-slack-e2e + with: + access_token: ${{ secrets.E2E_TEST_GH_DEV_ACCOUNT_PAT }} + + slack_workspace_name: ${{ secrets.E2E_DEV_SLACK_WORKSPACE_NAME }} + slack_email: ${{ secrets.E2E_DEV_SLACK_EMAIL }} + slack_password: ${{ secrets.E2E_DEV_SLACK_USER_PASSWORD }} + slack_bot_display_name: "BotkubeDev" + slack_tester_bot_token: ${{ secrets.E2E_DEV_SLACK_TESTER_BOT_TOKEN }} + slack_tester_bot_name: "botkubedev" + + botkube_cloud_api_base_url: "https://api-dev.botkube.io" + botkube_cloud_email: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_EMAIL }} + botkube_cloud_password: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_PASSWORD }} + botkube_cloud_team_organization_id: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID }} + + slack_alerts_webhook: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }} + + e2e_type: "DEV" diff --git a/test/cloud-slack-dev-e2e/botkube_page_helpers_test.go b/test/cloud-slack-dev-e2e/botkube_page_helpers_test.go index dacdcea3e..17f4b8343 100644 --- a/test/cloud-slack-dev-e2e/botkube_page_helpers_test.go +++ b/test/cloud-slack-dev-e2e/botkube_page_helpers_test.go @@ -160,8 +160,10 @@ func (p *BotkubeCloudPage) SetupSlackWorkspace(t *testing.T, channel string) { // filter by channel, to make sure that it's visible on the first table page, in order to select it in the next step t.Log("Filtering by channel name") - p.page.Keyboard.MustType(input.End) // scroll bottom, as the footer collides with selecting filter - p.page.MustElement("table th:nth-child(3) span.ant-dropdown-trigger.ant-table-filter-trigger").MustFocus().MustClick() + //p.page.Keyboard.MustType(input.End) // scroll bottom, as the footer collides with selecting filter + p.page.Mouse.MustScroll(10, 5000) + p.page.Screenshot() + p.page.MustElement("table th:nth-child(3) span.ant-dropdown-trigger.ant-table-filter-trigger").MustClick() t.Log("Selecting channel checkbox") p.page.MustElement("input#name-channel").MustInput(channel).MustType(input.Enter) @@ -198,10 +200,15 @@ func (p *BotkubeCloudPage) UpdateKubectlNamespace(t *testing.T) { func (p *BotkubeCloudPage) VerifyUpdatedKubectlNamespace(t *testing.T) { t.Log("Verifying that the 'namespace' value was updated and persisted properly") + p.page.Screenshot() p.page.MustElementR(`div[role="tab"]`, "Plugins").MustClick() + p.page.Screenshot() p.page.MustElement(`button[id^="botkube/kubectl_"]`).MustClick() + p.page.Screenshot() p.page.MustElement(`div[data-node-key="ui-form"]`).MustClick() + p.page.Screenshot() p.page.MustElementR("input#root_defaultNamespace", "kube-system") + p.page.Screenshot() } func appendOrgIDQueryParam(t *testing.T, inURL, orgID string) string { diff --git a/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go b/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go index b0c10c5c7..738433b9d 100644 --- a/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go +++ b/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go @@ -124,7 +124,7 @@ func TestCloudSlackE2E(t *testing.T) { t.Run("Creating Botkube Instance with newly added Slack Workspace", func(t *testing.T) { t.Log("Setting up browser...") - launcher := launcher.New().Headless(false) + launcher := launcher.New().Headless(true) isHeadless := launcher.Has(flags.Headless) t.Cleanup(launcher.Cleanup) @@ -157,7 +157,6 @@ 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") diff --git a/test/cloud-slack-dev-e2e/slack_page_helpers_test.go b/test/cloud-slack-dev-e2e/slack_page_helpers_test.go index 1411d5e4f..09ffe8efc 100644 --- a/test/cloud-slack-dev-e2e/slack_page_helpers_test.go +++ b/test/cloud-slack-dev-e2e/slack_page_helpers_test.go @@ -4,6 +4,7 @@ package cloud_slack_dev_e2e import ( "testing" + "time" "github.com/go-rod/rod" ) @@ -44,7 +45,13 @@ func (p *SlackPage) ConnectWorkspace(t *testing.T, headless bool, browser *rod.B p.page.Screenshot() t.Log("Hide Slack cookie banner that collides with 'Sign in' button") - p.page.MustElement("button#onetrust-accept-btn-handler").MustClick() + cookie, err := p.page.Timeout(5 * time.Second).Element("button#onetrust-accept-btn-handler") + if err != nil { + t.Logf("Failed to obtain cookie element: %s. Skipping...", err.Error()) + } else { + cookie.MustClick() + } + p.page.MustElementR("button", "/^Sign in$/i").MustClick() p.page.Screenshot() @@ -63,4 +70,3 @@ func (p *SlackPage) ConnectWorkspace(t *testing.T, headless bool, browser *rod.B _ = p.page.Close() // the page should be closed automatically anyway } -