settings-model-provider-boundary.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import {
  2. TID_SETTINGS_PAGE,
  3. TID_SETTINGS_SECTION_NAV,
  4. TID_TASK_SETTINGS_BUTTON,
  5. testId,
  6. } from "@zcode/shared/test-ids";
  7. import { clickTestIdByDom } from "#e2e/helpers/desktop-app";
  8. import { sel } from "#e2e/helpers/selectors";
  9. export async function openModelProviderSettings() {
  10. await clickTestIdByDom(TID_TASK_SETTINGS_BUTTON, {
  11. timeout: 15000,
  12. timeoutMsg: "没有找到设置入口按钮",
  13. });
  14. await $(sel(TID_SETTINGS_PAGE)).waitForDisplayed({ timeout: 15000 });
  15. await clickTestIdByDom(testId(TID_SETTINGS_SECTION_NAV, "modelProvider"), {
  16. timeout: 15000,
  17. timeoutMsg: "设置页没有出现模型供应商分区入口",
  18. });
  19. }
  20. export async function assertNoRemoteModelProviderSyncAction() {
  21. const remoteSyncActionVisible = await browser.execute(() =>
  22. Array.from(document.querySelectorAll<HTMLElement>("button"))
  23. .filter((element) => {
  24. const rect = element.getBoundingClientRect();
  25. return rect.width > 0 && rect.height > 0;
  26. })
  27. .some((element) => /同步到远端|Sync to remote/u.test(element.innerText.trim())),
  28. );
  29. expect(remoteSyncActionVisible).toBe(false);
  30. }