Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared/src/logseq/core/e2e_seed_cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let seed_mode conn mode =
| Header_navigation -> Seed.seed_header_navigation conn
| Composer -> Seed.seed_composer conn (now_ms ())
| Outliner -> Seed.seed_outliner conn (now_ms ())
| Fixture -> Seed.seed_fixture conn
| Fixture -> Seed.seed_fixture conn (now_ms ())
| Performance -> Seed.seed_performance conn (now_ms ())
| PerformanceSized (journals, blocks) ->
Seed.seed_performance_sized conn (now_ms ()) journals blocks
Expand Down
23 changes: 19 additions & 4 deletions shared/src/logseq/core/e2e_seed_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,28 @@ let entity_built_in db eid =
let transact conn operations =
ignore (Ds.transact_conn conn operations : Ds.tx_report)

let reset_user_page_entities conn =
let reset_user_page_entities ?preserve_page_uuid conn =
let db = Ds.conn_db conn in
let preserved_page =
Option.bind preserve_page_uuid (fun uuid ->
Ds.entid db "block/uuid" (Ds.Uuid uuid))
in
let is_preserved eid =
match preserved_page with
| None -> false
| Some page ->
eid = page
|| (Ds.Db.datoms db Ds.Eavt ~e:eid ~a:"block/page" ()
|> Seq.exists (fun (datom : Ds.datom) -> datom.v = Ds.Ref page))
in
let operations =
Ds.Db.datoms db Ds.Aevt ~a:"block/uuid" ()
|> List.of_seq
|> List.filter_map (fun (datom : Ds.datom) ->
if
(entity_has_attr db datom.e "block/journal-day"
|| entity_has_attr db datom.e "block/page")
&& not (entity_built_in db datom.e)
&& not (entity_built_in db datom.e || is_preserved datom.e)
then Some (Ds.RetractEntity (Ds.Entity_id datom.e))
else None)
in
Expand Down Expand Up @@ -294,8 +306,11 @@ let seed_outliner conn now =
];
])

let seed_fixture conn =
reset_user_page_entities conn;
let seed_fixture conn now =
(* The sync server already knows this journal. Removing it from the local
fixture would make startup try to create the same journal again. *)
let today_uuid = Journal.page_uuid (Model.journal_day_for_ms now) in
reset_user_page_entities ~preserve_page_uuid:today_uuid conn;
seed conn

let performance_page_uuid index =
Expand Down
4 changes: 2 additions & 2 deletions shared/src/logseq/core/e2e_seed_data.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ val outliner_tag_uuid : string
val entity_has_attr : Datascript.db -> int -> string -> bool
val entity_built_in : Datascript.db -> int -> bool
val transact : Datascript.conn -> Datascript.tx_op list -> unit
val reset_user_page_entities : Datascript.conn -> unit
val reset_user_page_entities : ?preserve_page_uuid:string -> Datascript.conn -> unit
val uuid_attr : string -> Datascript.tx_value
val string_attr : string -> Datascript.tx_value
val int_attr : int -> Datascript.tx_value
Expand Down Expand Up @@ -61,7 +61,7 @@ val tag_attrs :
string -> string -> string -> (string * Datascript.tx_value) list
val seed : Datascript.conn -> (unit, string) result
val seed_outliner : Datascript.conn -> int -> (unit, string) result
val seed_fixture : Datascript.conn -> (unit, string) result
val seed_fixture : Datascript.conn -> int -> (unit, string) result
val performance_page_uuid : int -> string
val performance_block_uuid : int -> int -> string
val performance_block_title : int -> int -> string
Expand Down
20 changes: 19 additions & 1 deletion shared/test/logseq/e2e_seed_data_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,27 @@ let outliner_reset_is_idempotent () =
let standard_reset_is_idempotent () =
let conn = Ds.create_conn ~schema () in
for _ = 1 to 2 do
ignore (expect_ok (Seed.seed_fixture conn))
ignore (expect_ok (Seed.seed_fixture conn 1787893600000))
done;
check_eq (Graph.journal_page_count (Ds.conn_db conn)) 8;
check_eq (List.length (visible (Ds.conn_db conn))) 18

let standard_reset_preserves_the_synced_journal_for_today () =
let conn = Ds.create_conn ~schema () in
let now = 1787893600000 in
let today_uuid = Journal.page_uuid (Cache_model.journal_day_for_ms now) in
Seed.seed_current_journal conn now today_uuid Seed.composer_block_uuid
"Synced block";
Seed.seed_current_journal conn (now - 86400000) Seed.outliner_page_uuid
Seed.outliner_block_uuid "Stale block";
ignore (expect_ok (Seed.seed_fixture conn now));
let db = Ds.conn_db conn in
check (exists db today_uuid);
check (exists db Seed.composer_block_uuid);
check (not (exists db Seed.outliner_page_uuid));
check (not (exists db Seed.outliner_block_uuid));
check_eq (Graph.journal_page_count db) 9

