Post release version bump

[skip ci]
This commit is contained in:
schutzbot 2025-03-05 08:31:42 +00:00 committed by Klara Simickova
parent 9fdd6f0b43
commit 6ef29afac3
10 changed files with 398 additions and 3898 deletions

View file

@ -3,7 +3,6 @@ extends: [
"@redhat-cloud-services/eslint-config-redhat-cloud-services",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:testing-library/react",
"plugin:@typescript-eslint/recommended",
"plugin:react-redux/recommended"
]
@ -56,3 +55,8 @@ rules:
# Temporarily disabled
jsx-a11y/no-autofocus: off
rulesdir/forbid-pf-relative-imports: off
overrides:
- files: ["src/tests/**/*.ts"]
extends: "plugin:testing-library/react"
- files: ["playwright/**/*.ts"]
extends: "plugin:playwright/recommended"

6
.gitignore vendored
View file

@ -41,3 +41,9 @@ cockpit/public/main*
pkg/lib
rpmbuild
# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

View file

@ -18,6 +18,7 @@ test:
- cat schutzbot/team_ssh_keys.txt | tee -a ~/.ssh/authorized_keys > /dev/null
script:
- schutzbot/make_rpm_and_install.sh
- schutzbot/playwright_tests.sh
after_script:
- schutzbot/ci_details.sh > /tmp/artifacts/ci-details-after-run.txt || true
- schutzbot/unregister.sh || true

4040
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,7 @@
"@babel/preset-react": "7.26.3",
"@babel/preset-typescript": "7.26.0",
"@patternfly/react-icons": "5.4.2",
"@playwright/test": "1.50.1",
"@redhat-cloud-services/eslint-config-redhat-cloud-services": "2.0.10",
"@redhat-cloud-services/frontend-components-config": "6.3.8",
"@redhat-cloud-services/tsc-transform-imports": "1.0.23",
@ -42,6 +43,7 @@
"@testing-library/jest-dom": "6.6.3",
"@testing-library/react": "16.2.0",
"@testing-library/user-event": "14.6.1",
"@types/node": "22.13.4",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react-redux": "7.1.34",
@ -61,6 +63,7 @@
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest-dom": "5.5.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-playwright": "2.2.0",
"eslint-plugin-react": "7.37.4",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-react-redux": "4.2.0",

24
playwright.config.ts Normal file
View file

@ -0,0 +1,24 @@
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: 'playwright',
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: 'html',
use: {
headless: true,
baseURL: 'http://127.0.0.1:9090',
video: 'retain-on-failure',
trace: 'on-first-retry',
ignoreHTTPSErrors: true,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});

26
playwright/lib/lib.ts Normal file
View file

@ -0,0 +1,26 @@
import { expect, type Page, type FrameLocator } from '@playwright/test';
export const ibFrame = (page: Page): FrameLocator => {
return page.locator('iframe[name="cockpit1\\:localhost\\/cockpit-image-builder"]').contentFrame();
}
export const loginCockpit = async (
page: Page,
username?: string,
password?: string
) => {
if (!username || !password) {
throw new Error('Username or password not found');
}
await page.goto('/cockpit-image-builder');
await page.getByRole('textbox', { name: 'User name' }).fill(username);
await page.getByRole('textbox', { name: 'Password' }).fill(password);
// cockpit-image-builder needs superuser
await page.getByRole('button', { name: 'Log in' }).click();
await page.getByRole('button', { name: 'Limited access' }).click();
await page.getByText('Close').click();
await page.getByRole('button', { name: 'Administrative access' });
};

108
playwright/test.spec.ts Normal file
View file

