Skip to content

Commit

Permalink
Move multi app install test to Playwright (#4920)
Browse files Browse the repository at this point in the history
* Move multi app install test to Playwright
  • Loading branch information
sgalsaleh authored and miaawong committed Sep 25, 2024
1 parent 2c2c26f commit 2469c15
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 42 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2895,12 +2895,10 @@ 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 }}
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 }}'
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 9 additions & 31 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,28 @@ 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
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.
Expand Down Expand Up @@ -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=<my-testim-access-token>
```
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/)
7 changes: 4 additions & 3 deletions e2e/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
}

Expand Down
23 changes: 23 additions & 0 deletions e2e/playwright/tests/multi-app-install/app1-license.yaml
Original file line number Diff line number Diff line change
@@ -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
license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MVVNRGx4WXpKd1NsSnJPWHBXTVU1V1pXNVNhMUpyVGs1YVZrcExVMnhrUW1SdFVteFZXRTUyWkZkT1Qwd3haRzVMZWtwd1RVUkdNMUV3YkhOU2JGWjRaREJuTUU5RVNYaFVXRTVQVkVVMGVsVlliekZrUmtwMldUTk9kR0pZUWxWU2JUVnlaRmRGTW1RelFsaGFWRkkyWWpCMFZXSldXbGhqYlRGelYwUkdlbEpYWXpsUVUwbHpTVzFrYzJJeVNtaGlSWFJzWlZWc2EwbHFiMmxaYlZKc1dsUlZNazVVV1hkWk1scHBUa1JPYWs5WFNYbFBSMHB0VDFSb2JGbFhUbWhhYlVVeVRrUlphV1pSUFQwaWZRPT0ifQ==
23 changes: 23 additions & 0 deletions e2e/playwright/tests/multi-app-install/app2-license.yaml
Original file line number Diff line number Diff line change
@@ -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: 2GdODKSmUfw3FhCV4S3zRj6gCiY
licenseSequence: 2
licenseType: dev
signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXVJam9pYTI5MGN5NXBieTkyTVdKbGRHRXhJaXdpYTJsdVpDSTZJa3hwWTJWdWMyVWlMQ0p0WlhSaFpHRjBZU0k2ZXlKdVlXMWxJam9pWjJsMGFIVmlMV0ZqZEdsdmJpSjlMQ0p6Y0dWaklqcDdJbXhwWTJWdWMyVkpSQ0k2SWpKSFpFOUVTMU50VldaM00wWm9RMVkwVXpONlVtbzJaME5wV1NJc0lteHBZMlZ1YzJWVWVYQmxJam9pWkdWMklpd2lZM1Z6ZEc5dFpYSk9ZVzFsSWpvaVoybDBhSFZpTFdGamRHbH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Ua1JaYVdaUlBUMGlmUT09In0=
41 changes: 41 additions & 0 deletions e2e/playwright/tests/multi-app-install/test.spec.ts
Original file line number Diff line number Diff line change
@@ -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 });
});
4 changes: 2 additions & 2 deletions e2e/playwright/tests/shared/upload-license.ts
Original file line number Diff line number Diff line change
@@ -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');
};

0 comments on commit 2469c15

Please sign in to comment.