chore(trading): fix skipped tests (#5868)

This commit is contained in:
Ben 2024-02-26 15:52:22 +00:00 committed by GitHub
parent 22599673ec
commit 52e5a37da3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 64 deletions

View File

@ -15,8 +15,7 @@ deal_ticket_deposit_dialog_button = "deal-ticket-deposit-dialog-button"
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def vega(request): def vega(request):
with init_vega(request) as vega_instance: with init_vega(request) as vega_instance:
request.addfinalizer(lambda: cleanup_container( request.addfinalizer(lambda: cleanup_container(vega_instance))
vega_instance)) # Register the cleanup function
yield vega_instance yield vega_instance
@ -25,7 +24,6 @@ def continuous_market(vega):
return setup_continuous_market(vega) return setup_continuous_market(vega)
@pytest.mark.skip("tbd - issue only on the sim, should work in vega 0.74.0")
@pytest.mark.usefixtures("auth", "risk_accepted") @pytest.mark.usefixtures("auth", "risk_accepted")
def test_should_display_info_and_button_for_deposit(continuous_market, page: Page): def test_should_display_info_and_button_for_deposit(continuous_market, page: Page):
page.goto(f"/#/markets/{continuous_market}") page.goto(f"/#/markets/{continuous_market}")
@ -33,17 +31,20 @@ def test_should_display_info_and_button_for_deposit(continuous_market, page: Pag
page.get_by_test_id(order_price).fill("20") page.get_by_test_id(order_price).fill("20")
# 7002-SORD-060 # 7002-SORD-060
expect(page.get_by_test_id(deal_ticket_warning_margin)).to_have_text( expect(page.get_by_test_id(deal_ticket_warning_margin)).to_have_text(
"You may not have enough margin available to open this position.") "You may not have enough margin available to open this position."
)
page.get_by_test_id(deal_ticket_warning_margin).hover() page.get_by_test_id(deal_ticket_warning_margin).hover()
expect(page.get_by_test_id("tooltip-content").nth(0)).to_have_text( expect(page.get_by_test_id("tooltip-content").nth(0)).to_have_text(
"1,661,888.12901 tDAI is currently required.You have only 999,991.49731.Deposit tDAI") "1,661,888.12901 tDAI is currently required.You have only 999,991.49731.Deposit tDAI"
)
page.get_by_test_id(deal_ticket_deposit_dialog_button).nth(0).click() page.get_by_test_id(deal_ticket_deposit_dialog_button).nth(0).click()
expect(page.get_by_test_id("sidebar-content") expect(page.get_by_test_id("sidebar-content")).to_contain_text("DepositFrom")
).to_contain_text("DepositFrom")
@pytest.mark.usefixtures("auth", "risk_accepted") @pytest.mark.usefixtures("auth", "risk_accepted")
def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: VegaServiceNull, page: Page): def test_should_show_an_error_if_your_balance_is_zero(
continuous_market, vega: VegaServiceNull, page: Page
):
page.goto(f"/#/markets/{continuous_market}") page.goto(f"/#/markets/{continuous_market}")
vega.create_key("key_empty") vega.create_key("key_empty")
change_keys(page, vega, "key_empty") change_keys(page, vega, "key_empty")
@ -52,6 +53,7 @@ def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: V
# 7002-SORD-060 # 7002-SORD-060
expect(page.get_by_test_id(place_order)).to_be_enabled() expect(page.get_by_test_id(place_order)).to_be_enabled()
# 7002-SORD-003 # 7002-SORD-003
expect(page.get_by_test_id("deal-ticket-error-message-zero-balance") expect(page.get_by_test_id("deal-ticket-error-message-zero-balance")).to_have_text(
).to_have_text("You need tDAI in your wallet to trade in this market.Make a deposit") "You need tDAI in your wallet to trade in this market.Make a deposit"
)
expect(page.get_by_test_id(deal_ticket_deposit_dialog_button)).to_be_visible() expect(page.get_by_test_id(deal_ticket_deposit_dialog_button)).to_be_visible()

View File

@ -107,7 +107,6 @@ def test_market_info_liquidation(page: Page):
validate_info_section(page, fields) validate_info_section(page, fields)
@pytest.mark.skip("core issue #5681")
def test_market_info_key_details(page: Page, vega: VegaServiceNull): def test_market_info_key_details(page: Page, vega: VegaServiceNull):
# 6002-MDET-201 # 6002-MDET-201
page.get_by_test_id(market_title_test_id).get_by_text( page.get_by_test_id(market_title_test_id).get_by_text(
@ -117,8 +116,6 @@ def test_market_info_key_details(page: Page, vega: VegaServiceNull):
fields = [ fields = [
["Market ID", short_market_id], ["Market ID", short_market_id],
["Name", "BTC:DAI_2023"], ["Name", "BTC:DAI_2023"],
["Parent Market ID", "-"],
["Insurance Pool Fraction", "-"],
["Status", "Active"], ["Status", "Active"],
["Trading Mode", "Continuous"], ["Trading Mode", "Continuous"],
["Market Decimal Places", "5"], ["Market Decimal Places", "5"],

View File

@ -1,10 +1,12 @@
import pytest import pytest
from playwright.sync_api import Page, expect from playwright.sync_api import Page, expect
from vega_sim.null_service import VegaServiceNull
from typing import List from typing import List
from actions.vega import submit_order, submit_liquidity, submit_multiple_orders from actions.vega import submit_order, submit_liquidity, submit_multiple_orders
from conftest import init_vega, cleanup_container from conftest import init_vega, cleanup_container
from fixtures.market import setup_simple_market from fixtures.market import setup_simple_market
from wallet_config import MM_WALLET, MM_WALLET2 from wallet_config import MM_WALLET, MM_WALLET2
from actions.utils import next_epoch
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
@ -15,7 +17,7 @@ def vega(request):
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def setup_market(vega): def setup_market(vega: VegaServiceNull):
market_id = setup_simple_market(vega) market_id = setup_simple_market(vega)
submit_liquidity(vega, MM_WALLET.name, market_id) submit_liquidity(vega, MM_WALLET.name, market_id)
submit_multiple_orders( submit_multiple_orders(
@ -33,7 +35,6 @@ def setup_market(vega):
[[10, 69.995], [5, 70], [5, 85], [3, 90], [3, 95]], [[10, 69.995], [5, 70], [5, 85], [3, 90], [3, 95]],
) )
vega.forward("10s")
vega.wait_fn(1) vega.wait_fn(1)
vega.wait_for_total_catchup() vega.wait_for_total_catchup()
@ -46,19 +47,19 @@ def setup_market(vega):
# these values don't align with the multiple orders above as # these values don't align with the multiple orders above as
# creating a trade triggers the liquidity provision # creating a trade triggers the liquidity provision
orderbook_content = [ orderbook_content = [
[130.00500, 10, 94], [130.00500, 10, 126],
[130.00000, 3, 84], [130.00000, 3, 116],
[120.00000, 7, 81], [120.00000, 7, 113],
[110.00000, 5, 74], [110.00000, 5, 106],
[105.00000, 2, 69], [105.00000, 2, 101],
[101.00000, 67, 67], [101.00000, 99, 99],
# mid # mid
[99.00000, 102, 102], [99.00000, 99, 99],
[95.00000, 3, 105], [95.00000, 3, 102],
[90.00000, 3, 108], [90.00000, 3, 105],
[85.00000, 5, 113], [85.00000, 5, 110],
[70.00000, 5, 118], [70.00000, 5, 115],
[69.99500, 10, 128], [69.99500, 10, 125],
] ]
@ -81,7 +82,6 @@ def verify_prices_descending(page: Page):
assert prices == sorted(prices, reverse=True) assert prices == sorted(prices, reverse=True)
@pytest.mark.skip("tbd")
@pytest.mark.usefixtures("risk_accepted") @pytest.mark.usefixtures("risk_accepted")
def test_orderbook_grid_content(setup_market, page: Page): def test_orderbook_grid_content(setup_market, page: Page):
vega = setup_market[0] vega = setup_market[0]
@ -109,6 +109,7 @@ def test_orderbook_grid_content(setup_market, page: Page):
vega.wait_fn(1) vega.wait_fn(1)
vega.wait_for_total_catchup() vega.wait_for_total_catchup()
next_epoch(vega)
# 6003-ORDB-001 # 6003-ORDB-001
# 6003-ORDB-002 # 6003-ORDB-002
@ -120,7 +121,6 @@ def test_orderbook_grid_content(setup_market, page: Page):
page.goto(f"/#/markets/{market_id}") page.goto(f"/#/markets/{market_id}")
page.locator("[data-testid=Orderbook]").click() page.locator("[data-testid=Orderbook]").click()
# 6003-ORDB-013 # 6003-ORDB-013
assert ( assert (
float(page.locator("[data-testid*=last-traded]").text_content()) float(page.locator("[data-testid*=last-traded]").text_content())
@ -144,50 +144,46 @@ def test_orderbook_grid_content(setup_market, page: Page):
def test_orderbook_resolution_change(setup_market, page: Page): def test_orderbook_resolution_change(setup_market, page: Page):
market_id = setup_market[1] market_id = setup_market[1]
# 6003-ORDB-008 # 6003-ORDB-008
orderbook_content_0_00 = [ orderbook_content_0_01 = [
[130.01, 10, 94], [130.01, 10, 126],
[130.00, 3, 84], [130.00, 3, 116],
[120.00, 7, 81], [120.00, 7, 113],
[110.00, 5, 74], [110.00, 5, 106],
[105.00, 2, 69], [105.00, 2, 101],
[101.00, 67, 67], [101.00, 99, 99],
# mid # mid
[99.00, 102, 102], [99.00, 99, 99],
[95.00, 3, 105], [95.00, 3, 102],
[90.00, 3, 108], [90.00, 3, 105],
[85.00, 5, 113], [85.00, 5, 110],
[70.00, 15, 128], [70.00, 15, 125],
] ]
orderbook_content_10 = [ orderbook_content_1 = [
[130, 13, 94], [130, 13, 126],
[120, 7, 81], [120, 7, 113],
[110, 7, 74], [110, 5, 106],
[100, 67, 67], [105, 2, 101],
[101, 99, 99],
# mid # mid
[100, 105, 105], [99, 99, 99],
[90, 8, 113], [95, 3, 102],
[70, 15, 128], [90, 3, 105],
[85, 5, 110],
[70, 15, 125],
] ]
orderbook_content_100 = [
[100, 94, 94],
# mid
[100, 128, 128],
]
resolutions = [ resolutions = [
["0.00", orderbook_content_0_00], ["0.01", orderbook_content_0_01],
["10", orderbook_content_10], ["1", orderbook_content_1],
["100", orderbook_content_100],
] ]
page.goto(f"/#/markets/{market_id}") page.goto(f"/#/markets/{market_id}")
# temporary skip for resolution in resolutions:
# for resolution in resolutions: page.get_by_test_id("resolution").click()
# page.get_by_test_id("resolution").click() page.get_by_role("menuitem").get_by_text(resolution[0], exact=True).click()
# page.get_by_role("menu").get_by_text(resolution[0], exact=True).click() verify_orderbook_grid(page, resolution[1])
# verify_orderbook_grid(page, resolution[1])
@pytest.mark.usefixtures("risk_accepted") @pytest.mark.usefixtures("risk_accepted")
@ -209,7 +205,6 @@ def test_orderbook_price_size_copy(setup_market, page: Page):
expect(page.get_by_test_id("order-size")).to_have_value(volume.text_content()) expect(page.get_by_test_id("order-size")).to_have_value(volume.text_content())
@pytest.mark.skip("tbd")
@pytest.mark.usefixtures("risk_accepted") @pytest.mark.usefixtures("risk_accepted")
def test_orderbook_price_movement(setup_market, page: Page): def test_orderbook_price_movement(setup_market, page: Page):
vega = setup_market[0] vega = setup_market[0]