Fix additional tests

This commit is contained in:
Nate Kelley 2025-05-02 15:37:07 -06:00
parent 90c67392b2
commit 3f60d13a18
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
9 changed files with 38 additions and 10 deletions

View File

@ -15,5 +15,5 @@ test('Question: Can you make me a line chart that showcases my sales over time?
await expect(page.getByText('Reasoned')).toBeVisible();
//expect to for the text "Chart" on the page
await expect(page.getByText('Chart')).toBeVisible();
await expect(page.getByRole('tab', { name: 'Chart' })).toBeVisible();
});

View File

@ -13,5 +13,6 @@ test(`Question: ${question}`, async ({ page }) => {
await expect(page.getByText('Reasoned')).toBeVisible();
//expect to for the text "Chart" on the page
await expect(page.getByText('Chart')).toBeVisible();
await expect(page.getByRole('tab', { name: 'Chart' })).toBeVisible();
});

View File

@ -3,6 +3,7 @@ import * as fs from 'fs';
import * as path from 'path';
import isEmpty from 'lodash/isEmpty';
import { jwtDecode } from 'jwt-decode';
import { expect } from '@playwright/test';
// Path to the authentication state file
export const authFile = path.join(__dirname, 'auth.json');
@ -64,21 +65,42 @@ export async function login(page: Page) {
// await page.click('button[type="submit"]');
await page.getByText('Sign in').click();
await page.getByText(`Don't already have an account?`).click();
await page.getByRole('textbox', { name: 'What is your email address?' }).fill('chad@buster.so');
await page.getByRole('textbox', { name: 'What is your email address?' }).press('Tab');
await page.getByRole('textbox', { name: 'Password' }).fill('password');
expect(page.getByRole('textbox', { name: 'Confirm passowrd' })).not.toBeVisible();
await page.getByRole('button', { name: 'Sign in' }).click();
console.log('Waiting for response to /auth/login');
// Check that call to /auth/login was fired
await page.waitForResponse(
(response) => response.url().includes('/auth/login') && response.status() === 200
);
console.log('Response to /auth/login received');
//expect "Invalid email or password" to not be visible
expect(page.getByText('Invalid email or password')).not.toBeVisible();
console.log('Invalid email or password not visible');
await page.waitForLoadState('networkidle');
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(250);
console.log('Waiting for home page after login', page.url());
await page.waitForURL('http://localhost:3000/app/home');
await page.waitForTimeout(350);
await page.goto('http://localhost:3000/app/new-user');
await page.getByRole('button', { name: 'Get Started' }).click();
await page.getByRole('textbox', { name: 'What is your full name' }).dblclick();
await page.getByRole('textbox', { name: 'What is your full name' }).fill('Chad');
await page.waitForTimeout(50);
await page.waitForTimeout(20);
await page.getByRole('button', { name: 'Create your account' }).click();
await page.waitForTimeout(50);
await page.waitForTimeout(550);
await page.waitForLoadState('networkidle');
await page.waitForLoadState('domcontentloaded');
console.log('Waiting for home page', page.url());
await page.waitForURL('http://localhost:3000/app/home');
// Wait for the page to be fully loaded before accessing storage

View File

@ -67,7 +67,9 @@ async function globalSetup(config: FullConfig) {
}
} else {
await login(page).catch((error) => {
throw new Error(`Error during global setup: Failed to login - ${error}`);
throw new Error(
`Error during global setup: Failed to login with no valid auth - ${error}`
);
});
}

View File

@ -5,6 +5,8 @@ test.describe.serial('Dataset tests', () => {
test('Can navigate to a dataset chart from the dataset list', async ({ page }) => {
await page.goto('http://localhost:3000/app/home');
await page.getByRole('link', { name: 'Datasets' }).click();
//wait for url to change
await page.waitForURL((url) => url.toString().includes('datasets'));
await expect(
page

View File

@ -82,7 +82,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
webServer: {
command: process.env.CI ? 'make start-fast' : 'make dev',
command: process.env.PLAYWRIGHT_START_COMMAND || 'make start-fast',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 60 * 1000 * 6,

View File

@ -34,6 +34,7 @@ export const AvailableItemsList: React.FC<AvailableItemsListProps> = ({
className="mb-4 h-full"
ref={setNodeRef}>
<div
data-testid={`select-axis-available-items-list`}
className={cn(
'mb-1',
showDeleteHoverState ? 'rounded bg-red-100 shadow-[0_0_3px_1px] shadow-red-300' : ''

View File

@ -34,7 +34,7 @@ export const SelectAxisDropZone: React.FC<{
const hasItems = zone.items.length > 0;
return (
<div ref={setNodeRef}>
<div ref={setNodeRef} data-testid={`select-axis-drop-zone-${zone.id}`}>
<StylingLabel
className="space-y-2!"
label={zone.title}

View File

@ -19,9 +19,9 @@ export const SelectAxisItemDragContainer = React.forwardRef<
<div
ref={ref}
style={style}
data-testid="select-axis-item-drag-container"
className={cn(
'flex items-center space-x-1 overflow-hidden rounded-sm',
'h-8',
'flex h-8 items-center space-x-1 overflow-hidden rounded-sm',
isDragging && 'bg-background cursor-grabbing border shadow-lg',
className
)}>