Skip to content

Commit 700d0be

Browse files
committed
fix: fix oversights in e2e tests
Signed-off-by: Rostislav Lán <[email protected]>
1 parent afd5a8c commit 700d0be

File tree

4 files changed

+117
-64
lines changed

4 files changed

+117
-64
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
19+
name: build-extension
20+
21+
on:
22+
pull_request:
23+
branches: [ 'main' ]
24+
push:
25+
branches: [ 'main' ]
26+
27+
jobs:
28+
build-extension:
29+
name: Build OCI image
30+
runs-on: ubuntu-22.04
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Set image env var
36+
id: set-image
37+
run: echo "IMAGE=ghcr.io/${{ github.repository_owner }}/podman-desktop-image-checker-openshift-ext:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
38+
39+
- name: Build image with podman
40+
shell: bash
41+
run: |
42+
echo "Building image ${IMAGE} with podman"
43+
podman build -t "${IMAGE}" -f Containerfile .
44+
podman save -m -o podman-desktop-image-checker-openshift-ext.tar "${IMAGE}"
45+
echo "${IMAGE}" > podman-desktop-image-checker-openshift-ext.image
46+
47+
- name: Upload extension oci flatten images
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: podman-desktop-image-checker-openshift-ext
51+
path: podman-desktop-image-checker-openshift-ext*

.github/workflows/build-next.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
name: CI
1919

2020
on:
21-
#push:
22-
#branches: [ 'main' ]
21+
push:
22+
branches: [ 'main' ]
2323

2424
jobs:
2525
build:

.github/workflows/pr-check.yaml

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,33 @@
1818
name: pr-check
1919

2020
on:
21-
#pull_request:
22-
#branches: [ 'main' ]
23-
push:
24-
branches: [ 'main' ]
21+
workflow_run:
22+
workflows:
23+
- build-extension
24+
types:
25+
- completed
2526