@ -0,0 +1,108 @@
import { expect, test } from '@playwright/test';
import {
loginCockpit,
ibFrame,
} from './lib/lib';
test.describe('test', () => {
test('create blueprint', async ({ page }) => {
await loginCockpit(page, 'admin', 'foobar');
// await enableComposer(page);
const frame = await ibFrame(page);
// image output
await frame.getByRole('heading', { name: 'Images About image builder' });
await frame.getByRole('heading', { name: 'Blueprints' });
await frame.getByRole('heading', { name: 'No blueprints yet' });
await frame.getByTestId('create-blueprint-action-emptystate').click();
await frame.getByRole('heading', { name: 'Image output' });
await frame.getByTestId('checkbox-guest-image').click();
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'File system configuration' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Additional packages' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Users' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Timezone' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Locale' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Hostname' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Kernel' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Firewall' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Systemd services' });
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('heading', { name: 'Details' });
await frame.getByTestId('blueprint').fill('test-blueprint');
await expect(frame.getByTestId('blueprint')).toHaveValue('test-blueprint');
await frame.getByRole('button', { name: 'Next', exact: true }).click();
await frame.getByRole('button', { name: 'Create blueprint' }).click();
await frame.getByTestId('close-button-saveandbuild-modal').click();
await frame.getByRole('button', { name: 'Create blueprint' }).click();
await frame.getByText('test-blueprint');
});
test('edit blueprint', async ({ page }) => {
// package searching is really slow the first time
test.setTimeout(300000)
await loginCockpit(page, 'admin', 'foobar');
const frame = await ibFrame(page);
await frame.getByText('test-blueprint').click();
await frame.getByRole('button', { name: 'Edit blueprint' }).click();
await frame.getByRole('button', { name: 'Additional packages' }).click();
await frame.getByTestId('packages-search-input').fill('osbuild-composer');
await frame.getByTestId('packages-table').getByText('Searching');
await frame.getByRole('gridcell', { name: 'osbuild-composer' }).first();
await frame.getByRole('checkbox', { name: 'Select row 0' }).check();
await frame.getByRole('button', { name: 'Review and finish' }).click();
await frame.getByRole('button', { name: 'About packages' }).click();
await frame.getByRole('gridcell', { name: 'osbuild-composer' });
await frame.getByRole('button', { name: 'Save changes to blueprint' }).click();
await frame.getByRole('button', { name: 'Edit blueprint' }).click();
await frame.getByRole('button', { name: 'About packages' }).click();
await frame.getByRole('gridcell', { name: 'osbuild-composer' });
await frame.getByRole('button', { name: 'Cancel', exact: true }).click();
await frame.getByRole('heading', { name: 'All images' });
});
test('build blueprint', async ({ page }) => {
// add time enough for depsolving
test.setTimeout(60 * 1000);
await loginCockpit(page, 'admin', 'foobar');
const frame = await ibFrame(page);
await frame.getByText('test-blueprint').click();
await frame.getByTestId('blueprint-build-image-menu-option').click();
// make sure the image is present
await frame.getByTestId('images-table').getByText('Fedora');
});
test('delete blueprint', async ({ page }) => {
await loginCockpit(page, 'admin', 'foobar');
const frame = await ibFrame(page);
await frame.getByText('test-blueprint').click();
await frame.getByTestId('blueprint-action-menu-toggle').click();
await frame.getByRole('menuitem', { name: 'Delete blueprint' }).click();
await frame.getByRole('button', { name: 'Delete' }).click();
});
});

80
schutzbot/playwright_tests.sh Executable file
View file

@ -0,0 +1,80 @@
#!/bin/bash
set -euo pipefail
# As playwright isn't supported on fedora/el, install dependencies
# beforehand.
sudo dnf install -y \
alsa-lib \
libXrandr-devel \
libXdamage-devel \
libXcomposite-devel \
at-spi2-atk-devel \
cups \
atk
sudo systemctl enable --now cockpit.socket
sudo useradd admin -p "$(openssl passwd foobar)"
sudo usermod -aG wheel admin
echo "admin ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee "/etc/sudoers.d/admin-nopasswd"
function upload_artifacts {
mkdir -p /tmp/artifacts/extra-screenshots
USER="$(whoami)"
sudo chown -R "$USER:$USER" playwright-report
mv playwright-report /tmp/artifacts/
}
trap upload_artifacts EXIT
# to make package search work, the cdn repositories need to be replaced
# with the nightly repositories
sudo mkdir -p /etc/osbuild-composer/repositories
cat <<EOF | sudo tee -a /etc/osbuild-composer/repositories/rhel-9.json
{
"x86_64": [
{
"name": "baseos",
"baseurl": "http://download.devel.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-9/compose/BaseOS/x86_64/os/",
"check_gpg": false
},
{
"name": "appstream",
"baseurl": "http://download.devel.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-9/compose/AppStream/x86_64/os/",
"check_gpg": false
}
]
}
EOF
cat <<EOF | sudo tee -a /etc/osbuild-composer/repositories/rhel-10.json
{
"x86_64": [
{
"name": "baseos",
"baseurl": "http://download.devel.redhat.com/rhel-10/nightly/RHEL-10/latest-RHEL-10/compose/BaseOS/x86_64/os/",
"check_gpg": false
},
{
"name": "appstream",
"baseurl": "http://download.devel.redhat.com/rhel-10/nightly/RHEL-10/latest-RHEL-10/compose/AppStream/x86_64/os/",
"check_gpg": false
}
]
}
EOF
sudo systemctl enable --now osbuild-composer.socket osbuild-local-worker.socket
sudo systemctl start osbuild-worker@1
sudo podman run \
-e "PLAYWRIGHT_HTML_OPEN=never" \
-e "CI=true" \
--net=host \
-v "$PWD:/tests" \
--privileged \
--rm \
--init \
mcr.microsoft.com/playwright:v1.50.1-noble \
/bin/sh -c "cd tests && npx -y playwright@1.50.1 test"

View file

@ -18,7 +18,7 @@ const config = {
},
testTimeout: 10000,
fileParallelism: false,
exclude: ['./pkg/lib/**', '**/node_modules/**', '**/dist/**'],
exclude: ['./pkg/lib/**', '**/node_modules/**', '**/dist/**', './playwright/**'],
retry: 3,
},
reporters: ['default', 'junit'],