let performance_reset_retains_one_hundred_journals () =
let conn = Ds.create_conn ~schema () in
for _ = 1 to 2 do
Expand Down Expand Up @@ -315,6 +331,8 @@ let cases =
standard_fixture_links_tags_rich_blocks_and_cards;
case "outliner reset is idempotent" outliner_reset_is_idempotent;
case "standard reset is idempotent" standard_reset_is_idempotent;
case "standard reset preserves the synced journal for today"
standard_reset_preserves_the_synced_journal_for_today;
case "performance reset retains one hundred journals"
performance_reset_retains_one_hundred_journals;
case "performance fixture supports insertion between adjacent blocks"
Expand Down
9 changes: 5 additions & 4 deletions tests/e2e/android-search-navigation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ appId: com.logseq.logseq
id: "button.search"
- assertVisible:
id: "screen.search"
- tapOn: "Search pages and blocks"
- inputText: "E2E Page Target"
- tapOn:
id: "field.search"
- inputText: "Aug 16th, 2026"
- extendedWaitUntil:
visible:
id: "screen.search.results"
timeout: 10000
- assertVisible: "E2E Page Target"
- assertVisible: "Aug 16th, 2026"
- tapOn:
id: "search.result.e2e10000-0000-4000-8000-000000000007"
- extendedWaitUntil:
Expand All @@ -26,7 +27,7 @@ appId: com.logseq.logseq
- pressKey: BACK
- assertVisible:
id: "screen.search"
- assertVisible: "E2E Page Target 20260816"
- assertVisible: "Aug 16th, 2026"
- hideKeyboard
- pressKey: BACK
- assertVisible:
Expand Down
19 changes: 9 additions & 10 deletions tests/e2e/android-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ appId: com.logseq.logseq
- launchApp
- extendedWaitUntil:
visible:
id: "button.overflow-menu"
id: "button.sidebar"
timeout: 30000
- tapOn:
id: "button.overflow-menu"
- tapOn: "Settings"
id: "button.sidebar"
- tapOn:
id: "button.sidebar.settings"
- extendedWaitUntil:
visible:
id: "screen.settings"
Expand All @@ -26,24 +27,22 @@ appId: com.logseq.logseq
id: "button.connection.apply"
- extendedWaitUntil:
visible:
id: "button.overflow-menu"
id: "button.sidebar.settings"
timeout: 10000
- takeScreenshot: "android-settings-dark-theme"
- tapOn:
id: "button.overflow-menu"
- tapOn: "Settings"
id: "button.sidebar.settings"
- tapOn:
id: "picker.settings.appearance"
- tapOn: "System"
- tapOn:
id: "button.connection.apply"
- extendedWaitUntil:
visible:
id: "button.overflow-menu"
id: "button.sidebar.settings"
timeout: 10000
- tapOn:
id: "button.overflow-menu"
- tapOn: "Settings"
id: "button.sidebar.settings"
- extendedWaitUntil:
visible:
id: "screen.settings"
Expand Down Expand Up @@ -167,4 +166,4 @@ appId: com.logseq.logseq
- tapOn:
id: "button.connection.cancel"
- assertVisible:
id: "button.overflow-menu"
id: "button.sidebar.settings"
8 changes: 5 additions & 3 deletions tests/e2e/ios-local-graph-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ appId: com.logseq.logseq
- tapOn:
id: "field.auth.password"
- inputText: "__LOGSEQ_E2E_PASSWORD__"
- hideKeyboard
# Submit from the password field without tapping through the sheet.
- pressKey: ENTER
- tapOn:
id: "button.auth.submit"
text: "Not Now"
optional: true
- extendedWaitUntil:
visible:
id: "screen.graph-picker|button.composer.expand"
id: "button.graph-add|button.composer.expand"
timeout: 60000
- runFlow:
when:
Expand Down
46 changes: 35 additions & 11 deletions tests/e2e/ios-local-realtime-sync.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
appId: com.logseq.logseq
---
- launchApp:
clearState: true
- launchApp
- runFlow:
when:
visible:
Expand All @@ -19,16 +18,17 @@ appId: com.logseq.logseq
- tapOn:
id: "field.auth.password"
- inputText: "__LOGSEQ_E2E_PASSWORD__"
- hideKeyboard
- pressKey: ENTER
- tapOn:
id: "button.auth.submit"
text: "Not Now"
optional: true
- extendedWaitUntil:
visible:
id: "screen.graph-picker|button.composer.expand"
id: "button.graph-add|button.composer.expand"
timeout: 60000
- extendedWaitUntil:
visible:
id: "screen.graph-picker"
id: "button.graph-add"
timeout: 30000
- tapOn: "__LOGSEQ_E2E_GRAPH_NAME__"
- extendedWaitUntil:
Expand All @@ -37,26 +37,50 @@ appId: com.logseq.logseq
timeout: 30000
- scrollUntilVisible:
element:
text: "__LOGSEQ_E2E_DESKTOP_BLOCK__"
id: "outliner.block-action.*"
text: "Edit block __LOGSEQ_E2E_DESKTOP_BLOCK__"
direction: DOWN
timeout: 30000
- tapOn:
id: "sync.connected"
- copyTextFrom:
id: "sync.cursor"
- evalScript: ${output.cursorBefore = Number(maestro.copiedText)}
- tapOn:
id: "button.sync.done"
- tapOn:
id: "button.composer.expand"
- tapOn:
id: "field.composer"
- inputText: "__LOGSEQ_E2E_MOBILE_BLOCK__"
- tapOn:
id: "button.send"
- tapOn:
id: "surface.composer.dismiss"
- tapOn:
id: "sync.connected"
- extendedWaitUntil:
visible:
id: "sync.cursor-advanced"
id: "sync.pending"
text: "Saved"
timeout: 30000
- assertVisible: "__LOGSEQ_E2E_MOBILE_BLOCK__"
- copyTextFrom:
id: "sync.cursor"
- assertTrue: ${Number(maestro.copiedText) > output.cursorBefore}
- tapOn:
id: "button.sync.done"
- assertVisible:
id: "outliner.block-action.*"
text: "Edit block __LOGSEQ_E2E_MOBILE_BLOCK__"
- stopApp
- launchApp
- extendedWaitUntil:
visible: "__LOGSEQ_E2E_DESKTOP_BLOCK__"
visible:
id: "outliner.block-action.*"
text: "Edit block __LOGSEQ_E2E_DESKTOP_BLOCK__"
timeout: 30000
- assertVisible: "__LOGSEQ_E2E_MOBILE_BLOCK__"
- assertVisible:
id: "outliner.block-action.*"
text: "Edit block __LOGSEQ_E2E_MOBILE_BLOCK__"
- assertVisible:
id: "sync.connected"
14 changes: 4 additions & 10 deletions tests/e2e/ios-settings-tabs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ appId: com.logseq.logseq
file: "__LOGSEQ_E2E_SETUP_FLOW__"
- launchApp
- tapOn:
id: "button.connection"
- tapOn: "Settings"
id: "button.sidebar"
- tapOn:
id: "button.sidebar.settings"
- assertVisible:
id: "screen.settings"
- tapOn:
Expand All @@ -24,25 +25,18 @@ appId: com.logseq.logseq
- assertVisible: "Flashcards, off"
- tapOn: "Settings"
- tapOn: "Cancel"
- tapOn:
id: "button.sidebar"
- assertNotVisible:
id: "link.sidebar.flashcards"
- assertVisible:
id: "link.sidebar.graphs"
- tapOn:
id: "button.sidebar.dismiss"
- tapOn:
id: "button.connection"
- tapOn: "Settings"
id: "button.sidebar.settings"
- tapOn:
id: "link.settings.tabs"
- tapOn:
id: "toggle.settings.tab.flashcards"
- assertVisible: "Flashcards, on"
- tapOn: "Settings"
- tapOn: "Cancel"
- tapOn:
id: "button.sidebar"
- assertVisible:
id: "link.sidebar.flashcards"
10 changes: 7 additions & 3 deletions tests/e2e/ios-settings-theme-parity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@ appId: com.logseq.logseq
- runFlow: __LOGSEQ_E2E_SETUP_FLOW__
- extendedWaitUntil:
visible:
text: "More"
id: "button.sidebar"
timeout: 60000
- tapOn: "More"
- tapOn: "Settings"
- tapOn:
id: "button.sidebar"
- tapOn:
id: "button.sidebar.settings"
- assertVisible:
id: "screen.settings"
- assertVisible: "Theme"
- assertVisible: "Language"
- tapOn:
id: "picker.settings.language"
point: "90%,50%"
- scrollUntilVisible:
element:
text: "العربية"
direction: DOWN
- tapOn: "العربية"
- tapOn:
id: "picker.settings.language"
point: "90%,50%"
- scrollUntilVisible:
element:
text: "System"
Expand Down
Loading