Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

feat: lp ammendment test #191

Merged
merged 3 commits into from
Nov 13, 2023
Merged
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
52 changes: 52 additions & 0 deletions tests/liquidity_provision/test_liquidity_provision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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()
#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)
bwallacee marked this conversation as resolved.
Show resolved Hide resolved
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%"
)
vega.submit_simple_liquidity(
key_name="mm",
market_id=continuous_market,
commitment_amount=100,
fee=0.001,
is_amendment=True,
)

vega.wait_fn(1)
bwallacee marked this conversation as resolved.
Show resolved Hide resolved
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%"
)
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%"
)