Add tag filter and search test

This commit is contained in:
sirin 2024-10-03 09:52:11 +07:00
parent 8d56fbce2f
commit 39bb3c3017
3 changed files with 40 additions and 8 deletions

View File

@ -47,7 +47,10 @@ export function ExtendableCard(props: ExtendableCardProps) {
</div>
<div className="mt-2 flex flex-wrap items-center text-muted-foreground group-hover:hidden">
{props.tags.map((tag) => (
<span key={tag} className="text-[10px] md:text-xs rounded-md bg-slate-200 dark:bg-slate-700 p-1 mx-1 mb-1">
<span
id="tag"
key={tag}
className="text-[10px] md:text-xs rounded-md bg-slate-200 dark:bg-slate-700 p-1 mx-1 mb-1">
{tag}
</span>
))}

View File

@ -4,10 +4,20 @@ test.use({
storageState: './storageState.json'
});
test('test', async ({ page }) => {
test('Test search businesses', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/');
await page.getByLabel('Main').getByRole('img').click();
await page.getByPlaceholder('Enter business name...').click();
await page.getByPlaceholder('Enter business name...').fill('neon');
await page.getByPlaceholder('Enter business name...').press('Enter');
});
const businessInput = page.getByPlaceholder('Enter business name...');
await expect(businessInput).toBeVisible();
await businessInput.fill('neon');
await businessInput.press('Enter');
const heading = page.getByRole('heading', { name: 'Neon Solution, A dummy company' });
await expect(heading).toBeVisible();
await heading.click();
const fundSection = page.locator('div').filter({ hasText: /^Neon raising fund #1$/ });
await expect(fundSection).toBeVisible();
await fundSection.click();
});

View File

@ -4,8 +4,27 @@ test.use({
storageState: './storageState.json'
});
test('test', async ({ page }) => {
test('Test filter with tags', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/');
await page.getByRole('button', { name: 'Start Investing' }).click();
await page.getByRole('heading', { name: 'Investment Opportunities' }).click();
await page.locator('button').filter({ hasText: 'Tags' }).click();
await page.getByLabel('AI', { exact: true }).click();
await page.locator('span#tag', { hasText: 'AI' });
await page.locator('button').filter({ hasText: 'AI' }).click();
await page.getByLabel('Technology').click();
await page.locator('span#tag', { hasText: 'Technology' });
await page.locator('button').filter({ hasText: 'Technology' }).click();
await page.getByText('Consumer Electronics').click();
await page.locator('span#tag', { hasText: 'Consumer Electronics' });
await page.locator('button').filter({ hasText: 'Consumer Electronics' }).click();
await page.getByLabel('Software').click();
await page.locator('span#tag', { hasText: 'Software' });
await page.locator('button').filter({ hasText: 'Software' }).click();
await page.getByLabel('Internet').click();
await page.locator('span#tag', { hasText: 'Internet' });
});