chore: organize tests and tweak stream delays (#942)

This commit is contained in:
Jeremy 2025-04-20 22:27:20 -07:00 committed by GitHub
parent 020494f63b
commit 6e16f3b30a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 21 additions and 21 deletions

View file

@ -11,8 +11,8 @@ export const chatModel = new MockLanguageModelV1({
}), }),
doStream: async ({ prompt }) => ({ doStream: async ({ prompt }) => ({
stream: simulateReadableStream({ stream: simulateReadableStream({
chunkDelayInMs: 50, chunkDelayInMs: 500,
initialDelayInMs: 100, initialDelayInMs: 1000,
chunks: getResponseChunksByPrompt(prompt), chunks: getResponseChunksByPrompt(prompt),
}), }),
rawCall: { rawPrompt: null, rawSettings: {} }, rawCall: { rawPrompt: null, rawSettings: {} },
@ -28,8 +28,8 @@ export const reasoningModel = new MockLanguageModelV1({
}), }),
doStream: async ({ prompt }) => ({ doStream: async ({ prompt }) => ({
stream: simulateReadableStream({ stream: simulateReadableStream({
chunkDelayInMs: 50, chunkDelayInMs: 500,
initialDelayInMs: 500, initialDelayInMs: 1000,
chunks: getResponseChunksByPrompt(prompt, true), chunks: getResponseChunksByPrompt(prompt, true),
}), }),
rawCall: { rawPrompt: null, rawSettings: {} }, rawCall: { rawPrompt: null, rawSettings: {} },
@ -45,8 +45,8 @@ export const titleModel = new MockLanguageModelV1({
}), }),
doStream: async () => ({ doStream: async () => ({
stream: simulateReadableStream({ stream: simulateReadableStream({
chunkDelayInMs: 50, chunkDelayInMs: 500,
initialDelayInMs: 100, initialDelayInMs: 1000,
chunks: [ chunks: [
{ type: 'text-delta', textDelta: 'This is a test title' }, { type: 'text-delta', textDelta: 'This is a test title' },
{ {

View file

@ -53,11 +53,11 @@ export default defineConfig({
projects: [ projects: [
{ {
name: 'setup:auth', name: 'setup:auth',
testMatch: /auth.setup.ts/, testMatch: /e2e\/auth.setup.ts/,
}, },
{ {
name: 'setup:reasoning', name: 'setup:reasoning',
testMatch: /reasoning.setup.ts/, testMatch: /e2e\/reasoning.setup.ts/,
dependencies: ['setup:auth'], dependencies: ['setup:auth'],
use: { use: {
...devices['Desktop Chrome'], ...devices['Desktop Chrome'],
@ -66,7 +66,7 @@ export default defineConfig({
}, },
{ {
name: 'chat', name: 'chat',
testMatch: /chat.test.ts/, testMatch: /e2e\/chat.test.ts/,
dependencies: ['setup:auth'], dependencies: ['setup:auth'],
use: { use: {
...devices['Desktop Chrome'], ...devices['Desktop Chrome'],
@ -75,7 +75,7 @@ export default defineConfig({
}, },
{ {
name: 'reasoning', name: 'reasoning',
testMatch: /reasoning.test.ts/, testMatch: /e2e\/reasoning.test.ts/,
dependencies: ['setup:reasoning'], dependencies: ['setup:reasoning'],
use: { use: {
...devices['Desktop Chrome'], ...devices['Desktop Chrome'],
@ -84,7 +84,7 @@ export default defineConfig({
}, },
{ {
name: 'artifacts', name: 'artifacts',
testMatch: /artifacts.test.ts/, testMatch: /e2e\/artifacts.test.ts/,
dependencies: ['setup:auth'], dependencies: ['setup:auth'],
use: { use: {
...devices['Desktop Chrome'], ...devices['Desktop Chrome'],

View file

@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test'; import { expect, test } from '@playwright/test';
import { ChatPage } from './pages/chat'; import { ChatPage } from '../pages/chat';
import { ArtifactPage } from './pages/artifact'; import { ArtifactPage } from '../pages/artifact';
test.describe('artifacts activity', () => { test.describe('artifacts activity', () => {
let chatPage: ChatPage; let chatPage: ChatPage;

View file

@ -1,9 +1,9 @@
import path from 'path'; import path from 'node:path';
import { generateId } from 'ai'; import { generateId } from 'ai';
import { getUnixTime } from 'date-fns'; import { getUnixTime } from 'date-fns';
import { expect, test as setup } from '@playwright/test'; import { expect, test as setup } from '@playwright/test';
const authFile = path.join(__dirname, '../playwright/.auth/session.json'); const authFile = path.join(__dirname, '../../playwright/.auth/session.json');
setup('authenticate', async ({ page }) => { setup('authenticate', async ({ page }) => {
const testEmail = `test-${getUnixTime(new Date())}@playwright.com`; const testEmail = `test-${getUnixTime(new Date())}@playwright.com`;

View file

@ -1,6 +1,6 @@
import { generateId } from 'ai'; import { generateId } from 'ai';
import { getUnixTime } from 'date-fns'; import { getUnixTime } from 'date-fns';
import { test, expect, Page } from '@playwright/test'; import { test, expect, type Page } from '@playwright/test';
test.use({ storageState: { cookies: [], origins: [] } }); test.use({ storageState: { cookies: [], origins: [] } });

View file

@ -1,4 +1,4 @@
import { ChatPage } from './pages/chat'; import { ChatPage } from '../pages/chat';
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
test.describe('chat activity', () => { test.describe('chat activity', () => {

View file

@ -1,10 +1,10 @@
import path from 'path'; import path from 'node:path';
import { expect, test as setup } from '@playwright/test'; import { expect, test as setup } from '@playwright/test';
import { ChatPage } from './pages/chat'; import { ChatPage } from '../pages/chat';
const reasoningFile = path.join( const reasoningFile = path.join(
__dirname, __dirname,
'../playwright/.reasoning/session.json', '../../playwright/.reasoning/session.json',
); );
setup('switch to reasoning model', async ({ page }) => { setup('switch to reasoning model', async ({ page }) => {

View file

@ -1,4 +1,4 @@
import { ChatPage } from './pages/chat'; import { ChatPage } from '../pages/chat';
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
test.describe('chat activity with reasoning', () => { test.describe('chat activity with reasoning', () => {