node.spec.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { test, expect } from '@playwright/test';
  6. import PageModel from './models';
  7. test.describe('node operations', () => {
  8. let editorPage: PageModel;
  9. test.beforeEach(async ({ page }) => {
  10. editorPage = new PageModel(page);
  11. await page.goto('http://localhost:3000');
  12. });
  13. test('node preview', async () => {
  14. const startCount = await editorPage.isStartNodeExist();
  15. const endCount = await editorPage.isEndNodeExist();
  16. const conditionCount = await editorPage.isConditionNodeExist();
  17. expect(startCount).toEqual(1);
  18. expect(endCount).toEqual(1);
  19. expect(conditionCount).toEqual(1);
  20. });
  21. test('add node', async () => {
  22. const prevCount = await editorPage.getNodeCount();
  23. await editorPage.insert('switch', {
  24. from: 'llm_0',
  25. to: 'switch_0',
  26. });
  27. const defaultNodeCount = await editorPage.getNodeCount();
  28. expect(defaultNodeCount).toEqual(prevCount + 4);
  29. });
  30. });