node.spec.ts 922 B

12345678910111213141516171819202122232425262728293031
  1. import { test, expect } from '@playwright/test';
  2. import PageModel from './models';
  3. test.describe('node operations', () => {
  4. let editorPage: PageModel;
  5. test.beforeEach(async ({ page }) => {
  6. editorPage = new PageModel(page);
  7. await page.goto('http://localhost:3000');
  8. });
  9. test('node preview', async () => {
  10. const startCount = await editorPage.isStartNodeExist();
  11. const endCount = await editorPage.isEndNodeExist();
  12. const conditionCount = await editorPage.isConditionNodeExist();
  13. expect(startCount).toEqual(1);
  14. expect(endCount).toEqual(1);
  15. expect(conditionCount).toEqual(1);
  16. });
  17. test('add node', async () => {
  18. const prevCount = await editorPage.getNodeCount();
  19. await editorPage.insert('switch', {
  20. from: 'llm_0',
  21. to: 'if_0',
  22. });
  23. const defaultNodeCount = await editorPage.getNodeCount();
  24. expect(defaultNodeCount).toEqual(prevCount + 4);
  25. });
  26. });