From 6774ff63d1f1c573e05b1ffaf24cad10fe13b49f Mon Sep 17 00:00:00 2001 From: Salah Aldeen Al Saleh Date: Tue, 24 Sep 2024 12:40:43 -0700 Subject: [PATCH 1/2] Move multi app install test to Playwright --- .github/workflows/build-test.yaml | 4 +- e2e/Makefile | 7 +++- e2e/README.md | 40 ++++-------------- e2e/inventory/inventory.go | 7 ++-- .../tests/multi-app-install/app1-license.yaml | 23 +++++++++++ .../tests/multi-app-install/app2-license.yaml | 23 +++++++++++ .../tests/multi-app-install/test.spec.ts | 41 +++++++++++++++++++ e2e/playwright/tests/shared/upload-license.ts | 4 +- 8 files changed, 108 insertions(+), 41 deletions(-) create mode 100644 e2e/playwright/tests/multi-app-install/app1-license.yaml create mode 100644 e2e/playwright/tests/multi-app-install/app2-license.yaml create mode 100644 e2e/playwright/tests/multi-app-install/test.spec.ts diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 1f29e4230f..2e082d0978 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -2899,8 +2899,6 @@ jobs: kots-namespace: 'multi-app-install' k8s-distribution: ${{ matrix.cluster.distribution }} k8s-version: ${{ matrix.cluster.version }} - testim-access-token: '${{ secrets.TESTIM_ACCESS_TOKEN }}' - testim-branch: ${{ github.head_ref == 'main' && 'master' || github.head_ref }} replicated-api-token: '${{ secrets.C11Y_MATRIX_TOKEN }}' kots-dockerhub-username: '${{ secrets.E2E_DOCKERHUB_USERNAME }}' kots-dockerhub-password: '${{ secrets.E2E_DOCKERHUB_PASSWORD }}' @@ -4340,7 +4338,6 @@ jobs: - validate-target-kots-version - validate-range-kots-version - validate-multi-app-backup-and-restore - - validate-multi-app-install - validate-airgap-smoke-test - validate-support-bundle - validate-gitops @@ -4350,6 +4347,7 @@ jobs: - validate-no-required-config - validate-config - validate-change-channel + - validate-multi-app-install # non-testim tests - validate-minimal-rbac - validate-minimal-rbac-override diff --git a/e2e/Makefile b/e2e/Makefile index 3fb0dae36e..1594173677 100644 --- a/e2e/Makefile +++ b/e2e/Makefile @@ -6,16 +6,19 @@ PLAYWRIGHT_DIR := $(shell pwd)/playwright SHELL := /bin/bash +OS ?= linux +ARCH ?= $(shell go env GOARCH) + .PHONY: all all: build deps test .PHONY: deps deps: - docker build -t e2e-deps . + docker build --platform $(OS)/$(ARCH) -t e2e-deps . .PHONY: build build: - go test $(BUILDFLAGS) -c -o bin/e2e.test . + GOOS=$(OS) GOARCH=$(ARCH) go test $(BUILDFLAGS) -c -o bin/e2e.test . .PHONY: test test: export GINKGO_EDITOR_INTEGRATION=1 # disable error on programatic focus diff --git a/e2e/README.md b/e2e/README.md index 898d37533a..d510802ca2 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -4,17 +4,15 @@ E2E tests are run in build-test workflow on pull_request event. e2e_test.go uses Ginkgo to build a test suite from inventory.go and runs each test using testim/client.go or playwright/playwright.go -Tests are parallelized using Gingko's test focus. Each workflow definition in .github/workflows/build-test.yaml must define a `test-focus` parameter that matches the `Test Name` property defined in inventory.go. Each e2e test workflow skips all tests but what is defined in `test-focus`. Please colocate new playwright tests under the playwright comment with the other pw tests. +Tests are parallelized using Gingko's test focus. Each workflow definition in .github/workflows/build-test.yaml must define a `test-focus` parameter that matches the `Test Name` property defined in inventory.go. Each e2e test workflow skips all tests but what is defined in `test-focus`. Please colocate new Playwright tests under the Playwright comment with the other pw tests. -New tests should be written with playwright. +New tests should be written with Playwright. -## Playwright +## Adding a new test Playwright is the preferred testing framework for new tests moving forward. See playwright's [documentation](https://playwright.dev/docs/intro) for more information. -### Development environment - -To install dependencies run: +Install Playwright dependencies: ```bash cd e2e/playwright @@ -22,14 +20,12 @@ npm ci npx playwright install --with-deps ``` -Install the playwright extension in vscode if you've not already done so: +Install the Playwright extension in VSCode if you've not already done so: ```bash code --install-extension ms-playwright.playwright ``` -### Adding a new test - To add a new test that you've already added in the [kots-tests-app repo](https://github.com/replicatedhq/kots-test-apps) - do the following: - Update `.github/workflows/build-test.yaml` to include the new test. You can copy an existing pw entry like `validate-change-channel` and update the test-focus, kots-namespace, and any other parameters needed for the test. @@ -64,21 +60,9 @@ e2e/playwright/tests/change-channel - See `e2e/playwright/tests/shared` for test utility functions that can be used in your test for things like logging in or uploading a license. -## testim - -Testim is our legacy testing framework. It is being phased out in favor of playwright. - -### Development environment - -To install dependencies run: +## Running tests -```bash -make kots -make -C e2e deps -npm install -g @testim/testim-cli -``` - -Set the testim access token: +For testIM tests, set the testim access token: ```bash export TESTIM_ACCESS_TOKEN= ``` @@ -96,7 +80,7 @@ make e2e \ FOCUS="Change License" ``` -To build and run with ttl.sh images run: +To build and run with ttl.sh images: ```bash make all-ttl.sh @@ -106,7 +90,7 @@ make e2e \ KOTSADM_IMAGE_TAG=24h ``` -To run using a specific testim branch: +To run using a specific testIM branch: ```bash make e2e \ TESTIM_BRANCH=$BRANCH_NAME @@ -140,9 +124,3 @@ $ export KUBECONFIG="$(k3d kubeconfig merge kots-e2e3629427925)" $ kubectl -n smoke-test port-forward svc/kotsadm 3000 --address=0.0.0.0 Forwarding from 0.0.0.0:3000 -> 3000 ``` - -#### Requirements - -*Currently, the admin console helm chart will not install on an M1 Macbook because of it's [node affinity](https://github.com/replicatedhq/kots-helm/blob/main/templates/kotsadm-deployment.yaml#L32-L35) rules* - -1. [Docker](https://docs.docker.com/get-docker/) diff --git a/e2e/inventory/inventory.go b/e2e/inventory/inventory.go index cb8d20f1fb..edec8db198 100644 --- a/e2e/inventory/inventory.go +++ b/e2e/inventory/inventory.go @@ -114,10 +114,11 @@ func NewMultiAppBackupAndRestoreTest() Test { func MultiAppTest() Test { return Test{ - Name: "multi-app-install", - TestimSuite: "multi-app-install", + ID: "multi-app-install", + Name: "Multi App Install", Namespace: "multi-app-install", - UpstreamURI: "multi-app-install/automated", + AppSlug: "mutli-app-install", + UpstreamURI: "mutli-app-install/automated", } } diff --git a/e2e/playwright/tests/multi-app-install/app1-license.yaml b/e2e/playwright/tests/multi-app-install/app1-license.yaml new file mode 100644 index 0000000000..d7b61411eb --- /dev/null +++ b/e2e/playwright/tests/multi-app-install/app1-license.yaml @@ -0,0 +1,23 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + name: github-action +spec: + appSlug: mutli-app-install + channelID: 2GdNmeofxTIcwIhXo1bIyS3Pvu3 + channelName: Automated + customerName: github-action + endpoint: https://replicated.app + entitlements: + expires_at: + description: License Expiration + title: Expiration + value: "" + valueType: String + isGitOpsSupported: true + isNewKotsUiEnabled: true + isSnapshotSupported: true + licenseID: 2GdOGMwrfz2KpRi2fzaIKPDHHbj + licenseSequence: 3 + licenseType: dev + signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXVJam9pYTI5MGN5NXBieTkyTVdKbGRHRXhJaXdpYTJsdVpDSTZJa3hwWTJWdWMyVWlMQ0p0WlhSaFpHRjBZU0k2ZXlKdVlXMWxJam9pWjJsMGFIVmlMV0ZqZEdsdmJpSjlMQ0p6Y0dWaklqcDdJbXhwWTJWdWMyVkpSQ0k2SWpKSFpFOUhUWGR5Wm5veVMzQlNhVEptZW1GSlMxQkVTRWhpYWlJc0lteHBZMlZ1YzJWVWVYQmxJam9pWkdWMklpd2lZM1Z6ZEc5dFpYSk9ZVzFsSWpvaVoybDBhSFZpTFdGamRHbHZiaUlzSW1Gd2NGTnNkV2NpT2lKdGRYUnNhUzFoY0hBdGFXNXpkR0ZzYkNJc0ltTm9ZVzV1Wld4SlJDSTZJakpIWkU1dFpXOW1lRlJKWTNkSmFGaHZNV0pKZVZNelVIWjFNeUlzSW1Ob1lXNXVaV3hPWVcxbElqb2lRWFYwYjIxaGRHVmtJaXdpYkdsalpXNXpaVk5sY1hWbGJtTmxJam96TENKbGJtUndiMmx1ZENJNkltaDBkSEJ6T2k4dmNtVndiR2xqWVhSbFpDNWhjSEFpTENKbGJuUnBkR3hsYldWdWRITWlPbnNpWlhod2FYSmxjMTloZENJNmV5SjBhWFJzWlNJNklrVjRjR2x5WVhScGIyNGlMQ0prW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IzWmxXRlpLV2tWd2RrMVhWa2RhTVd4NVVUQk9kbE42UW5OVldHaHNaREI0UkZsc1drZFNNVnBQVkdwR1NWWlhkM2xSV0c4eVpETnNiRnA2YkZWalV6a3pWR3RXYUZveVVtRk5Sa3BFVVcxR2RsZEZUbEpaVlhNelpXNVNhR05FUm01aWVtaFRWV3hPUkZKcmFFTlpNRVpWVWxkc1NXVnRjRVJVTUhjMVYwVm9WRk51Wkc5UmJXaHRZek5LWVU1c1VuSlVhbEo1VVZoamVWWlZNWE5UUkZac1YwWndjVTVWYjNKVmJFSjNZVEp3VTFZeFpHMVVNRGx4WXpKd1NsSnJPWHBXTVU1V1pXNVNhMUpyVGs1YVZrcExVMnhrUW1SdFVteFZXRTUyWkZkT1Qwd3haRzVMZWtwd1RVUkdNMUV3YkhOU2JGWjRaREJuTUU5RVNYaFVXRTVQVkVVMGVsVlliekZrUmtwMldUTk9kR0pZUWxWU2JUVnlaRmRGTW1RelFsaGFWRkkyWWpCMFZXSldXbGhqYlRGelYwUkdlbEpYWXpsUVUwbHpTVzFrYzJJeVNtaGlSWFJzWlZWc2EwbHFiMmxaYlZKc1dsUlZNazVVV1hkWk1scHBUa1JPYWs5WFNYbFBSMHB0VDFSb2JGbFhUbWhhYlVVeVRrUlphV1pSUFQwaWZRPT0ifQ== diff --git a/e2e/playwright/tests/multi-app-install/app2-license.yaml b/e2e/playwright/tests/multi-app-install/app2-license.yaml new file mode 100644 index 0000000000..b05e540fcb --- /dev/null +++ b/e2e/playwright/tests/multi-app-install/app2-license.yaml @@ -0,0 +1,23 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + name: github-action +spec: + appSlug: multi-app-install-2 + channelID: 2GdO8R0L2IMuFHquevTI1c3Q9td + channelName: Automated + customerName: github-action + endpoint: https://replicated.app + entitlements: + expires_at: + description: License Expiration + title: Expiration + value: "" + valueType: String + isGitOpsSupported: true + isNewKotsUiEnabled: true + isSnapshotSupported: true + licenseID: 2GdODKSmUfw3FhCV4S3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VdOcmNFSmlWM2d4V20xT05WRlVSa0pSVnpsNFYxaFNRbUZIY0hCVFYxWjVZekZhZDJGWVFuTlBSRlkyWTNwT1VXUnJiRk5UTTJ3MFlVZEdSVTlGT0ROU01FcFVZVEJPY0VzeU1XRldXRVUxWlc1V1lWTXpaSHBYU0hCNVVWUnNOVkpzUmtkU1Z6RjBXa1JaTlZwSE9VUlpNVVpMVGtkR01HVnJaRlZrYTJ4UlZYcEdUMVJ1WTNka1NHeENaVWhOZDJWWVl6bFFVMGx6U1cxa2MySXlTbWhpUlhSc1pWVnNhMGxxYjJsWmJWSnNXbFJWTWs1VVdYZFpNbHBwVGtST2FrOVhTWGxQUjBwdFQxUm9iRmxYVG1oYWJVVXlUa1JaYVdaUlBUMGlmUT09In0= diff --git a/e2e/playwright/tests/multi-app-install/test.spec.ts b/e2e/playwright/tests/multi-app-install/test.spec.ts new file mode 100644 index 0000000000..5a83b2c2b4 --- /dev/null +++ b/e2e/playwright/tests/multi-app-install/test.spec.ts @@ -0,0 +1,41 @@ +import { test, expect } from '@playwright/test'; +import { login, uploadLicense } from '../shared'; + +const { execSync } = require("child_process"); + +test('multi app install', async ({ page }) => { + test.slow(); + await login(page); + await uploadLicense(page, expect, "app1-license.yaml"); + await expect(page.locator('#app')).toContainText('Configure Multi App Install 1', { timeout: 15000 }); + await page.getByRole('button', { name: 'Continue' }).click(); + await expect(page.locator('#app')).toContainText('Required Kubernetes Version', { timeout: 15000 }); + await expect(page.locator('#app')).toContainText('Your cluster meets the recommended and required versions of Kubernetes'); + await page.getByRole('button', { name: 'Deploy' }).click(); + await expect(page.locator('#app')).toContainText('Multi App Install 1'); + await expect(page.locator('#app')).toContainText('Ready', { timeout: 30000 }); + await expect(page.locator('#app')).toContainText('Currently deployed version'); + await expect(page.locator('#app')).toContainText('0.1.3'); + const app1Status = execSync(`kubectl kots get apps -n ${process.env.NAMESPACE} | grep mutli-app-install | awk '{print $2}'`).toString().trim(); + expect(app1Status).toBe('ready'); + await page.locator('div').filter({ hasText: /^Change passwordAdd new applicationLog out$/ }).getByRole('img').click(); + await page.getByText('Add new application').click(); + await uploadLicense(page, expect, "app2-license.yaml"); + await expect(page.locator('#app')).toContainText('Configure Multi App Install 2', { timeout: 15000 }); + await page.getByRole('button', { name: 'Continue' }).click(); + await expect(page.locator('#app')).toContainText('Required Kubernetes Version', { timeout: 15000 }); + await expect(page.locator('#app')).toContainText('Your cluster meets the recommended and required versions of Kubernetes'); + await page.getByRole('button', { name: 'Deploy' }).click(); + await expect(page.locator('#app')).toContainText('Multi App Install 2'); + await expect(page.locator('#app')).toContainText('Ready', { timeout: 30000 }); + await expect(page.locator('#app')).toContainText('Currently deployed version'); + await expect(page.locator('#app')).toContainText('2.1.2'); + const app2Status = execSync(`kubectl kots get apps -n ${process.env.NAMESPACE} | grep multi-app-install-2 | awk '{print $2}'`).toString().trim(); + expect(app2Status).toBe('ready'); + await page.getByRole('link', { name: 'Version history' }).click(); + await expect(page.locator('#app')).toContainText('2.1.2', { timeout: 10000 }); + await page.getByRole('link', { name: 'Multi App Install 1' }).click(); + await expect(page.locator('#app')).toContainText('0.1.3', { timeout: 10000 }); + await page.getByRole('link', { name: 'Version history' }).click(); + await expect(page.locator('#app')).toContainText('0.1.3', { timeout: 10000 }); +}); diff --git a/e2e/playwright/tests/shared/upload-license.ts b/e2e/playwright/tests/shared/upload-license.ts index 1ae184f582..7db9cec870 100644 --- a/e2e/playwright/tests/shared/upload-license.ts +++ b/e2e/playwright/tests/shared/upload-license.ts @@ -1,5 +1,5 @@ -export const uploadLicense = async (page, expect) => { - await page.setInputFiles('input[type="file"][accept="application/x-yaml,.yaml,.yml,.rli"]', `${process.env.TEST_PATH}/license.yaml`) +export const uploadLicense = async (page, expect, licenseFile = "license.yaml") => { + await page.setInputFiles('input[type="file"][accept="application/x-yaml,.yaml,.yml,.rli"]', `${process.env.TEST_PATH}/${licenseFile}`); await page.getByRole('button', { name: 'Upload license' }).click(); await expect(page.locator('#app')).toContainText('Installing your license'); }; From 0284bdb3d8ccb52518720ab2b7cf645d1b51b52b Mon Sep 17 00:00:00 2001 From: Salah Aldeen Al Saleh Date: Tue, 24 Sep 2024 13:23:52 -0700 Subject: [PATCH 2/2] update test focus --- .github/workflows/build-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 2e082d0978..14b4605984 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -2895,7 +2895,7 @@ jobs: - run: chmod +x bin/* - uses: ./.github/actions/kots-e2e with: - test-focus: 'multi-app-install' + test-focus: 'Multi App Install' kots-namespace: 'multi-app-install' k8s-distribution: ${{ matrix.cluster.distribution }} k8s-version: ${{ matrix.cluster.version }}