Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added e2e tests prcheck workflow #236

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,79 @@ jobs:
run: yarn format:check

- name: Run unit tests
run: yarn test
run: yarn test

e2e-tests:
name: e2e tests smoke
runs-on: ubuntu-24.04
env:
SKIP_INSTALLATION: true
steps:
- uses: actions/checkout@v4
with:
path: podman-desktop-sandbox-ext

# Install nodejs
- uses: actions/setup-node@v4
with:
node-version: 20

# Checkout podman desktop
- uses: actions/checkout@v4
with:
repository: containers/podman-desktop
ref: main
path: podman-desktop

# Setup pnpm
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
package_json_file: ./podman-desktop/package.json

- name: Build Podman Desktop for E2E tests
working-directory: ./podman-desktop
run: |
pnpm install
pnpm test:e2e:build

- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
run: |
# allow unprivileged user namespace
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

- name: Ensure getting current HEAD version of the test framework
working-directory: ./podman-desktop-sandbox-ext
run: |
# workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712
version=$(npm view @podman-desktop/tests-playwright@next version)
echo "Version of @podman-desktop/tests-playwright to be used: $version"
jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json

- name: Execute yarn in Sandbox extension
working-directory: ./podman-desktop-sandbox-ext
run: yarn install

- name: Build Sandbox extension from container file
working-directory: ./podman-desktop-sandbox-ext
run: |
yarn build
podman build -t local_sandbox_image ./
CONTAINER_ID=$(podman create localhost/local_sandbox_image --entrypoint "")
mkdir -p tests/playwright/output/sandbox-tests-pd/plugins
podman export $CONTAINER_ID | tar -x -C tests/playwright/output/sandbox-tests-pd/plugins/
podman rm -f $CONTAINER_ID
podman rmi -f localhost/local_sandbox_image:latest

- name: Run E2E tests
working-directory: ./podman-desktop-sandbox-ext
env:
PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop
run: yarn test:e2e

- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-tests
path: ./**/tests/**/output/
2 changes: 2 additions & 0 deletions tests/src/developer-sandbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
await extensionCard.disableExtension();
await playExpect(extensionCard.removeButton).toBeEnabled();
await playExpect(extensionCard.status).toHaveText(disabledExtensionStatus);

await checkSandboxInResources(navigationBar, false);
Expand Down Expand Up @@ -148,6 +149,7 @@ async function removeExtension(navBar: NavigationBar): Promise<void> {
const extensions = await navBar.openExtensions();
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
await extensionCard.disableExtension();
await playExpect(extensionCard.removeButton).toBeEnabled();
await extensionCard.removeExtension();
await playExpect
.poll(async () => await extensions.extensionIsInstalled(extensionLabel), { timeout: 15000 })
Expand Down
Loading