From 75ed4862b444b00d0cf00b956c1e5452a7f4397f Mon Sep 17 00:00:00 2001 From: Daniel Villanueva Date: Tue, 18 Feb 2025 11:12:07 +0100 Subject: [PATCH] test(e2e): move test case to azure runner Signed-off-by: Daniel Villanueva --- .github/workflows/e2e-windows.yaml | 266 ++++++++++++++++++++ package.json | 6 +- tests/src/crc-cluster-deployment.spec.ts | 150 +++++++++++ tests/src/openshift-local-extension.spec.ts | 119 +-------- 4 files changed, 425 insertions(+), 116 deletions(-) create mode 100644 .github/workflows/e2e-windows.yaml create mode 100644 tests/src/crc-cluster-deployment.spec.ts diff --git a/.github/workflows/e2e-windows.yaml b/.github/workflows/e2e-windows.yaml new file mode 100644 index 0000000..158dd83 --- /dev/null +++ b/.github/workflows/e2e-windows.yaml @@ -0,0 +1,266 @@ +# +# Copyright (C) 2025 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: e2e-main-windows + +on: + push: + branches: + - main + + workflow_dispatch: + inputs: + fork: + default: 'podman-desktop' + description: 'Podman Desktop repo fork' + type: string + required: true + branch: + default: 'main' + description: 'Podman Desktop repo branch' + type: string + required: true + ext_repo_options: + default: 'REPO=crc-extension,FORK=crc-org,BRANCH=main' + description: 'Podman Desktop Extension repo, fork and branch' + type: string + required: true + ext_tests: + default: '1' + description: 'Run E2E tests from extension' + type: string + required: true + npm_target: + default: 'test:e2e:cluster-deployment' + description: 'npm target to run tests' + type: string + required: true + podman_remote_url: + default: 'https://github.com/containers/podman/releases/download/v5.3.2/podman-remote-release-windows_amd64.zip' + description: 'podman remote zip' + type: string + required: true + podman_version: + default: '5.3.2' + description: 'Podman folder version in archive' + type: 'string' + required: true + podman_options: + default: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0' + description: 'Podman machine configuration options, no spaces' + type: 'string' + required: true + env_vars: + default: 'TEST_PODMAN_MACHINE=false' + description: 'Env. Variables passed into target machine, ie: VAR1=xxx,VAR2=true,VAR3=15,VAR4="Pass me along"' + type: 'string' + required: true + host_params: + default: 'CPUS="8",MEMORY="16"' + description: Number of CPUs and GBs of memory, no spaces + type: 'string' + required: true + +jobs: + windows: + name: windows-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }} + runs-on: ubuntu-latest + env: + MAPT_VERSION: v0.7.3 + MAPT_IMAGE: quay.io/redhat-developer/mapt + strategy: + fail-fast: false + matrix: + windows-version: ['10','11'] + windows-featurepack: ['22h2-ent', '24h2-ent'] + exclude: + - windows-version: '10' + windows-featurepack: '24h2-ent' + - windows-version: '11' + windows-featurepack: '22h2-ent' + + + steps: + - name: Get Podman version used by Podman Desktop + run: | + version=$(curl https://raw.githubusercontent.com/podman-desktop/podman-desktop/main/extensions/podman/packages/extension/src/podman5.json | jq -r '.version') + echo "Default Podman Version from Podman Desktop: ${version}" + echo "PD_PODMAN_VERSION=${version}" >> $GITHUB_ENV + - name: Set the default env. variables + env: + DEFAULT_FORK: 'podman-desktop' + DEFAULT_BRANCH: 'main' + DEFAULT_EXT_TESTS: '1' + DEFAULT_NPM_TARGET: 'test:e2e:cluster-deployment' + DEFAULT_ENV_VARS: 'TEST_PODMAN_MACHINE=false' + DEFAULT_PODMAN_OPTIONS: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0' + DEFAULT_EXT_REPO_OPTIONS: 'REPO=crc-extension,FORK=crc-org,BRANCH=main' + DEFAULT_VERSION: "${{ env.PD_PODMAN_VERSION || '5.3.2' }}" + DEFAULT_URL: "https://github.com/containers/podman/releases/download/v$DEFAULT_VERSION/podman-remote-release-windows_amd64.zip" + DEFAULT_HOST_PARAMS: 'CPUS="8",MEMORY="16"' + run: | + echo "FORK=${{ github.event.inputs.fork || env.DEFAULT_FORK }}" >> $GITHUB_ENV + echo "BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV + echo "NPM_TARGET=${{ github.event.inputs.npm_target || env.DEFAULT_NPM_TARGET }}" >> $GITHUB_ENV + echo "ENV_VARS=${{ github.event.inputs.env_vars || env.DEFAULT_ENV_VARS }}" >> $GITHUB_ENV + echo "PODMAN_VERSION=${{ github.event.inputs.podman_version || env.DEFAULT_VERSION }}" >> $GITHUB_ENV + echo "PODMAN_URL=${{ github.event.inputs.podman_remote_url || env.DEFAULT_URL }}" >> $GITHUB_ENV + echo "EXT_TESTS=${{ github.event.inputs.ext_tests || env.DEFAULT_EXT_TESTS }}" >> $GITHUB_ENV + echo "${{ github.event.inputs.host_params || env.DEFAULT_HOST_PARAMS }}" | awk -F ',' \ + '{for (i=1; i<=NF; i++) {split($i, kv, "="); print "HOST_PARAMS_"kv[1]"="kv[2]}}' >> $GITHUB_ENV + echo "${{ github.event.inputs.podman_options || env.DEFAULT_PODMAN_OPTIONS }}" | awk -F ',' \ + '{for (i=1; i<=NF; i++) {split($i, kv, "="); print "PODMAN_"kv[1]"="kv[2]}}' >> $GITHUB_ENV + echo "${{ github.event.inputs.ext_repo_options || env.DEFAULT_EXT_REPO_OPTIONS }}" | awk -F ',' \ + '{for (i=1; i<=NF; i++) {split($i, kv, "="); print "EXT_"kv[1]"="kv[2]}}' >> $GITHUB_ENV + + - name: Create instance + run: | + # Create instance + podman run -d --name windows-create --rm \ + -v ${PWD}:/workspace:z \ + -e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \ + -e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \ + -e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \ + -e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \ + ${{ env.MAPT_IMAGE }}:${{ env.MAPT_VERSION }} azure \ + windows create \ + --project-name 'windows-desktop' \ + --backed-url 'file:///workspace' \ + --conn-details-output '/workspace' \ + --windows-version '${{ matrix.windows-version }}' \ + --windows-featurepack '${{ matrix.windows-featurepack }}' \ + --nested-virt \ + --cpus '${{ env.HOST_PARAMS_CPUS }}' \ + --memory '${{ env.HOST_PARAMS_MEMORY }}' \ + --tags project=podman-desktop,source=github,org=${{github.repository_owner}},run=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \ + --spot + # Check logs + podman logs -f windows-create + + - name: Check instance system info + run: | + ssh -i id_rsa \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + -o ServerAliveInterval=30 \ + -o ServerAliveCountMax=1200 \ + $(cat username)@$(cat host) "systeminfo" + + - name: Emulate X session + run: | + # use fake rdp to emulate an active x session + podman run -d --name x-session \ + -e RDP_HOST=$(cat host) \ + -e RDP_USER=$(cat username) \ + -e RDP_PASSWORD=$(cat userpassword) \ + quay.io/rhqp/frdp:v0.0.1 + # Wait until the x session has been created + podman wait --condition running x-session + # Check logs for the x session + podman logs x-session + + - name: Download Podman, do not initialize + run: | + podman run --rm -d --name pde2e-podman-run \ + -e TARGET_HOST=$(cat host) \ + -e TARGET_HOST_USERNAME=$(cat username) \ + -e TARGET_HOST_KEY_PATH=/data/id_rsa \ + -e TARGET_FOLDER=pd-e2e \ + -e TARGET_RESULTS=results \ + -e OUTPUT_FOLDER=/data \ + -e DEBUG=true \ + -v $PWD:/data:z \ + quay.io/odockal/pde2e-podman:v0.0.1-windows \ + pd-e2e/podman.ps1 \ + -downloadUrl ${{ env.PODMAN_URL }} \ + -version ${{ env.PODMAN_VERSION }} \ + -targetFolder pd-e2e \ + -resultsFolder results \ + -initialize 0 \ + -rootful 0 \ + -start 0 \ + -installWSL 0 + # check logs + podman logs -f pde2e-podman-run + + - name: Run OpenShift Local Extension Playwright E2E tests + run: | + podman run -d --name pde2e-runner-run \ + -e TARGET_HOST=$(cat host) \ + -e TARGET_HOST_USERNAME=$(cat username) \ + -e TARGET_HOST_KEY_PATH=/data/id_rsa \ + -e TARGET_FOLDER=pd-e2e \ + -e TARGET_RESULTS=results \ + -e OUTPUT_FOLDER=/data \ + -e DEBUG=true \ + -v $PWD:/data:z \ + quay.io/odockal/pde2e-runner:v0.0.1-windows \ + pd-e2e/runner.ps1 \ + -targetFolder pd-e2e \ + -resultsFolder results \ + -podmanPath $(cat results/podman-location.log) \ + -fork ${{ env.FORK }} \ + -branch ${{ env.BRANCH }} \ + -extRepo ${{ env.EXT_REPO }} \ + -extFork ${{ env.EXT_FORK }} \ + -extBranch ${{ env.EXT_BRANCH }} \ + -extTests ${{ env.EXT_TESTS }} \ + -npmTarget ${{ env.NPM_TARGET }} \ + -initialize 1 \ + -rootful 1 \ + -start 1 \ + -userNetworking ${{ env.PODMAN_NETWORKING }} \ + -envVars ${{ env.ENV_VARS }} \ + # check logs + podman logs -f pde2e-runner-run + + - name: Destroy instance + if: always() + run: | + # Destroy instance + podman run -d --name windows-destroy --rm \ + -v ${PWD}:/workspace:z \ + -e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \ + -e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \ + -e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \ + -e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \ + ${{ env.MAPT_IMAGE }}:${{ env.MAPT_VERSION }} azure \ + windows destroy \ + --project-name 'windows-desktop' \ + --backed-url 'file:///workspace' + # Check logs + podman logs -f windows-destroy + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v5 + if: always() # always run even if the previous step fails + with: + fail_on_failure: true + include_passed: true + detailed_summary: true + require_tests: true + annotate_only: true + report_paths: '**/*results.xml' + + - name: Upload test artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: results-e2e-${{ matrix.windows-version }}${{ matrix.windows-featurepack }} + path: | + results/* + \ No newline at end of file diff --git a/package.json b/package.json index 95f9705..45880f5 100644 --- a/package.json +++ b/package.json @@ -140,14 +140,16 @@ "desk:run": "ts-node-esm ./scripts/run.mts run", "test": "vitest run --coverage --passWithNoTests", "test:e2e:setup": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' --", - "test:e2e": "npm run test:e2e:setup npx playwright test tests/src" + "test:e2e": "npm run test:e2e:setup npx playwright test tests/src --grep-invert @cluster-deployment", + "test:e2e:cluster-deployment": "npm run test:e2e:build && npm run test:e2e:cluster-deployment:run", + "test:e2e:cluster-deployment:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/src -g @cluster-deployment" }, "dependencies": { "@redhat-developer/rhaccm-client": "^0.0.1" }, "devDependencies": { - "@podman-desktop/api": "1.14.1", "@playwright/test": "^1.49.1", + "@podman-desktop/api": "1.14.1", "@podman-desktop/tests-playwright": "next", "@types/node": "^20.17.14", "@typescript-eslint/eslint-plugin": "^5.55.0", diff --git a/tests/src/crc-cluster-deployment.spec.ts b/tests/src/crc-cluster-deployment.spec.ts new file mode 100644 index 0000000..54367f5 --- /dev/null +++ b/tests/src/crc-cluster-deployment.spec.ts @@ -0,0 +1,150 @@ +/********************************************************************** + * Copyright (C) 2025 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ***********************************************************************/ + +import type { ContainerInteractiveParams } from '@podman-desktop/tests-playwright'; +import { expect as playExpect, RunnerOptions, test, ContainerState, ContainerDetailsPage, deleteContainer, deleteImage, deletePod, isWindows } from '@podman-desktop/tests-playwright'; + +const kubernetesContext = 'microshift'; +const imageName1 = 'quay.io/sclorg/httpd-24-micro-c9s'; +const imageName2 = 'ghcr.io/linuxcontainers/alpine'; +const containerName1 = 'container-to-deploy-1'; +const containerName2 = 'container-to-deploy-2'; +const deployedPodName1 = 'container-1-pod'; +const deployedPodName2 = 'container-2-pod'; +const containerStartParams: ContainerInteractiveParams = { + attachTerminal: false, +}; + +test.use({ + runnerOptions: new RunnerOptions({ customFolder: 'crc-tests-pd', autoUpdate: false, autoCheckUpdates: false }), +}); +test.beforeAll(async ({ runner, welcomePage }) => { + runner.setVideoAndTraceName('crc-cluster-deployment-e2e'); + await welcomePage.handleWelcomePage(true); +}); + +test.afterAll(async ({ runner, page }) => { + try { + await deletePod(page, deployedPodName1); + await deletePod(page, deployedPodName2); + await deleteContainer(page, containerName1); + await deleteContainer(page, containerName2); + await deleteImage(page, imageName1); + await deleteImage(page, imageName2); + } finally { + await runner.close(); + console.log('Runner closed'); + } +}); + +test.describe.serial('Deployment to OpenShift Local cluster', { tag: ['@cluster-deployment'] }, () => { + + test.describe.serial('Deploy a container to a CRC cluster by pushing the image from Podman Desktop', () => { + test.skip(!isWindows, 'This test should only run on Windows'); + + test('Pull image 1 and start the container', async ({ navigationBar }) => { + const imagesPage = await navigationBar.openImages(); + await playExpect(imagesPage.heading).toBeVisible(); + + const pullImagePage = await imagesPage.openPullImage(); + const updatedImages = await pullImagePage.pullImage(imageName1); + + const exists = await updatedImages.waitForImageExists(imageName1); + playExpect(exists, `${imageName1} image not present in the list of images`).toBeTruthy(); + playExpect(await updatedImages.getCurrentStatusOfImage(imageName1)).toBe('UNUSED'); + + const containersPage = await imagesPage.startContainerWithImage( + imageName1, + containerName1, + containerStartParams, + ); + await playExpect.poll(async () => containersPage.containerExists(containerName1)).toBeTruthy(); + const containerDetails = await containersPage.openContainersDetails(containerName1); + await playExpect(containerDetails.heading).toBeVisible(); + await playExpect.poll(async () => containerDetails.getState()).toBe(ContainerState.Running); + }); + + test.fail('Push the image to the cluster', async ({ navigationBar, statusBar, page }) => { + const imagesPage = await navigationBar.openImages(); + const pulledImage = await imagesPage.getImageRowByName(imageName1); + if (pulledImage === undefined) { + throw Error(`Image: '${name}' does not exist`); + } + const kebabMenuButton = pulledImage.getByRole('button', { name: 'kebab menu' }); + await playExpect(kebabMenuButton).toBeVisible(); + await kebabMenuButton.click(); + //This step will fail => [BUG] option to push the image to OpenShift not shown #372 + const pushToClusterButton = imagesPage.getPage().getByTitle('Drop Down Menu Items').getByTitle('Push image to OpenShift Local cluster'); + await playExpect(pushToClusterButton).toBeVisible(); + //This step will fail => [BUG] Can't push images to OpenShift Local clusters (ssh key name issue) #495 + await pushToClusterButton.click(); + await statusBar.tasksButton.click(); + const tasksManager = page.getByTitle('Tasks manager'); + await playExpect(tasksManager.getByTitle('/^Image ${imageName1} was successfully pushed to the OpenShift Local cluster /')).toBeVisible(); //not the actual message; locally this appears only if the crc cluster is started + }); + + test.skip('Deploy the container to the crc cluster -- previous step expected to fail', async ({ page, navigationBar }) => { + await navigationBar.openContainers(); + const containerDetailsPage = new ContainerDetailsPage(page, containerName1); + await playExpect(containerDetailsPage.heading).toBeVisible(); + const deployToKubernetesPage = await containerDetailsPage.openDeployToKubernetesPage(); + await deployToKubernetesPage.deployPod(deployedPodName1, { useKubernetesServices: true, isOpenShiftCluster: true, useOpenShiftRoutes: true }, kubernetesContext); + + const podsPage = await navigationBar.openPods(); + await playExpect.poll(async () => podsPage.deployedPodExists(deployedPodName1, 'kubernetes')).toBeTruthy(); + }); + + }); + + test.describe.serial('Deploy a container to a CRC cluster by pulling the image directly from the cluster', () => { + test.skip(!isWindows, 'This test should only run on Windows'); + + test('Pull image 2 and start a container', async ({ navigationBar }) => { + const imagesPage = await navigationBar.openImages(); + await playExpect(imagesPage.heading).toBeVisible(); + + const pullImagePage = await imagesPage.openPullImage(); + const updatedImages = await pullImagePage.pullImage(imageName2); + + const exists = await updatedImages.waitForImageExists(imageName2); + playExpect(exists, `${imageName2} image not present in the list of images`).toBeTruthy(); + playExpect(await updatedImages.getCurrentStatusOfImage(imageName2)).toBe('UNUSED'); + + const containersPage = await imagesPage.startContainerWithImage( + imageName2, + containerName2, + containerStartParams, + ); + await playExpect.poll(async () => containersPage.containerExists(containerName2)).toBeTruthy(); + const containerDetails = await containersPage.openContainersDetails(containerName2); + await playExpect(containerDetails.heading).toBeVisible(); + await playExpect.poll(async () => containerDetails.getState()).toBe(ContainerState.Running); + }); + + test('Deploy the container to the crc cluster', async ({ page, navigationBar }) => { + const containerDetailsPage = new ContainerDetailsPage(page, containerName2); + await playExpect(containerDetailsPage.heading).toBeVisible(); + const deployToKubernetesPage = await containerDetailsPage.openDeployToKubernetesPage(); + await deployToKubernetesPage.deployPod(deployedPodName2, { useKubernetesServices: true, isOpenShiftCluster: true, useOpenShiftRoutes: true }, kubernetesContext); + + const podsPage = await navigationBar.openPods(); + await playExpect.poll(async () => podsPage.deployedPodExists(deployedPodName2, 'kubernetes')).toBeTruthy(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/src/openshift-local-extension.spec.ts b/tests/src/openshift-local-extension.spec.ts index 8ecf5d4..e128275 100644 --- a/tests/src/openshift-local-extension.spec.ts +++ b/tests/src/openshift-local-extension.spec.ts @@ -16,8 +16,8 @@ * SPDX-License-Identifier: Apache-2.0 ***********************************************************************/ -import type { ContainerInteractiveParams, NavigationBar } from '@podman-desktop/tests-playwright'; -import { expect as playExpect, ExtensionCardPage, RunnerOptions, test, ResourceConnectionCardPage, PreferencesPage, ContainerState, ContainerDetailsPage, deleteContainer, deleteImage, deletePod } from '@podman-desktop/tests-playwright'; +import type { NavigationBar } from '@podman-desktop/tests-playwright'; +import { expect as playExpect, ExtensionCardPage, RunnerOptions, test, ResourceConnectionCardPage, PreferencesPage } from '@podman-desktop/tests-playwright'; import { OpenShiftLocalExtensionPage } from './model/pages/openshift-local-extension-page'; @@ -35,17 +35,6 @@ const disabledExtensionStatus = 'DISABLED'; const notInstalledExtensionStatus = 'NOT-INSTALLED'; const skipInstallation = process.env.SKIP_INSTALLATION ? process.env.SKIP_INSTALLATION : false; -const kubernetesContext = 'microshift'; -const imageName1 = 'quay.io/sclorg/httpd-24-micro-c9s'; -const imageName2 = 'ghcr.io/linuxcontainers/alpine'; -const containerName1 = 'container-to-deploy-1'; -const containerName2 = 'container-to-deploy-2'; -const deployedPodName1 = 'container-1-pod'; -const deployedPodName2 = 'container-2-pod'; -const containerStartParams: ContainerInteractiveParams = { - attachTerminal: false, -}; - test.use({ runnerOptions: new RunnerOptions({ customFolder: 'crc-tests-pd', autoUpdate: false, autoCheckUpdates: false }), }); @@ -57,18 +46,9 @@ test.beforeAll(async ({ runner, page, welcomePage }) => { preferencesPage = new PreferencesPage(page); }); -test.afterAll(async ({ runner, page }) => { - try { - await deletePod(page, deployedPodName1); - await deletePod(page, deployedPodName2); - await deleteContainer(page, containerName1); - await deleteContainer(page, containerName2); - await deleteImage(page, imageName1); - await deleteImage(page, imageName2); - } finally { - await runner.close(); - console.log('Runner closed'); - } +test.afterAll(async ({ runner }) => { + await runner.close(); + console.log('Runner closed'); }); test.describe.serial('Red Hat OpenShift Local extension verification', () => { @@ -179,95 +159,6 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => { }); }); - test.describe.serial('Deploy a container to a CRC cluster by pushing the image from Podman Desktop', () => { - test('Pull image 1 and start the container', async ({ navigationBar }) => { - const imagesPage = await navigationBar.openImages(); - await playExpect(imagesPage.heading).toBeVisible(); - - const pullImagePage = await imagesPage.openPullImage(); - const updatedImages = await pullImagePage.pullImage(imageName1); - - const exists = await updatedImages.waitForImageExists(imageName1); - playExpect(exists, `${imageName1} image not present in the list of images`).toBeTruthy(); - playExpect(await updatedImages.getCurrentStatusOfImage(imageName1)).toBe('UNUSED'); - - const containersPage = await imagesPage.startContainerWithImage( - imageName1, - containerName1, - containerStartParams, - ); - await playExpect.poll(async () => containersPage.containerExists(containerName1)).toBeTruthy(); - const containerDetails = await containersPage.openContainersDetails(containerName1); - await playExpect(containerDetails.heading).toBeVisible(); - await playExpect.poll(async () => containerDetails.getState()).toBe(ContainerState.Running); - }); - - test.fail('Push the image to the cluster', async ({ navigationBar, statusBar, page }) => { - const imagesPage = await navigationBar.openImages(); - const pulledImage = await imagesPage.getImageRowByName(imageName1); - if (pulledImage === undefined) { - throw Error(`Image: '${name}' does not exist`); - } - const kebabMenuButton = pulledImage.getByRole('button', { name: 'kebab menu' }); - await playExpect(kebabMenuButton).toBeVisible(); - kebabMenuButton.click(); - //This step will fail => [BUG] option to push the image to OpenShift not shown #372 - const pushToClusterButton = imagesPage.getPage().getByTitle('Drop Down Menu Items').getByTitle('Push image to OpenShift Local cluster'); - await playExpect(pushToClusterButton).toBeVisible(); - //This step will fail => [BUG] Can't push images to OpenShift Local clusters (ssh key name issue) #495 - await pushToClusterButton.click(); - statusBar.tasksButton.click(); - const tasksManager = page.getByTitle("Tasks manager") - await playExpect(tasksManager.getByTitle("/^Image ${imageName1} was successfully pushed to the OpenShift Local cluster /")).toBeVisible(); //not the actual message; locally this appears only if the crc cluster is started - }); - - test.skip('Deploy the container to the crc cluster -- previous step expected to fail', async ({ page, navigationBar }) => { - await navigationBar.openContainers(); - const containerDetailsPage = new ContainerDetailsPage(page, containerName1); - await playExpect(containerDetailsPage.heading).toBeVisible(); - const deployToKubernetesPage = await containerDetailsPage.openDeployToKubernetesPage(); - await deployToKubernetesPage.deployPod(deployedPodName1, { useKubernetesServices: true, isOpenShiftCluster: true, useOpenShiftRoutes: true }, kubernetesContext); - - const podsPage = await navigationBar.openPods(); - await playExpect.poll(async () => podsPage.deployedPodExists(deployedPodName1, 'kubernetes')).toBeTruthy(); - }); - - }); - - test.describe.serial('Deploy a container to a CRC cluster by pulling the image directly from the cluster', () => { - test('Pull image 2 and start a container', async ({ navigationBar }) => { - const imagesPage = await navigationBar.openImages(); - await playExpect(imagesPage.heading).toBeVisible(); - - const pullImagePage = await imagesPage.openPullImage(); - const updatedImages = await pullImagePage.pullImage(imageName2); - - const exists = await updatedImages.waitForImageExists(imageName2); - playExpect(exists, `${imageName2} image not present in the list of images`).toBeTruthy(); - playExpect(await updatedImages.getCurrentStatusOfImage(imageName2)).toBe('UNUSED'); - - const containersPage = await imagesPage.startContainerWithImage( - imageName2, - containerName2, - containerStartParams, - ); - await playExpect.poll(async () => containersPage.containerExists(containerName2)).toBeTruthy(); - const containerDetails = await containersPage.openContainersDetails(containerName2); - await playExpect(containerDetails.heading).toBeVisible(); - await playExpect.poll(async () => containerDetails.getState()).toBe(ContainerState.Running); - }); - - test('Deploy the container to the crc cluster', async ({ page, navigationBar }) => { - const containerDetailsPage = new ContainerDetailsPage(page, containerName2); - await playExpect(containerDetailsPage.heading).toBeVisible(); - const deployToKubernetesPage = await containerDetailsPage.openDeployToKubernetesPage(); - await deployToKubernetesPage.deployPod(deployedPodName2, { useKubernetesServices: true, isOpenShiftCluster: true, useOpenShiftRoutes: true }, kubernetesContext); - - const podsPage = await navigationBar.openPods(); - await playExpect.poll(async () => podsPage.deployedPodExists(deployedPodName2, 'kubernetes')).toBeTruthy(); - }); - }); - test('OpenShift Local extension can be removed', async ({ navigationBar }) => { await removeExtension(navigationBar); });