Skip to content

Commit 657fdde

Browse files
committed
Rebase main
1 parent 0ac93c0 commit 657fdde

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/e2e.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function goToTrinoSettings(page: Page) {
2121

2222
async function setupDataSourceWithAccessToken(page: Page) {
2323
await page.getByPlaceholder('http://localhost:8080').fill('http://trino:8080');
24-
await page.locator('div').filter({hasText: /^Impersonate logged in userAccess token$/}).locator('label').nth(1).click();
24+
await page.locator('label[for="trino-settings-enable-impersonation"][aria-label="Toggle switch"], label[for="trino-settings-enable-impersonation"]:has(svg)').first().click();
2525
await page.locator('div').filter({hasText: /^Access token$/}).locator('input[type="password"]').fill('aaa');
2626
await page.getByRole('button', { name: /save.*test/i }).click();
2727
}
@@ -35,14 +35,6 @@ async function setupDataSourceWithClientCredentials(page: Page, clientId: string
3535
await page.getByRole('button', { name: /save.*test/i }).click();
3636
}
3737

38-
async function setupDataSourceWithClientTags(page: Page, clientTags: string) {
39-
await page.getByTestId('data-testid Datasource HTTP settings url').fill('http://trino:8080');
40-
await page.locator('div').filter({hasText: /^Impersonate logged in user$/}).getByLabel('Toggle switch').click();
41-
await page.locator('div').filter({hasText: /^Access token$/}).locator('input[type="password"]').fill('aaa');
42-
await page.locator('div').filter({hasText: /^Client Tags$/}).locator('input').fill(clientTags);
43-
await page.getByTestId('data-testid Data source settings page Save and Test button').click();
44-
}
45-
4638
async function runQueryAndCheckResults(page: Page) {
4739
await page.getByText(EXPLORE_DATA).click();
4840
await page.locator('textarea[aria-label*="Editor content"]').click();
@@ -57,6 +49,14 @@ async function runQueryAndCheckResults(page: Page) {
5749
await expect(page.locator('[role="table"][aria-label="Explore Table"]').getByText(/1995-01-\d+/).first()).toBeVisible();
5850
}
5951

52+
async function setupDataSourceWithClientTags(page: Page, clientTags: string) {
53+
await page.getByPlaceholder('http://localhost:8080').fill('http://trino:8080');
54+
await page.locator('label[for="trino-settings-enable-impersonation"][aria-label="Toggle switch"], label[for="trino-settings-enable-impersonation"]:has(svg)').first().click();
55+
await page.locator('div').filter({hasText: /^Access token$/}).locator('input[type="password"]').fill('aaa');
56+
await page.locator('div').filter({hasText: /^Client Tags$/}).locator('input').fill(clientTags);
57+
await page.getByRole('button', { name: /save.*test/i }).click();
58+
}
59+
6060
test('test with access token', async ({ page }) => {
6161
await login(page);
6262
await goToTrinoSettings(page);
@@ -75,15 +75,15 @@ test('test client credentials flow with wrong credentials', async ({ page }) =>
7575
await login(page);
7676
await goToTrinoSettings(page);
7777
await setupDataSourceWithClientCredentials(page, "some-wrong-client");
78-
await expect(page.getByText(EXPLORE_DATA)).toHaveCount(0);
78+
await expect(page.getByText('Query error: Bad Request')).toBeVisible(); // grafana shows 'Bad Request' for unauthenticated requests
7979
});
8080

8181
test('test client credentials flow with configured access token', async ({ page }) => {
8282
await login(page);
8383
await goToTrinoSettings(page);
8484
await page.locator('div').filter({hasText: /^Access token$/}).locator('input[type="password"]').fill('aaa');
8585
await setupDataSourceWithClientCredentials(page, GRAFANA_CLIENT);
86-
await expect(page.getByText(EXPLORE_DATA)).toHaveCount(0);
86+
await expect(page.getByText('Query error: Internal Server Error')).toBeVisible();
8787
});
8888

8989
test('test with client tags', async ({ page }) => {

0 commit comments

Comments
 (0)