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: 0 additions & 1 deletion e2e-tests/pages/ApexEditorPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ export class ApexEditorPage extends BasePage {
'.cls-ext-file-icon',
'[aria-label*=".cls"]',
'.tab [title*=".cls"]',
'.monaco-editor',
];

const timeout = this.isDesktopMode ? 5000 : 3000;
Expand Down
22 changes: 5 additions & 17 deletions e2e-tests/tests/apex-goto-definition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ test.describe('Apex Go-to-Definition', () => {
*/
test('should handle generic type references', async ({ apexEditor }) => {
await test.step('Position cursor on generic type', async () => {
await apexEditor.positionCursorOnWord('List<Account>');
// Use single-word search; 'List<Account>' won't reliably position via Find
await apexEditor.positionCursorOnWord('accounts');
});

await test.step('Trigger go-to-definition', async () => {
Expand All @@ -292,8 +293,6 @@ test.describe('Apex Go-to-Definition', () => {
// Generic types may not have definitions in user code
// Just verify no crash occurred
expect(await apexEditor.isApexFileOpen()).toBe(true);

console.log('✅ Handled generic type reference');
});
});

Expand Down Expand Up @@ -392,7 +391,8 @@ test.describe('Apex Go-to-Definition', () => {
*/
test('should handle this keyword appropriately', async ({ apexEditor }) => {
await test.step('Position cursor on this keyword', async () => {
await apexEditor.positionCursorOnWord('this.instanceId');
// Use 'this' alone; 'this.instanceId' is multi-word and unreliable via Find
await apexEditor.positionCursorOnWord('this');
});

await test.step('Trigger go-to-definition', async () => {
Expand All @@ -402,8 +402,6 @@ test.describe('Apex Go-to-Definition', () => {
await test.step('Verify stayed in file', async () => {
// 'this' should either navigate to class or stay in place
expect(await apexEditor.isApexFileOpen()).toBe(true);

console.log('✅ Handled this keyword reference');
});
});

Expand Down Expand Up @@ -491,8 +489,6 @@ test.describe('Apex Go-to-Definition - Advanced Scenarios', () => {
'abstract class BaseHandler',
);
expect(content).toMatch(/abstract\s+class\s+BaseHandler/);

console.log('✅ Navigated to base class definition');
});
});

Expand All @@ -517,13 +513,11 @@ test.describe('Apex Go-to-Definition - Advanced Scenarios', () => {
});

await test.step('Navigate to overridden execute method', async () => {
await apexEditor.positionCursorOnWord('override void execute');
await apexEditor.positionCursorOnWord('execute');
await apexEditor.goToDefinition();

const content = await apexEditor.findAndGetViewportContent('execute');
expect(content).toMatch(/execute/);

console.log('✅ Navigated to overridden method');
});
});

Expand Down Expand Up @@ -557,8 +551,6 @@ test.describe('Apex Go-to-Definition - Advanced Scenarios', () => {
'interface DataProcessor',
);
expect(content).toMatch(/interface\s+DataProcessor/);

console.log('✅ Navigated to interface definition');
});
});

Expand Down Expand Up @@ -589,8 +581,6 @@ test.describe('Apex Go-to-Definition - Advanced Scenarios', () => {
const content =
await apexEditor.findAndGetViewportContent('processRecords');
expect(content).toMatch(/processRecords/);

console.log('✅ Navigated to interface method');
});
});

Expand Down Expand Up @@ -621,8 +611,6 @@ test.describe('Apex Go-to-Definition - Advanced Scenarios', () => {
'class Configuration',
);
expect(content).toMatch(/class\s+Configuration/);

console.log('✅ Navigated in complex class structure');
});
});
});
Expand Down
70 changes: 32 additions & 38 deletions e2e-tests/tests/apex-hover.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ test.describe('Apex Hover Functionality', () => {
await hoverHelper.hoverOnWord('ApexClassExample');
const content = await hoverHelper.getHoverContent();
expect(content.length).toBeGreaterThan(0);
console.log(`✅ Class hover content: ${content.substring(0, 50)}...`);
expect(content).toMatch(/class\b/i);
expect(content).toContain('ApexClassExample');
});

/**
Expand All @@ -46,8 +47,7 @@ test.describe('Apex Hover Functionality', () => {
await hoverHelper.hoverOnWord('DEFAULT_STATUS');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
expect(content.length).toBeGreaterThan(0);
console.log('✅ Static variable hover provided');
expect(content).toContain('String');
});

/**
Expand All @@ -57,17 +57,17 @@ test.describe('Apex Hover Functionality', () => {
await hoverHelper.hoverOnWord('instanceId');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
console.log('✅ Instance variable hover provided');
expect(content).toContain('String');
});

/**
* Test: Hover on method name shows method signature.
*/
test('should show hover for method name', async ({ hoverHelper }) => {
await hoverHelper.hoverOnWord('sayHello');
const hasMethodSig = await hoverHelper.hasMethodSignature();
expect(hasMethodSig).toBe(true);
console.log('✅ Method hover shows signature');
const content = await hoverHelper.getHoverContent();
expect(content).toContain('void');
expect(content).toContain('sayHello');
});

