Skip to content

Commit b59f0fd

Browse files
committed
fixes tests
1 parent f79406c commit b59f0fd

4 files changed

Lines changed: 37 additions & 26 deletions

File tree

tests/e2e/helpers/selectors.ts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,29 @@ export const byTestId = (testId: string) => $(`[data-testid="${testId}"]`);
2121
*/
2222
export async function waitForModalClose(timeout = TIMEOUT.short): Promise<void> {
2323
try {
24-
const overlay = await $('.fixed.inset-0.bg-black\\/20');
25-
const exists = await overlay.isExisting().catch(() => false);
26-
27-
if (!exists) {
28-
return; // No modal, nothing to wait for
29-
}
30-
31-
// Try to wait for it to close naturally
32-
const closed = await overlay.waitForDisplayed({ timeout, reverse: true }).then(() => true).catch(() => false);
33-
34-
if (!closed) {
35-
// Modal still open - try to dismiss it with Escape key
36-
console.log('[waitForModalClose] Modal still displayed, trying Escape key');
37-
await browser.keys('Escape');
38-
await browser.pause(500);
24+
// Match any fixed fullscreen overlay (bg-black/20, bg-black/50, bg-black/60)
25+
const overlays = await $$('.fixed.inset-0');
26+
27+
for (const overlay of overlays) {
28+
const isDisplayed = await overlay.isDisplayed().catch(() => false);
29+
if (!isDisplayed) continue;
30+
31+
// Check if it looks like a modal backdrop (has bg-black in its classes)
32+
const cls = await overlay.getAttribute('class').catch(() => '') ?? '';
33+
if (!cls.includes('bg-black')) continue;
34+
35+
// Try to wait for it to close naturally
36+
const closed = await overlay
37+
.waitForDisplayed({ timeout, reverse: true })
38+
.then(() => true)
39+
.catch(() => false);
40+
41+
if (!closed) {
42+
// Modal still open - try to dismiss it with Escape key
43+
console.log('[waitForModalClose] Modal still displayed, trying Escape key');
44+
await browser.keys('Escape');
45+
await browser.pause(500);
46+
}
3947
}
4048
} catch {
4149
// Silently continue - modal handling shouldn't fail tests

tests/e2e/specs/deeplink-install.wdio.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,19 @@ describe('Deep Link Install - Valid Server', () => {
214214
describe('Deep Link Install - Invalid Server', () => {
215215
it('TC-DL-006: Deep link with unknown server ID shows error', async () => {
216216
await simulateInstallDeepLink('nonexistent-server-12345');
217-
await browser.pause(3000);
217+
218+
// Wait for the error modal to appear (loading -> error can take time)
219+
const errorModal = await byTestId('install-modal-error');
220+
const appeared = await errorModal
221+
.waitForDisplayed({ timeout: TIMEOUT.long })
222+
.then(() => true)
223+
.catch(() => false);
218224

219225
await browser.saveScreenshot(
220226
'./tests/e2e/screenshots/dl-06-not-found.png'
221227
);
222228

223-
const errorModal = await byTestId('install-modal-error');
224-
const isDisplayed = await errorModal.isDisplayed().catch(() => false);
225-
226-
if (isDisplayed) {
229+
if (appeared) {
227230
// Error message should mention the server was not found
228231
const errorMsg = await byTestId('install-modal-error-message');
229232
const text = await errorMsg.getText().catch(() => '');
@@ -235,7 +238,7 @@ describe('Deep Link Install - Invalid Server', () => {
235238
await browser.pause(1000);
236239
await waitForModalClose();
237240
} else {
238-
// On slow CI, check page source
241+
// Fallback: check page source for error text
239242
const pageSource = await browser.getPageSource();
240243
const hasError =
241244
pageSource.includes('not found') ||

tests/e2e/specs/server-config.wdio.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ describe('Server Configuration - PostgreSQL', () => {
6161
});
6262

6363
it('TC-SC-002b: Enter connection string and save configuration', async () => {
64-
const apiKeyInput = await byTestId('config-input-API_KEY');
65-
const isInputDisplayed = await apiKeyInput.isDisplayed().catch(() => false);
66-
64+
const configInput = await byTestId('config-input-DATABASE_URL');
65+
const isInputDisplayed = await configInput.isDisplayed().catch(() => false);
66+
6767
if (isInputDisplayed) {
68-
await apiKeyInput.setValue('test_api_key_12345');
68+
await configInput.setValue('postgresql://test:test@localhost:5432/testdb');
6969
await browser.pause(500);
7070

7171
await browser.saveScreenshot('./tests/e2e/screenshots/sc-04-entered-key.png');

tests/e2e/specs/server-lifecycle.wdio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('Server Installation - GitHub Server (No Inputs)', () => {
5252

5353
// Verify GitHub Server is in the list
5454
const pageSource = await browser.getPageSource();
55-
expect(pageSource.includes('GitHub Server')).toBe(true);
55+
expect(pageSource.includes('GitHub')).toBe(true);
5656

5757
const enableButton = await byTestId('enable-server-github-server');
5858
const isEnableDisplayed = await enableButton.isDisplayed().catch(() => false);

0 commit comments

Comments
 (0)