Просмотр исходного кода

test(e2e): rtc-basic-test cleanup new added graph

rcmerci 8 месяцев назад
Родитель
Сommit
d9ecf1aa7a

+ 12 - 2
clj-e2e/src/logseq/e2e/graph.clj

@@ -2,6 +2,10 @@
   (:require [logseq.e2e.util :as util]
             [wally.main :as w]))
 
+(defn- refresh-all-remote-graphs
+  []
+  (w/click "span:text(\"Refresh\")"))
+
 (defn new-graph
   [graph-name enable-sync?]
   (util/search "add a db graph")
@@ -20,5 +24,11 @@
   (util/search "go to all graphs")
   (w/click (w/get-by-label "Go to all graphs"))
   (util/repeat-until-visible 5
-                             (format "a[title='logseq/graphs/%s']" graph-name)
-                             #(w/click "span:text(\"Refresh\")")))
+                             (format "div[aria-label='e2e %s']" graph-name)
+                             refresh-all-remote-graphs))
+
+(defn remove-remote-graph
+  [graph-name]
+  (wait-for-remote-graph graph-name)
+  (w/click (format "div[aria-label='e2e %s'] a:has-text(\"Remove (server)\")" graph-name))
+  (w/click "div[role='alertdialog'] button:text('ok')"))

+ 3 - 2
clj-e2e/test/logseq/e2e/rtc_basic_test.clj

@@ -12,7 +12,7 @@
 
 (deftest rtc-basic-test
   (let [graph-name (str "rtc-graph-" (.toEpochMilli (java.time.Instant/now)))]
-    (testing "open 2 app instances"
+    (testing "open 2 app instances, add a rtc graph, check this graph available on other instance"
       (cp/prun!
        2
        #(w/with-page %
@@ -21,4 +21,5 @@
       (w/with-page @*page1
         (graph/new-graph graph-name true))
       (w/with-page @*page2
-        (graph/wait-for-remote-graph graph-name)))))
+        (graph/wait-for-remote-graph graph-name)
+        (graph/remove-remote-graph graph-name)))))

+ 2 - 1
src/main/frontend/components/repo.cljs

@@ -68,7 +68,8 @@
         (sort-repos-with-metadata-local repos)
         :let [only-cloud? (and remote? (nil? root))
               db-based? (config/db-based-graph? url)]]
-    [:div.flex.justify-between.mb-4.items-center.group {:key (or url GraphUUID)}
+    [:div.flex.justify-between.mb-4.items-center.group {:key (or url GraphUUID)
+                                                        :aria-label (str "e2e " GraphName)}
      [:div
       [:span.flex.items-center.gap-1
        (normalized-graph-label repo