Skip to content
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
1 change: 1 addition & 0 deletions tests/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export default defineConfig({
},
},
],
testMatch: 'specs/*.test.ts',
});
9 changes: 8 additions & 1 deletion tests/e2e/specs/baseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type TestFixtures = TestOptions & {
createTmpDir: () => Promise<string>;
};

export const MaxTimeout = 10000;

let testProjectPath: string;
export const test = base.extend<TestFixtures>({
vscodeVersion: ['insiders', { option: true }],
Expand Down Expand Up @@ -61,7 +63,12 @@ export const test = base.extend<TestFixtures>({
await fs.promises.cp(logPath, logOutputPath, { recursive: true });
}
},
createTmpDir: async (_, use) => {
// Next line is necessary because of how Playwright works. It expect a destructured pattern here:
// https://github.com/microsoft/playwright/issues/14590#issuecomment-1911734641
// https://github.com/microsoft/playwright/issues/21566#issuecomment-1464858235

// eslint-disable-next-line no-empty-pattern
createTmpDir: async ({}, use) => {
const tempDirs: string[] = [];
await use(async () => {
const tempDir = await fs.promises.realpath(await fs.promises.mkdtemp(path.join(os.tmpdir(), 'gltest-')));
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/specs/command_palette.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from './baseTest';
import { expect, MaxTimeout, test } from './baseTest';

test.describe('Test GitLens Command Palette commands', () => {
test('should open commit graph with the command', async ({ page }) => {
// Close any open tabs to ensure a clean state
const welcomePageTab = page.locator('div[role="tab"][aria-label="Welcome to GitLens"]');
await welcomePageTab.waitFor({ state: 'visible', timeout: 5000 });
await welcomePageTab.waitFor({ state: 'visible', timeout: MaxTimeout });
void welcomePageTab.locator('div.tab-actions .action-item a.codicon-close').click();

// Open the command palette by clicking on the View menu and selecting Command Palette
Expand All @@ -13,15 +13,15 @@ test.describe('Test GitLens Command Palette commands', () => {

// Wait for the command palette input to be visible and fill it
const commandPaletteInput = page.locator('.quick-input-box input');
await commandPaletteInput.waitFor({ state: 'visible', timeout: 5000 });
await commandPaletteInput.waitFor({ state: 'visible', timeout: MaxTimeout });
await commandPaletteInput.fill('> GitLens: Show Commit graph');
await page.waitForTimeout(1000);
void page.keyboard.press('Enter');

// Click on the first element (GitLens: Show Commit graph)
/*
const commandPaletteFirstLine = page.locator('.quick-input-widget .monaco-list .monaco-list-row.focused');
await commandPaletteFirstLine.waitFor({ state: 'visible', timeout: 5000 });
await commandPaletteFirstLine.waitFor({ state: 'visible', timeout: MaxTimeout });
await commandPaletteFirstLine.click();
*/
// Graph should be opened
Expand Down
Loading