Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
5 changes: 4 additions & 1 deletion workspaces/x2a/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test:all": "yarn openapi-generate && yarn prettier:check && yarn lint:all && backstage-cli repo test --coverage",
"test:e2e": "echo Skipping until we have tests: playwright test",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:headed": "playwright test --headed",
"test:e2e:debug": "playwright test --debug",
"fix": "backstage-cli repo fix",
"lint": "backstage-cli repo lint --since origin/main",
"lint:all": "backstage-cli repo lint",
Expand Down
24 changes: 12 additions & 12 deletions workspaces/x2a/packages/app/e2e-tests/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
*/

import { test, expect } from '@playwright/test';
import { performGuestLogin } from './fixtures/auth';

// To be implemented later
test('noop test', async () => {
expect(true).toBe(true);
});
const devMode = !process.env.PLAYWRIGHT_URL;

/*
test('App should render the welcome page', async ({ page }) => {
await page.goto('/');

const enterButton = page.getByRole('button', { name: 'Enter' });
await expect(enterButton).toBeVisible();
await enterButton.click();
await performGuestLogin(page);

await expect(page.getByText('My Company Catalog')).toBeVisible();
if (devMode) {
await expect(
page.getByRole('heading', { name: 'Red Hat Catalog' }),
).toBeVisible({ timeout: 10000 });
} else {
await expect(
page.getByRole('heading', { name: 'Welcome back!' }),
).toBeVisible({ timeout: 10000 });
}
});
*/
128 changes: 128 additions & 0 deletions workspaces/x2a/packages/app/e2e-tests/conversion-flow.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright 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.
*/

import { test, expect } from '@playwright/test';
import { X2AnsiblePage } from './pages/X2AnsiblePage';

test.describe('X2Ansible - Conversion Flow @live', () => {
let x2aPage: X2AnsiblePage;

test.beforeEach(async ({ page }) => {
x2aPage = new X2AnsiblePage(page);
});

test.describe('Navigation and Page Load', () => {
test('should navigate to X2A page and display Conversion Hub', async () => {
await x2aPage.navigateToX2AByUrl();
await x2aPage.verifyConversionHubPage();
});

test('should navigate to X2A page via sidebar', async () => {
await x2aPage.navigateFromSidebar();
await x2aPage.verifyConversionHubPage();
});

test('should display Start first conversion button', async () => {
await x2aPage.navigateToX2AByUrl();
await x2aPage.verifyConversionHubPage();

const startFirst = x2aPage.page.getByRole('button', {
name: /start first conversion/i,
});
const newProject = x2aPage.page.getByRole('button', {
name: /new project/i,
});
await expect(startFirst.or(newProject).first()).toBeVisible({
timeout: 10000,
});
});
});

test.describe('Template Scaffolder', () => {
test('should load the scaffolder template when starting a conversion', async () => {
await x2aPage.navigateToX2AByUrl();
await x2aPage.clickStartFirstConversion();

Check warning on line 57 in workspaces/x2a/packages/app/e2e-tests/conversion-flow.test.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(): Promise<void>' of 'x2aPage.clickStartFirstConversion' is deprecated.

See more on https://sonarcloud.io/project/issues?id=redhat-developer_rhdh-plugins&issues=AZ5KtIuF4e8379IGY9YN&open=AZ5KtIuF4e8379IGY9YN&pullRequest=3203
await x2aPage.verifyTemplateFormLoaded();
});

test('should display all required form fields in step 1', async () => {
await x2aPage.navigateToX2AByUrl();
await x2aPage.clickStartFirstConversion();

Check warning on line 63 in workspaces/x2a/packages/app/e2e-tests/conversion-flow.test.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(): Promise<void>' of 'x2aPage.clickStartFirstConversion' is deprecated.

See more on https://sonarcloud.io/project/issues?id=redhat-developer_rhdh-plugins&issues=AZ5KtIuF4e8379IGY9YO&open=AZ5KtIuF4e8379IGY9YO&pullRequest=3203
await x2aPage.verifyTemplateFormLoaded();

await expect(x2aPage.page.getByLabel('Name')).toBeVisible();
await expect(x2aPage.page.getByLabel('Description')).toBeVisible();
await expect(x2aPage.page.getByLabel('Abbreviation')).toBeVisible();
await expect(x2aPage.page.getByLabel('Owned by group')).toBeVisible();
});

test('should have Next button on step 1', async () => {
await x2aPage.navigateToX2AByUrl();
await x2aPage.clickStartFirstConversion();

Check warning on line 74 in workspaces/x2a/packages/app/e2e-tests/conversion-flow.test.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(): Promise<void>' of 'x2aPage.clickStartFirstConversion' is deprecated.

See more on https://sonarcloud.io/project/issues?id=redhat-developer_rhdh-plugins&issues=AZ5KtIuF4e8379IGY9YP&open=AZ5KtIuF4e8379IGY9YP&pullRequest=3203
await x2aPage.verifyTemplateFormLoaded();

await expect(
x2aPage.page.getByRole('button', { name: 'Next' }),
).toBeVisible();
});
});

test.describe('Happy Path - Full Conversion Wizard', () => {
test('should complete the full conversion wizard', async () => {
test.setTimeout(180000);

await x2aPage.navigateToX2AByUrl();
await x2aPage.verifyConversionHubPage();
await x2aPage.clickStartFirstConversion();

Check warning on line 89 in workspaces/x2a/packages/app/e2e-tests/conversion-flow.test.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(): Promise<void>' of 'x2aPage.clickStartFirstConversion' is deprecated.

See more on https://sonarcloud.io/project/issues?id=redhat-developer_rhdh-plugins&issues=AZ5KtIuF4e8379IGY9YQ&open=AZ5KtIuF4e8379IGY9YQ&pullRequest=3203
await x2aPage.verifyTemplateFormLoaded();

// Step 1: Job name and description
await x2aPage.fillProjectName('chef-examples-e2e-test');
await x2aPage.fillDescription(
'E2E test conversion of Chef examples repo',
);
await x2aPage.fillAbbreviation('x2a');
await x2aPage.fillOwnedByGroup('guests');

await x2aPage.clickNext();

// Step 2: Source and target repositories
await x2aPage.verifyRepositoryStepVisible();
await x2aPage.dismissGitHubLoginDialog();

await x2aPage.fillSourceRepoOwner('chef');
await x2aPage.fillSourceRepoName('chef-examples');

await x2aPage.clickNext();

// Step 3: Conversion parameters (optional prompt)
await x2aPage.dismissGitHubLoginDialog();
await x2aPage.verifyConversionParamsVisible();
await x2aPage.clickNext();

// Step 4: Review
await x2aPage.verifyReviewStepVisible();

await expect(
x2aPage.page.getByText('chef-examples-e2e-test'),
).toBeVisible();

await x2aPage.clickCreate();

await x2aPage.verifyTaskSubmitted();
});
});
});
Loading
Loading