2627
jobs:
27-
build-extension:
28-
name: Build OCI image
29-
runs-on: ubuntu-22.04
30-
steps:
31-
- name: Checkout repository
32-
uses: actions/checkout@v4
33-
34-
- name: Set image env var
35-
run: |
36-
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest" >> $GITHUB_ENV
37-
38-
- name: Set up Podman
39-
run: |
40-
sudo apt-get update -y -qq
41-
sudo mkdir -p /etc/apt/keyrings
42-
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \
43-
| gpg --dearmor \
44-
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
45-
echo \
46-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
47-
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
48-
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
49-
sudo apt-get update -qq
50-
sudo apt-get -qq -y install containernetworking-plugins podman
51-
52-
- name: Build image with podman
53-
shell: bash
54-
run: |
55-
podman build -t ${IMAGE} -f Containerfile .
56-
podman save -m -o podman-desktop-image-checker-openshift-ext.tar ${IMAGE}
57-
echo ${IMAGE} > podman-desktop-image-checker-openshift-ext.image
58-
59-
- name: Upload extension oci flatten images
60-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
61-
with:
62-
name: podman-desktop-image-checker-openshift-ext
63-
path: podman-desktop-image-checker-openshift-ext*
64-
6528
push-extension:
6629
name: Push OCI image to ghcr
67-
if: github.event_name == 'push'
6830
runs-on: ubuntu-22.04
69-
needs: build-extension
70-
permissions:
71-
contents: read
72-
packages: write
31+
if: |
32+
github.event.workflow_run.conclusion == 'success'
7333
steps:
7434
- name: Download extension oci flatten images
75-
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
35+
uses: actions/download-artifact@v4
7636
with:
7737
name: podman-desktop-image-checker-openshift-ext
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
run-id: ${{ github.event.workflow_run.id }}
40+
41+
- name: Read image name
42+
id: read-image
43+
run: |
44+
echo "IMAGE=$(cat podman-desktop-image-checker-openshift-ext.image)" >> "$GITHUB_ENV"
7845
7946
- name: Log in to ghcr.io
80-
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
47+
uses: redhat-actions/[email protected]
8148
with:
8249
registry: ghcr.io
8350
username: ${{ github.actor }}
@@ -87,16 +54,12 @@ jobs:
8754
shell: bash
8855
run: |
8956
podman load -i podman-desktop-image-checker-openshift-ext.tar
90-
podman push ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest
57+
podman push "$IMAGE"
9158
9259
e2e-tests:
9360
name: Run E2E Tests
9461
runs-on: ubuntu-22.04
9562
needs: push-extension
96-
permissions:
97-
contents: read
98-
packages: read
99-
actions: write
10063
steps:
10164
- name: Checkout the image checker repo
10265
uses: actions/checkout@v4
@@ -138,3 +101,39 @@ jobs:
138101
EXTENSION_PREINSTALLED: true
139102
run: |
140103
yarn test:e2e
104+
105+
- name: Publish Test Report
106+
uses: mikepenz/action-junit-report@v5
107+
if: always()
108+
with:
109+
annotate_only: true
110+
fail_on_failure: true
111+
include_passed: true
112+
detailed_summary: true
113+
require_tests: true
114+
report_paths: '**/*results.xml'
115+
116+
- uses: actions/upload-artifact@v4
117+
if: always()
118+
with:
119+
name: pr-check
120+
path: |
121+
./**/tests/**/output/
122+
!./**/*.gguf
123+
!./**/*.bin
124+
!./**/tests/**/videos/*
125+
!./**/tests/**/traces/*
126+
127+
- name: Upload test videos
128+
uses: actions/upload-artifact@v4
129+
if: always()
130+
with:
131+
name: pr-check-videos
132+
path: ./**/tests/playwright/output/videos/*
133+
134+
- name: Upload test traces
135+
uses: actions/upload-artifact@v4
136+
if: always()
137+
with:
138+
name: pr-check-traces
139+
path: ./**/tests/playwright/output/traces/*

podman-desktop-extension/tests/src/image-checker.spec.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const extensionLabel = 'redhat.openshift-checker';
3434
const extensionLabelName = 'openshift-checker';
3535
const activeExtensionStatus = 'ACTIVE';
3636
const disabledExtensionStatus = 'DISABLED';
37-
const imageToCheck = 'docker.io/library/httpd';
37+
const imageToCheck = 'ghcr.io/linuxcontainers/alpine';
3838
const isLinux = process.platform === 'linux';
3939
const providerName = 'Red Hat OpenShift Checker';
4040
const extensionName = 'Red Hat OpenShift Checker extension';
@@ -51,7 +51,9 @@ test.beforeAll(async ({ runner, page, welcomePage }) => {
5151
test.afterAll(async ({ runner, page }) => {
5252
test.setTimeout(60000);
5353
try {
54-
deleteImage(page, imageToCheck);
54+
//deleteImage(page, imageToCheck);
55+
// TODO: testing image should be removed after the tests
56+
// for some reason this fails
5557
} finally {
5658
await runner.close();
5759
}
@@ -67,7 +69,7 @@ test.describe.serial('Red Hat Image Checker extension installation', () => {
6769

6870
test('Remove old version of the extension', async ({ navigationBar }) => {
6971
test.skip(!extensionInstalled);
70-
await removeExtension(navigationBar);
72+
await disableAndRemoveExtension(navigationBar);
7173
});
7274

7375
test('Extension can be installed from an OCI image', async ({ navigationBar }) => {
@@ -111,7 +113,7 @@ test.describe.serial('Red Hat Image Checker extension functionality', () => {
111113

112114
const pullImagePage = await imagesPage.openPullImage();
113115
await playExpect(pullImagePage.heading).toBeVisible();
114-
imagesPage = await pullImagePage.pullImage(imageToCheck);
116+
await pullImagePage.pullImage(imageToCheck);
115117
const imageDetailsPage = await getImageDetailsPage(navigationBar);
116118
await playExpect(imageDetailsPage.imageCheckerTab).toBeVisible();
117119

@@ -145,7 +147,7 @@ test.describe.serial('Red Hat Image Checker extension functionality', () => {
145147
await playExpect(imageDetailsPage.imageCheckerTabContent).toBeVisible();
146148

147149
// wait for the analysis to be complete
148-
const analysisStatus = await imageDetailsPage.getAnalysisStatus();
150+
const analysisStatus = imageDetailsPage.analysisStatus;
149151
await playExpect(analysisStatus).toBeVisible();
150152
await playExpect
151153
.poll(async () => await analysisStatus.innerText(), { timeout: 60000 })
@@ -202,14 +204,15 @@ test.describe.serial('Red Hat Image Checker extension handling', () => {
202204
});
203205

204206
test('Extension can be removed', async ({ navigationBar }) => {
205-
await removeExtension(navigationBar);
207+
await disableAndRemoveExtension(navigationBar);
206208
});
207209
});
208210

209-
async function removeExtension(navigationBar: NavigationBar): Promise<void> {
211+
async function disableAndRemoveExtension(navigationBar: NavigationBar): Promise<void> {
210212
const extensions = await navigationBar.openExtensions();
211213
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
212-
await extensionCard.disableExtension();
214+
playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
215+
await playExpect(extensionCard.removeButton).toBeVisible();
213216
await extensionCard.removeExtension();
214217
await playExpect
215218
.poll(async () => await extensions.extensionIsInstalled(extensionLabel), { timeout: 15000 })

0 commit comments

Comments
 (0)