mirror of https://github.com/buster-so/buster.git
Fix additional tests
This commit is contained in:
parent
90c67392b2
commit
3f60d13a18
|
@ -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();
|
await expect(page.getByText('Reasoned')).toBeVisible();
|
||||||
|
|
||||||
//expect to for the text "Chart" on the page
|
//expect to for the text "Chart" on the page
|
||||||
await expect(page.getByText('Chart')).toBeVisible();
|
await expect(page.getByRole('tab', { name: 'Chart' })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,5 +13,6 @@ test(`Question: ${question}`, async ({ page }) => {
|
||||||
await expect(page.getByText('Reasoned')).toBeVisible();
|
await expect(page.getByText('Reasoned')).toBeVisible();
|
||||||
|
|
||||||
//expect to for the text "Chart" on the page
|
//expect to for the text "Chart" on the page
|
||||||
await expect(page.getByText('Chart')).toBeVisible();
|
|
||||||
|
await expect(page.getByRole('tab', { name: 'Chart' })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import { jwtDecode } from 'jwt-decode';
|
import { jwtDecode } from 'jwt-decode';
|
||||||
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
// Path to the authentication state file
|
// Path to the authentication state file
|
||||||
export const authFile = path.join(__dirname, 'auth.json');
|
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.click('button[type="submit"]');
|
||||||
|
|
||||||
await page.getByText('Sign in').click();
|
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?' }).fill('chad@buster.so');
|
||||||
await page.getByRole('textbox', { name: 'What is your email address?' }).press('Tab');
|
await page.getByRole('textbox', { name: 'What is your email address?' }).press('Tab');
|
||||||
await page.getByRole('textbox', { name: 'Password' }).fill('password');
|
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();
|
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.waitForURL('http://localhost:3000/app/home');
|
||||||
await page.waitForTimeout(350);
|
await page.waitForTimeout(350);
|
||||||
await page.goto('http://localhost:3000/app/new-user');
|
await page.goto('http://localhost:3000/app/new-user');
|
||||||
await page.getByRole('button', { name: 'Get Started' }).click();
|
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' }).dblclick();
|
||||||
await page.getByRole('textbox', { name: 'What is your full name' }).fill('Chad');
|
await page.getByRole('textbox', { name: 'What is your full name' }).fill('Chad');
|
||||||
|
await page.waitForTimeout(20);
|
||||||
await page.waitForTimeout(50);
|
|
||||||
await page.getByRole('button', { name: 'Create your account' }).click();
|
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');
|
await page.waitForURL('http://localhost:3000/app/home');
|
||||||
|
|
||||||
// Wait for the page to be fully loaded before accessing storage
|
// Wait for the page to be fully loaded before accessing storage
|
||||||
|
|
|
@ -67,7 +67,9 @@ async function globalSetup(config: FullConfig) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await login(page).catch((error) => {
|
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}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ test.describe.serial('Dataset tests', () => {
|
||||||
test('Can navigate to a dataset chart from the dataset list', async ({ page }) => {
|
test('Can navigate to a dataset chart from the dataset list', async ({ page }) => {
|
||||||
await page.goto('http://localhost:3000/app/home');
|
await page.goto('http://localhost:3000/app/home');
|
||||||
await page.getByRole('link', { name: 'Datasets' }).click();
|
await page.getByRole('link', { name: 'Datasets' }).click();
|
||||||
|
//wait for url to change
|
||||||
|
await page.waitForURL((url) => url.toString().includes('datasets'));
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default defineConfig({
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
/* Run your local dev server before starting the tests */
|
||||||
webServer: {
|
webServer: {
|
||||||
command: process.env.CI ? 'make start-fast' : 'make dev',
|
command: process.env.PLAYWRIGHT_START_COMMAND || 'make start-fast',
|
||||||
url: 'http://localhost:3000',
|
url: 'http://localhost:3000',
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
timeout: 60 * 1000 * 6,
|
timeout: 60 * 1000 * 6,
|
||||||
|
|
|
@ -34,6 +34,7 @@ export const AvailableItemsList: React.FC<AvailableItemsListProps> = ({
|
||||||
className="mb-4 h-full"
|
className="mb-4 h-full"
|
||||||
ref={setNodeRef}>
|
ref={setNodeRef}>
|
||||||
<div
|
<div
|
||||||
|
data-testid={`select-axis-available-items-list`}
|
||||||
className={cn(
|
className={cn(
|
||||||
'mb-1',
|
'mb-1',
|
||||||
showDeleteHoverState ? 'rounded bg-red-100 shadow-[0_0_3px_1px] shadow-red-300' : ''
|
showDeleteHoverState ? 'rounded bg-red-100 shadow-[0_0_3px_1px] shadow-red-300' : ''
|
||||||
|
|
|
@ -34,7 +34,7 @@ export const SelectAxisDropZone: React.FC<{
|
||||||
const hasItems = zone.items.length > 0;
|
const hasItems = zone.items.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={setNodeRef}>
|
<div ref={setNodeRef} data-testid={`select-axis-drop-zone-${zone.id}`}>
|
||||||
<StylingLabel
|
<StylingLabel
|
||||||
className="space-y-2!"
|
className="space-y-2!"
|
||||||
label={zone.title}
|
label={zone.title}
|
||||||
|
|
|
@ -19,9 +19,9 @@ export const SelectAxisItemDragContainer = React.forwardRef<
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
style={style}
|
style={style}
|
||||||
|
data-testid="select-axis-item-drag-container"
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex items-center space-x-1 overflow-hidden rounded-sm',
|
'flex h-8 items-center space-x-1 overflow-hidden rounded-sm',
|
||||||
'h-8',
|
|
||||||
isDragging && 'bg-background cursor-grabbing border shadow-lg',
|
isDragging && 'bg-background cursor-grabbing border shadow-lg',
|
||||||
className
|
className
|
||||||
)}>
|
)}>
|
||||||
|
|
Loading…
Reference in New Issue