Skip to content

Commit

Permalink
Merge branch 'main' into kai-history-performance-visualizer
Browse files Browse the repository at this point in the history
# Conflicts:
#	kai-client-ci/output/report.json
  • Loading branch information
midays committed Nov 11, 2024
2 parents f756a78 + f1e3793 commit 2b387b1
Show file tree
Hide file tree
Showing 8 changed files with 9,644 additions and 2,469 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install vscode dependencies
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Run Playwright tests
run: npx playwright test || true # Ensures the workflow continues even if tests fail
- name: Upload screenshots
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vscode-screenshots
path: |
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IntelliJ project files
.idea
*.iml
out
gen
kai-client-ci/.idea
kai-client-ci/output
kai-client-ci/fixtures
38 changes: 37 additions & 1 deletion e2e/pages/vscode.pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { _electron as electron, ElectronApplication, Page } from 'playwright';
import {
_electron as electron,
ElectronApplication,
Frame,
FrameLocator,
Page,
} from 'playwright';
import { execSync } from 'child_process';
import { downloadLatestKAIPlugin } from '../utilities/download.utils';
import { getKAIPluginName } from '../utilities/utils';
Expand Down Expand Up @@ -87,6 +93,36 @@ class VSCode {
}
return this.window;
}

/**
* Iterates through all frames and returns the
* left panel frame for further interactions.
*/
public async getLeftIframe(): Promise<FrameLocator | null> {
if (!this.window) {
throw new Error('VSCode window is not initialized.');
}

const iframeLocators = this.window.locator('iframe');
const iframeCount = await iframeLocators.count();

for (let i = 0; i < iframeCount; i++) {
const iframeLocator = iframeLocators.nth(i);
const outerIframe = await iframeLocator.contentFrame();
if (outerIframe) {
const iframe2 = outerIframe.locator('iframe[title="Konveyor"]');
const iframe2Count = await iframe2.count();
if (iframe2Count > 0) {
const innerIframe = await iframe2.contentFrame();
return innerIframe;
}
}
}

// Return null if the iframe is not found
console.log('Iframe with title "Konveyor" not found.');
return null;
}
}

export { VSCode };
10 changes: 5 additions & 5 deletions e2e/tests/vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ test.describe('VSCode Tests', () => {
const kaiTab = await window.getByRole('tab', { name: 'Konveyor' });
await kaiTab.click();
await window.waitForTimeout(10000);
const title = window.getByRole('heading', {
name: 'Konveyor Analysis',
exact: true,
});
expect(title).toBeTruthy();
const iframe = await vscodeApp.getLeftIframe();
if (iframe) {
const heading = await iframe.locator('h1:has-text("Konveyor Analysis")');
await expect(heading).toBeVisible();
}
await window.screenshot({ path: 'kai-installed-screenshot.png' });
});
});
Loading

0 comments on commit 2b387b1

Please sign in to comment.