diff --git a/crates/aptos/e2e/cases/move.py b/crates/aptos/e2e/cases/move.py index e388a9c154f67..5d85d406b9ea8 100644 --- a/crates/aptos/e2e/cases/move.py +++ b/crates/aptos/e2e/cases/move.py @@ -83,6 +83,7 @@ def test_move_compile(run_helper: RunHelper, test_name=None): if f"{account_info.account_address}::cli_e2e_tests" not in response.stdout: raise TestError("Module did not compile successfully") + @test_case def test_move_compile_dev_mode(run_helper: RunHelper, test_name=None): package_dir = f"move/cli-e2e-tests/{run_helper.base_network}" @@ -104,6 +105,7 @@ def test_move_compile_dev_mode(run_helper: RunHelper, test_name=None): if f"{account_info.account_address}::cli_e2e_tests" not in response.stdout: raise TestError("Module did not compile successfully") + @test_case def test_move_compile_script(run_helper: RunHelper, test_name=None): package_dir = f"move/cli-e2e-tests/{run_helper.base_network}" @@ -150,8 +152,7 @@ def test_move_run(run_helper: RunHelper, test_name=None): ], ) - response = json.loads(response.stdout) - if response["Result"].get("success") != True: + if '"success": true' not in response.stdout: raise TestError("Move run did not execute successfully") # Get what modules exist on chain. @@ -176,3 +177,26 @@ def test_move_run(run_helper: RunHelper, test_name=None): raise TestError( "Data on chain (view_hero) does not match expected data from (mint_hero)" ) + + +@test_case +def test_move_view(run_helper: RunHelper, test_name=None): + account_info = run_helper.get_account_info() + + # Run the view function + response = run_helper.run_command( + test_name, + [ + "aptos", + "move", + "view", + "--function-id", + "0x1::account::exists_at", + "--args", + f"address:{account_info.account_address}", + ], + ) + + response = json.loads(response.stdout) + if response["Result"] == None or response["Result"][0] != True: + raise TestError("View function did not return correct result") diff --git a/crates/aptos/e2e/main.py b/crates/aptos/e2e/main.py index 58a2c8e9f73cf..75b6b98bac630 100644 --- a/crates/aptos/e2e/main.py +++ b/crates/aptos/e2e/main.py @@ -41,6 +41,7 @@ test_move_compile_script, test_move_publish, test_move_run, + test_move_view, ) from common import Network from local_testnet import run_node, stop_node, wait_for_startup @@ -125,6 +126,7 @@ def run_tests(run_helper): test_aptos_header_included(run_helper) # Run move subcommand group tests. + test_move_view(run_helper) test_move_compile(run_helper) test_move_compile_script(run_helper) test_move_publish(run_helper)