testrun.spec.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { expect, test } from '@playwright/test';
  6. import PageModel from './models';
  7. test.describe('test testrun', () => {
  8. let editorPage: PageModel;
  9. test.beforeEach(async ({ page }) => {
  10. editorPage = new PageModel(page);
  11. await page.goto('http://localhost:3000');
  12. await page.waitForTimeout(1000);
  13. });
  14. test('trigger testrun', async ({ page }) => {
  15. const runBtn = await page.getByText('Run');
  16. await runBtn.click();
  17. // 等待第一条 flowing line
  18. const hasAnimation = await page.$eval('[data-line-id="start_0"]', (el) => {
  19. const style = window.getComputedStyle(el);
  20. return style.animationName !== 'none';
  21. });
  22. expect(hasAnimation).toBe(true);
  23. await page.waitForFunction(() => {
  24. const start_line = document.querySelector('[data-line-id="start_0"]');
  25. const style = window.getComputedStyle(start_line!);
  26. return style.animationName === 'none';
  27. });
  28. });
  29. });