fix: 🐛 DC e2e tests (#3216)

* fix: 🐛 fixed DC e2e tests

* chore: 🤖 addressed feedback
This commit is contained in:
Priya Patel authored and GitHub committed 2026-04-03 11:49:45 -07:00
1 parent 4e7d6ba57e
commit e30168c55a
3 files changed
+28 -4

No files matched your search

@@ -137,4 +137,16 @@ export const electronTest = test.extend({
await use(page);
},
// Get terminal WebContentsView when it's created
terminalView: async ({ electronApp }, use) => {
const getTerminalView = async () => {
const windows = await electronApp.windows();
// terminal view is loaded at - serve://boundary/terminal
const terminal = windows.find((window) =>
window.url().includes('terminal'),
);
return terminal;
};
await use(getTerminalView);
},
});
+6 -2
View File
@@ -211,7 +211,7 @@ test.describe('Filtering sessions tests', () => {
).toBeVisible();
});
test('Filters by status', async ({ authedPage, tesseract }) => {
test('Filters by status', async ({ authedPage, tesseract, terminalView }) => {
await authedPage
.getByRole('row', { name: sshTarget.name })
.getByRole('link')
@@ -219,7 +219,11 @@ test.describe('Filtering sessions tests', () => {
.click();
await authedPage.getByRole('tab', { name: 'Shell' }).click();
await expect(async () => {
const screenshot = await authedPage.locator('.xterm-screen').screenshot();
const terminal = await terminalView();
if (!terminal) {
throw new Error('Terminal view not found');
}
const screenshot = await terminal.locator('.xterm-screen').screenshot();
const result = await tesseract.recognize(screenshot);
expect(result.data.text).toMatch(textToMatch);
}).toPass();
+10 -2
View File
@@ -254,7 +254,11 @@ test.describe('Targets tests', () => {
});
});
test('Connects to an SSH target', async ({ authedPage, tesseract }) => {
test('Connects to an SSH target', async ({
authedPage,
tesseract,
terminalView,
}) => {
await authedPage.getByRole('link', { name: sshTarget.name }).click();
await authedPage.getByRole('button', { name: 'Connect' }).click();
@@ -265,7 +269,11 @@ test.describe('Targets tests', () => {
await authedPage.getByRole('tab', { name: 'Shell' }).click();
await expect(async () => {
const screenshot = await authedPage.locator('.xterm-screen').screenshot();
const terminal = await terminalView();
if (!terminal) {
throw new Error('Terminal view not found');
}
const screenshot = await terminal.locator('.xterm-screen').screenshot();
const result = await tesseract.recognize(screenshot);
expect(result.data.text).toMatch(textToMatch);
}).toPass();