Skip to content

Commit

Permalink
sleep more
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho committed Mar 20, 2023
1 parent c9021e0 commit 23f91b6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions e2e/tests/06_clear_messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ test('after clear conversation, only system message remains', async ({ page }) =
await page.getByTestId('password').locator('input').fill('@WuHao5');
await page.getByTestId('signup').click();
// sleep 1 second
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
let input_area = await page.$("#message_textarea textarea")
await input_area?.click();
await input_area?.fill('test_demo_bestqa');
await input_area?.press('Enter');
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
await input_area?.fill('test_demo_bestqa');
await input_area?.press('Enter');
// get message counts in the conversation

await page.waitForTimeout(500);
await page.waitForTimeout(1000);

const message_counts = await page.$$eval('.message-text', (messages) => messages.length);
expect(message_counts).toBe(4);

const user = await selectUserByEmail(pool, test_email);
expect(user.email).toBe(test_email);
// expect(user.id).toBe(37);
const sessions = await selectChatSessionsByUserId(pool, user.id);
const session = sessions[0];

const message_counts = await page.$$eval('.message-text', (messages) => messages.length);
expect(message_counts).toBe(4);
// clear
await page.getByRole('contentinfo').getByRole('button').first().click();
await page.getByRole('button', { name: '是' }).click();

// sleep 500 ms
await page.waitForTimeout(500);
// get message counts in the conversation
Expand Down

0 comments on commit 23f91b6

Please sign in to comment.