WrenAI icon indicating copy to clipboard operation
WrenAI copied to clipboard

Add E2E tests for ClickHouse Data Source

Open fredalai opened this issue 1 year ago • 4 comments

Summary

We need contributors to help develop end-to-end (E2E) tests for the ClickHouse data source. The goal is to cover the entire onboarding process—from connecting ClickHouse to reaching the home page after successful data source setup.

Description

The goal is to ensure the entire onboarding flow for ClickHouse works as expected, including:

  • Connect to ClickHouse by selecting it as a data source and filling out the connection details (e.g., host, port, username, password...etc).
  • Select all tables as data models.
  • Accept all recommended relationships if they have.
  • Successfully reach the home page after completing the setup process.

Develop

Note:

  • When development is complete, please execute CLI to run the tests and include the results in your PR. Ensure that at least the test you added is included, e.g.,: yarn test:e2e e2e/specs/connectClickHouse.spec.ts

References:

fredalai avatar Oct 03 '24 04:10 fredalai

I would like to work on this issue. Please assign it to me.

princetoday avatar Oct 03 '24 18:10 princetoday

@princetoday assigned~! :D

fredalai avatar Oct 04 '24 02:10 fredalai

import { test, expect } from '@playwright/test';

test.describe('ClickHouse Data Source Onboarding', () => {

test('should connect to ClickHouse and reach the home page', async ({ page }) => {

// Navigate to data source page
await page.goto('http://your-app-url/data-source-setup');

// Step 1: Select ClickHouse as a data source
await page.click('text=Select Data Source');
await page.click('text=ClickHouse');

// Step 2: Fill in connection details
await page.fill('input[name="host"]', 'localhost');
await page.fill('input[name="port"]', '9000');
await page.fill('input[name="username"]', 'default');
await page.fill('input[name="password"]', 'password');

// Submit the connection details
await page.click('button[type="submit"]');

// Step 3: Select all tables as data models
await page.waitForSelector('text=Select Tables');
await page.click('button:has-text("Select All")');
await page.click('button:has-text("Next")');

// Step 4: Accept recommended relationships
await page.waitForSelector('text=Recommended Relationships');
await page.click('button:has-text("Accept All")');

// Step 5: Verify successful onboarding
await page.waitForURL('http://your-app-url/home');
expect(page.url()).toBe('http://your-app-url/home');

});

}); something like this??

princetoday avatar Oct 04 '24 05:10 princetoday

Hi @princetoday,

I'm not entirely sure what your specific question is, but from the code snippet you shared, I believe the overall testing steps are on the right track. However, one thing to note is that we shouldn't hard-code the connection details directly into the script. Instead, remember to use getTestConfig() (the connection info should be in your e2e.config.json file, which won’t be submitted when you make a PR). Also, it might be helpful to look into the newer Playwright syntax for writing tests more efficiently.

Thanks, Freda

fredalai avatar Oct 05 '24 08:10 fredalai

Hi, I noticed that this issue has been inactive for the past two weeks. Would it be alright if I take it over and work on it?

ongdisheng avatar Oct 22 '24 05:10 ongdisheng

@ongdisheng reassigned thanks!

chilijung avatar Oct 22 '24 11:10 chilijung