/**
Expand All @@ -77,8 +77,8 @@ test.describe('Apex Hover Functionality', () => {
await hoverHelper.hoverOnWord('Configuration');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
expect(content.length).toBeGreaterThan(0);
console.log('✅ Inner class hover provided');
expect(content).toContain('Configuration');
expect(content).toMatch(/class\b/i);
});

/**
Expand All @@ -93,24 +93,24 @@ test.describe('Apex Hover Functionality', () => {
content = await hoverHelper.getHoverContent();
}
expect(content).toBeTruthy();
console.log('✅ Inner enum hover provided');
expect(content).toContain('StatusType');
expect(content).toMatch(/enum\b/i);
});

/**
* Test: Hover contains type information for typed symbols.
*/
test('should show type information in hover', async ({ hoverHelper }) => {
await hoverHelper.hoverOnWord('instanceId');
const hasTypeInfo = await hoverHelper.hasTypeInformation();
expect(hasTypeInfo).toBe(true);
console.log('✅ Hover contains type information');
const content = await hoverHelper.getHoverContent();
// Verify actual type name appears, not just any keyword
expect(content).toContain('String');
});

/**
* Test: Hover is responsive (appears within reasonable time).
*/
test('should show hover within reasonable time', async ({ hoverHelper }) => {
// LSP hover can take a few seconds to resolve in web environment
const isResponsive = await hoverHelper.isHoverResponsive(
'ApexClassExample',
12000,
Expand All @@ -134,7 +134,6 @@ test.describe('Apex Hover Functionality', () => {
});

expect(await hoverHelper.isHoverVisible()).toBe(false);
console.log('✅ Hover can be dismissed');
});

/**
Expand All @@ -145,8 +144,8 @@ test.describe('Apex Hover Functionality', () => {
}) => {
await hoverHelper.hoverOnWord('add');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
console.log('✅ Method with parameters shows signature in hover');
expect(content).toMatch(/Integer/);
expect(content).toMatch(/add/);
});

/**
Expand All @@ -155,12 +154,10 @@ test.describe('Apex Hover Functionality', () => {
test('should show generic type for List variable', async ({
hoverHelper,
}) => {
await hoverHelper.hoverOnWord('List<Account> accounts');
await hoverHelper.hoverOnWord('accounts');
const content = await hoverHelper.getHoverContent();
const hasTypeInfo = await hoverHelper.hasTypeInformation();
expect(hasTypeInfo).toBe(true);
expect(content).toBeTruthy();
console.log('✅ List variable hover shows generic type');
expect(content).toMatch(/List|Account/);
});

/**
Expand All @@ -169,31 +166,29 @@ test.describe('Apex Hover Functionality', () => {
test('should show generic types for Map variable', async ({
hoverHelper,
}) => {
await hoverHelper.hoverOnWord('Map<Id, Account> accountMap');
await hoverHelper.hoverOnWord('accountMap');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
console.log('✅ Map variable hover shows generic types');
expect(content).toMatch(/Map|Account/);
});

/**
* Test: Multiple hovers can be triggered sequentially.
*/
test('should handle multiple sequential hovers', async ({ hoverHelper }) => {
await hoverHelper.hoverOnWord('ApexClassExample');
let content1 = await hoverHelper.getHoverContent();
expect(content1).toBeTruthy();
const content1 = await hoverHelper.getHoverContent();
expect(content1).toContain('ApexClassExample');

await hoverHelper.dismissHover();
await hoverHelper.hoverOnWord('Configuration');
let content2 = await hoverHelper.getHoverContent();
expect(content2).toBeTruthy();
const content2 = await hoverHelper.getHoverContent();
expect(content2).toContain('Configuration');

await hoverHelper.dismissHover();
await hoverHelper.hoverOnWord('StatusType');
let content3 = await hoverHelper.getHoverContent();
expect(content3).toBeTruthy();

console.log('✅ Multiple sequential hovers work correctly');
const content3 = await hoverHelper.getHoverContent();
expect(content3).toContain('StatusType');
});

/**
Expand All @@ -208,7 +203,7 @@ test.describe('Apex Hover Functionality', () => {
content = await hoverHelper.getHoverContent();
}
expect(content).toBeTruthy();
console.log('✅ Constructor hover provided');
expect(content).toContain('ApexClassExample');
});

/**
Expand All @@ -219,7 +214,7 @@ test.describe('Apex Hover Functionality', () => {
const content = await hoverHelper.getHoverContent();
expect(content.length).toBeGreaterThan(0);
expect(content.trim()).not.toBe('');
console.log(`✅ Hover content is non-empty (${content.length} chars)`);
expect(content).toContain('ApexClassExample');
});

/**
Expand All @@ -228,8 +223,8 @@ test.describe('Apex Hover Functionality', () => {
test('should show hover for private method', async ({ hoverHelper }) => {
await hoverHelper.hoverOnWord('validateAccounts');
const content = await hoverHelper.getHoverContent();
expect(content).toBeTruthy();
console.log('✅ Private method hover provided');
expect(content).toContain('void');
expect(content).toContain('validateAccounts');
});

/**
Expand All @@ -240,14 +235,15 @@ test.describe('Apex Hover Functionality', () => {
}) => {
await hoverHelper.hoverOnWord('ApexClassExample');
const classHover = await hoverHelper.getHoverContent();
expect(classHover).toMatch(/class\b/i);

await hoverHelper.dismissHover();

await hoverHelper.hoverOnWord('sayHello');
const methodHover = await hoverHelper.getHoverContent();
expect(methodHover).toMatch(/void/);

expect(classHover).not.toBe(methodHover);
console.log('✅ Different symbols provide different hover content');
});

/**
Expand All @@ -261,8 +257,6 @@ test.describe('Apex Hover Functionality', () => {
expect(content.length).toBeGreaterThan(0);

await hoverHelper.captureHoverScreenshot('test-hover');

console.log('✅ Hover screenshot captured successfully');
});
});

Expand Down
Loading
Loading