Skip to content

Commit cfa5dfc

Browse files
authored
Add E2E tests to the PR check workflow + Fix skip condition on test case
* Update pr-check.yaml Adds executing the E2E tests during the PR check, solves #315 * Update pr-check.yaml Fixed the e2e-tests section * Update pr-check.yaml Add 'Build OpenShift Local extension from container file' step * chore(test): fix skip condition on test case Signed-off-by: Daniel Villanueva <[email protected]> * Update pr-check.yaml Remove redundant skip installation env variable * Update pr-check.yaml Added 'actions/upload-artifact@v4' --------- Signed-off-by: Daniel Villanueva <[email protected]>
1 parent a6b43d6 commit cfa5dfc

File tree

2 files changed

+82
-3
lines changed

2 files changed

+82
-3
lines changed

.github/workflows/pr-check.yaml

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2022 Red Hat, Inc.
2+
# Copyright (C) 2022-2024 Red Hat, Inc.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -117,4 +117,83 @@ jobs:
117117
run: yarn format:check
118118

119119
- name: Run Tests
120-
run: yarn test
120+
run: yarn test
121+
122+
e2e-tests:
123+
name: e2e tests
124+
runs-on: ubuntu-24.04 #20.04?
125+
env:
126+
SKIP_INSTALLATION: true
127+
steps:
128+
- uses: actions/checkout@v4
129+
with:
130+
path: crc-extension
131+
132+
# Checkout podman desktop
133+
- uses: actions/checkout@v4
134+
with:
135+
repository: containers/podman-desktop
136+
ref: main
137+
path: podman-desktop
138+
139+
- uses: actions/setup-node@v4
140+
with:
141+
node-version: 20
142+
143+
- uses: pnpm/action-setup@v4
144+
name: Install pnpm
145+
with:
146+
run_install: false
147+
package_json_file: ./podman-desktop/package.json
148+
149+
- name: Execute pnpm
150+
working-directory: ./podman-desktop
151+
run: pnpm install
152+
153+
- name: Build Podman Desktop for E2E tests
154+
working-directory: ./podman-desktop
155+
run: pnpm test:e2e:build
156+
157+
- name: Ensure getting current HEAD version of the test framework
158+
working-directory: ./crc-extension
159+
run: |
160+
# workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712
161+
version=$(npm view @podman-desktop/tests-playwright@next version)
162+
echo "Version of @podman-desktop/tests-playwright to be used: $version"
163+
jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json
164+
165+
- name: Execute yarn in OpenShift Local Extension
166+
working-directory: ./crc-extension
167+
run: yarn
168+
169+
- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
170+
run: |
171+
# allow unprivileged user namespace
172+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
173+
174+
- name: Build OpenShift Local extension from container file
175+
working-directory: ./crc-extension
176+
run: |
177+
podman build -t openshift_local_image . -f ./oci/Containerfile.multistage
178+
CONTAINER_ID_CRC=$(podman create localhost/openshift_local_image --entrypoint "")
179+
podman export $CONTAINER_ID_CRC > /tmp/openshift_local_extension.tar
180+
mkdir -p tests/playwright/output/crc-tests-pd/plugins
181+
podman pull ghcr.io/redhat-developer/podman-desktop-redhat-account-ext:latest
182+
CONTAINER_ID_SSO=$(podman create ghcr.io/redhat-developer/podman-desktop-redhat-account-ext --entrypoint "")
183+
podman export $CONTAINER_ID_SSO > /tmp/sso_extension.tar
184+
tar -xf /tmp/openshift_local_extension.tar -C tests/playwright/output/crc-tests-pd/plugins/
185+
mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/crcextension
186+
tar -xf /tmp/sso_extension.tar -C tests/playwright/output/crc-tests-pd/plugins/
187+
mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/ssoextension
188+
189+
- name: Run All E2E tests
190+
working-directory: ./crc-extension
191+
env:
192+
PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop
193+
run: yarn test:e2e
194+
195+
- uses: actions/upload-artifact@v4
196+
if: always()
197+
with:
198+
name: e2e-tests
199+
path: ./**/tests/**/output/

tests/src/openshift-local-extension.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
6565
// we want to install extension from OCI image (usually using latest tag) after new code was added to the codebase
6666
// and extension was published already
6767
test('Extension can be installed using OCI image', async ({ navigationBar }) => {
68-
test.skip(extensionInstalled && !skipInstallation);
68+
test.skip(!!skipInstallation);
6969
test.setTimeout(200000);
7070
const extensions = await navigationBar.openExtensions();
7171
await extensions.installExtensionFromOCIImage(imageName);

0 commit comments

Comments
 (0)