Skip to content

Commit 10c15ee

Browse files
authored
E2E test: fix connections tests for Postgres (#8601)
Fix for Postgres connections tests. Cannot figure out how/why these were passing in CI as they were failing locally and in Docker. ### QA Notes @:connections @:web
1 parent 9ff942f commit 10c15ee

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

test/e2e/tests/connections/connections-postgres.test.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ test.describe('Postgres DB Connection', {
5757
await test.step('Open periodic table connection', async () => {
5858
const connectionName = app.code.driver.page.locator('.connections-details', { hasText: 'public' });
5959
await connectionName.locator('..').locator('.expand-collapse-area .codicon-chevron-right').click();
60-
await app.code.driver.page.locator('.codicon-positron-table-connection').click();
61-
await app.workbench.editors.verifyTab('Data: periodic_table', { isVisible: true });
60+
await app.code.driver.page.locator('.codicon-positron-table-connection').first().click();
61+
62+
// hack to allow for different beahavior based on how db was imported
63+
try {
64+
await app.workbench.editors.verifyTab('Data: elements', { isVisible: true });
65+
} catch {
66+
await app.workbench.editors.verifyTab('Data: periodic_table', { isVisible: true });
67+
}
6268
});
6369

6470
await test.step('Verify connection data from periodic table', async () => {
@@ -67,7 +73,12 @@ test.describe('Postgres DB Connection', {
6773
await expect(async () => {
6874
const tableData = await app.workbench.dataExplorer.getDataExplorerTableData();
6975

70-
expect(tableData[0]['Element']).toBe('Hydrogen');
76+
// hack to allow for different beahavior based on how db was imported
77+
try {
78+
expect(tableData[0]['name']).toBe('Hydrogen');
79+
} catch {
80+
expect(tableData[0]['Element']).toBe('Hydrogen');
81+
}
7182

7283
}).toPass({ timeout: 60000 });
7384
});
@@ -120,8 +131,14 @@ test.describe('Postgres DB Connection', {
120131
const publicNode = app.code.driver.page.locator('.connections-details', { hasText: 'public' });
121132
await publicNode.locator('..').locator('.expand-collapse-area .codicon-chevron-right').click();
122133

123-
await app.code.driver.page.locator('.codicon-positron-table-connection').click();
124-
await app.workbench.editors.verifyTab('Data: periodic_table', { isVisible: true });
134+
await app.code.driver.page.locator('.codicon-positron-table-connection').first().click();
135+
136+
// hack to allow for different beahavior based on how db was imported
137+
try {
138+
await app.workbench.editors.verifyTab('Data: elements', { isVisible: true });
139+
} catch {
140+
await app.workbench.editors.verifyTab('Data: periodic_table', { isVisible: true });
141+
}
125142
});
126143

127144
await test.step('Verify connection data from periodic table', async () => {
@@ -130,7 +147,12 @@ test.describe('Postgres DB Connection', {
130147
await expect(async () => {
131148
const tableData = await app.workbench.dataExplorer.getDataExplorerTableData();
132149

133-
expect(tableData[0]['Element']).toBe('Hydrogen');
150+
// hack to allow for different beahavior based on how db was imported
151+
try {
152+
expect(tableData[0]['name']).toBe('Hydrogen');
153+
} catch {
154+
expect(tableData[0]['Element']).toBe('Hydrogen');
155+
}
134156

135157
}).toPass({ timeout: 60000 });
136158
});

0 commit comments

Comments
 (0)