From b15d877d886a0c56b26c6abf3d350a435c8ac721 Mon Sep 17 00:00:00 2001 From: bwallacee Date: Mon, 13 Nov 2023 08:20:25 +0000 Subject: [PATCH 1/3] feat: lp ammendment test --- .../test_liquidity_provision.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/liquidity_provision/test_liquidity_provision.py diff --git a/tests/liquidity_provision/test_liquidity_provision.py b/tests/liquidity_provision/test_liquidity_provision.py new file mode 100644 index 0000000..6f82735 --- /dev/null +++ b/tests/liquidity_provision/test_liquidity_provision.py @@ -0,0 +1,50 @@ +import pytest +from playwright.sync_api import Page, expect +from vega_sim.service import VegaService +from conftest import init_vega +from fixtures.market import setup_continuous_market +from actions.utils import next_epoch + +@pytest.fixture(scope="module") +def vega(request): + with init_vega(request) as vega: + yield vega + + +@pytest.fixture(scope="module") +def continuous_market(vega): + return setup_continuous_market(vega) + + +@pytest.mark.usefixtures("page", "auth", "risk_accepted") +def test_liquidity_provision_amendment(continuous_market, vega: VegaService, page: Page): + # TODO Refactor asserting the grid + page.goto(f"/#/liquidity/{continuous_market}") + page.get_by_test_id("manage-vega-wallet").click() + page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(1).click(position={ "x": 0, "y": 0}, force=True) + page.reload() + row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first + expect(row).to_contain_text( + "Active10,000.0010,000.000.00%10,000.00100.00%10,000.00-100.00%0.00%---5/9/2023," + ) + vega.submit_simple_liquidity( + key_name="mm", + market_id=continuous_market, + commitment_amount=100, + fee=0.001, + is_amendment=True, + ) + + vega.wait_fn(1) + vega.wait_for_total_catchup() + page.reload() + row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first + expect(row).to_contain_text( + "Updating next epoch10,000.00 (100.00)10,000.00 (100.00)0.00% (0.10%)10,000.00100.00%10,000.00-100.00%100.00%---5/9/2023," + ) + next_epoch(vega=vega) + page.reload() + row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first + expect(row).to_contain_text( + "Active100.00100.000.10%100.00100.00%100.00-100.00%0.00%100.00%0.00%0.00%5/9/2023, 11:03:48 AM5/9/2023," + ) \ No newline at end of file From 4cd3d5c2de61759ded9e4e615becd42b6c4b1b28 Mon Sep 17 00:00:00 2001 From: bwallacee Date: Mon, 13 Nov 2023 08:42:57 +0000 Subject: [PATCH 2/3] chore: fix LP test --- tests/liquidity_provision/test_liquidity_provision.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/liquidity_provision/test_liquidity_provision.py b/tests/liquidity_provision/test_liquidity_provision.py index 6f82735..380f3f7 100644 --- a/tests/liquidity_provision/test_liquidity_provision.py +++ b/tests/liquidity_provision/test_liquidity_provision.py @@ -46,5 +46,5 @@ def test_liquidity_provision_amendment(continuous_market, vega: VegaService, pag page.reload() row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first expect(row).to_contain_text( - "Active100.00100.000.10%100.00100.00%100.00-100.00%0.00%100.00%0.00%0.00%5/9/2023, 11:03:48 AM5/9/2023," + "Active100.00100.000.10%100.00100.00%100.00-100.00%0.00%100.00%0.00%0.00%5/9/2023," ) \ No newline at end of file From bc331298dc4d84569c40844907611fda15eb88bc Mon Sep 17 00:00:00 2001 From: bwallacee Date: Mon, 13 Nov 2023 12:27:42 +0000 Subject: [PATCH 3/3] chore: pr comments --- tests/liquidity_provision/test_liquidity_provision.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/liquidity_provision/test_liquidity_provision.py b/tests/liquidity_provision/test_liquidity_provision.py index 380f3f7..b8b23fb 100644 --- a/tests/liquidity_provision/test_liquidity_provision.py +++ b/tests/liquidity_provision/test_liquidity_provision.py @@ -21,11 +21,13 @@ def test_liquidity_provision_amendment(continuous_market, vega: VegaService, pag # TODO Refactor asserting the grid page.goto(f"/#/liquidity/{continuous_market}") page.get_by_test_id("manage-vega-wallet").click() + #TODO Rename "mm" to "marketMaker" so that we don't have to specify where to click when switching wallets + # Currently the default click will click the middle of the element which will click the copy wallet key button page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(1).click(position={ "x": 0, "y": 0}, force=True) page.reload() row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first expect(row).to_contain_text( - "Active10,000.0010,000.000.00%10,000.00100.00%10,000.00-100.00%0.00%---5/9/2023," + "Active10,000.0010,000.000.00%10,000.00100.00%10,000.00-100.00%0.00%" ) vega.submit_simple_liquidity( key_name="mm", @@ -40,11 +42,11 @@ def test_liquidity_provision_amendment(continuous_market, vega: VegaService, pag page.reload() row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first expect(row).to_contain_text( - "Updating next epoch10,000.00 (100.00)10,000.00 (100.00)0.00% (0.10%)10,000.00100.00%10,000.00-100.00%100.00%---5/9/2023," + "Updating next epoch10,000.00 (100.00)10,000.00 (100.00)0.00% (0.10%)10,000.00100.00%10,000.00-100.00%100.00%" ) next_epoch(vega=vega) page.reload() row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first expect(row).to_contain_text( - "Active100.00100.000.10%100.00100.00%100.00-100.00%0.00%100.00%0.00%0.00%5/9/2023," + "Active100.00100.000.10%100.00100.00%100.00-100.00%0.00%100.00%0.00%0.00%" ) \ No newline at end of file