Compare commits
1 Commits
develop
...
chore/reve
Author | SHA1 | Date | |
---|---|---|---|
|
e1ed910271 |
@ -182,27 +182,7 @@ def vega(request):
|
||||
request.addfinalizer(lambda: cleanup_container(vega_instance))
|
||||
yield vega_instance
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def shared_vega(request):
|
||||
with init_vega(request) as vega_instance:
|
||||
try:
|
||||
request.addfinalizer(lambda: cleanup_container(vega_instance))
|
||||
yield vega_instance
|
||||
finally:
|
||||
cleanup_container(vega_instance)
|
||||
|
||||
@pytest.fixture
|
||||
def page_shared_vega(shared_vega, browser, request):
|
||||
with init_page(shared_vega, browser, request) as page_instance:
|
||||
yield page_instance
|
||||
|
||||
@pytest.fixture
|
||||
def auth_shared_vega(shared_vega: VegaServiceNull, page_shared_vega: Page):
|
||||
return auth_setup(shared_vega, page_shared_vega)
|
||||
|
||||
@pytest.fixture
|
||||
def risk_accepted_shared_vega(page_shared_vega: Page):
|
||||
risk_accepted_setup(page_shared_vega)
|
||||
|
||||
def cleanup_container(vega_instance):
|
||||
try:
|
||||
@ -303,10 +283,6 @@ def opening_auction_market(vega):
|
||||
return setup_opening_auction_market(vega)
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def shared_continuous_market(shared_vega:VegaServiceNull):
|
||||
return setup_continuous_market(shared_vega)
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def continuous_market(vega):
|
||||
return setup_continuous_market(vega)
|
||||
|
@ -2,62 +2,35 @@ import pytest
|
||||
from playwright.sync_api import Page, expect
|
||||
from vega_sim.null_service import VegaServiceNull
|
||||
from datetime import datetime, timedelta
|
||||
from conftest import init_page, risk_accepted_setup, auth_setup
|
||||
from conftest import init_vega, cleanup_container
|
||||
from fixtures.market import setup_continuous_market
|
||||
from actions.utils import wait_for_toast_confirmation
|
||||
from wallet_config import WalletConfig, MM_WALLET2
|
||||
|
||||
from actions.utils import (
|
||||
change_keys,
|
||||
create_and_faucet_wallet,
|
||||
)
|
||||
|
||||
order_size = "order-size"
|
||||
order_price = "order-price"
|
||||
place_order = "place-order"
|
||||
order_side_sell = "order-side-SIDE_SELL"
|
||||
order_side_buy = "order-side-SIDE_BUY"
|
||||
market_order = "order-type-Market"
|
||||
limit_order = "order-type-Limit"
|
||||
tif = "order-tif"
|
||||
expire = "expire"
|
||||
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def page(shared_vega, browser, request, continuous_market):
|
||||
with init_page(shared_vega, browser, request) as page:
|
||||
risk_accepted_setup(page)
|
||||
auth_setup(shared_vega, page)
|
||||
basic_key = WalletConfig("basic_key", "basic_key")
|
||||
create_and_faucet_wallet(vega=shared_vega, wallet=basic_key)
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
change_keys(page, shared_vega, "basic_key")
|
||||
yield page
|
||||
def vega(request):
|
||||
with init_vega(request) as vega_instance:
|
||||
request.addfinalizer(lambda: cleanup_container(vega_instance)) # Register the cleanup function
|
||||
yield vega_instance
|
||||
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def continuous_market(shared_vega:VegaServiceNull):
|
||||
keypairs = shared_vega.wallet.get_keypairs("MarketSim")
|
||||
proposal_key = keypairs.get('market_maker')
|
||||
termination_key=keypairs.get('FJMKnwfZdd48C8NqvYrG')
|
||||
mm_2_key=keypairs.get('market_maker_2')
|
||||
|
||||
kwargs = {}
|
||||
if proposal_key is not None:
|
||||
kwargs['proposal_key'] = proposal_key
|
||||
if termination_key is not None:
|
||||
kwargs['termination_key'] = termination_key
|
||||
if mm_2_key is not None:
|
||||
kwargs['mm_2_key'] = mm_2_key
|
||||
|
||||
return setup_continuous_market(shared_vega, **kwargs)
|
||||
def continuous_market(vega):
|
||||
return setup_continuous_market(vega)
|
||||
|
||||
|
||||
|
||||
def test_limit_buy_order_GTT( shared_vega: VegaServiceNull, page: Page):
|
||||
page.get_by_test_id(limit_order).click()
|
||||
page.get_by_test_id(order_side_buy).click()
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_limit_buy_order_GTT(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(tif).select_option("Good 'til Time (GTT)")
|
||||
page.get_by_test_id(order_size).fill("10")
|
||||
page.get_by_test_id(order_price).fill("120")
|
||||
@ -74,31 +47,30 @@ def test_limit_buy_order_GTT( shared_vega: VegaServiceNull, page: Page):
|
||||
)
|
||||
page.get_by_test_id(place_order).click()
|
||||
wait_for_toast_confirmation(page)
|
||||
shared_vega.wait_fn(1)
|
||||
shared_vega.wait_for_total_catchup()
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
page.get_by_test_id("All").click()
|
||||
page.reload()
|
||||
# 7002-SORD-017
|
||||
expect(page.get_by_role("row").nth(4)).to_contain_text("10+10LimitFilled120.00GTT:")
|
||||
expect(page.get_by_role("row").nth(5)).to_contain_text("10+10LimitFilled120.00GTT:")
|
||||
|
||||
|
||||
def test_limit_buy_order(shared_vega: VegaServiceNull, page: Page):
|
||||
page.get_by_test_id(limit_order).click()
|
||||
page.get_by_test_id(order_side_buy).click()
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_limit_buy_order(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(order_size).fill("10")
|
||||
page.get_by_test_id(order_price).fill("120")
|
||||
page.get_by_test_id(place_order).click()
|
||||
wait_for_toast_confirmation(page)
|
||||
shared_vega.wait_fn(2)
|
||||
shared_vega.wait_for_total_catchup()
|
||||
vega.wait_fn(2)
|
||||
vega.wait_for_total_catchup()
|
||||
page.get_by_test_id("All").click()
|
||||
page.reload()
|
||||
# 7002-SORD-017
|
||||
expect(page.get_by_role("row").nth(5)).to_contain_text("10+10LimitFilled120.00GTT")
|
||||
expect(page.get_by_role("row").nth(6)).to_contain_text("10+10LimitFilled120.00GTC")
|
||||
|
||||
|
||||
def test_limit_sell_order(shared_vega: VegaServiceNull, page: Page):
|
||||
page.get_by_test_id(limit_order).click()
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_limit_sell_order(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(order_size).fill("10")
|
||||
page.get_by_test_id(order_price).fill("100")
|
||||
page.get_by_test_id(order_side_sell).click()
|
||||
@ -112,15 +84,15 @@ def test_limit_sell_order(shared_vega: VegaServiceNull, page: Page):
|
||||
)
|
||||
page.get_by_test_id(place_order).click()
|
||||
wait_for_toast_confirmation(page)
|
||||
shared_vega.wait_fn(1)
|
||||
shared_vega.wait_for_total_catchup()
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
page.get_by_test_id("All").click()
|
||||
page.reload()
|
||||
expect(page.get_by_role("row").nth(6)).to_contain_text("10-10LimitFilled100.00GFN")
|
||||
expect(page.get_by_role("row").nth(7)).to_contain_text("10-10LimitFilled100.00GFN")
|
||||
|
||||
|
||||
|
||||
def test_market_sell_order(shared_vega: VegaServiceNull, page: Page):
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_market_sell_order(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(market_order).click()
|
||||
page.get_by_test_id(order_size).fill("10")
|
||||
page.get_by_test_id(order_side_sell).click()
|
||||
@ -133,32 +105,32 @@ def test_market_sell_order(shared_vega: VegaServiceNull, page: Page):
|
||||
)
|
||||
page.get_by_test_id(place_order).click()
|
||||
wait_for_toast_confirmation(page)
|
||||
shared_vega.wait_fn(1)
|
||||
shared_vega.wait_for_total_catchup()
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
page.get_by_test_id("All").click()
|
||||
page.reload()
|
||||
expect(page.get_by_role("row").nth(7)).to_contain_text("10-10MarketFilled-IOC")
|
||||
expect(page.get_by_role("row").nth(8)).to_contain_text("10-10MarketFilled-IOC")
|
||||
|
||||
|
||||
def test_market_buy_order(shared_vega: VegaServiceNull, page: Page):
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_market_buy_order(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(market_order).click()
|
||||
page.get_by_test_id(order_side_buy).click()
|
||||
page.get_by_test_id(order_size).fill("10")
|
||||
page.get_by_test_id(tif).select_option("Fill or Kill (FOK)")
|
||||
page.get_by_test_id(place_order).click()
|
||||
wait_for_toast_confirmation(page)
|
||||
shared_vega.wait_fn(1)
|
||||
shared_vega.wait_for_total_catchup()
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
page.get_by_test_id("All").click()
|
||||
page.reload()
|
||||
# 7002-SORD-010
|
||||
# 0003-WTXN-012
|
||||
# 0003-WTXN-003
|
||||
expect(page.get_by_role("row").nth(8)).to_contain_text("10+10MarketFilled-FOK")
|
||||
expect(page.get_by_role("row").nth(9)).to_contain_text("10+10MarketFilled-FOK")
|
||||
|
||||
|
||||
def test_sidebar_should_be_open_after_reload(page: Page):
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_sidebar_should_be_open_after_reload(continuous_market, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
expect(page.get_by_test_id("deal-ticket-form")).to_be_visible()
|
||||
page.get_by_test_id("Order").click()
|
||||
expect(page.get_by_test_id("deal-ticket-form")).not_to_be_visible()
|
||||
|
@ -1,4 +1,4 @@
|
||||
""" import pytest
|
||||
import pytest
|
||||
from playwright.sync_api import Page, expect
|
||||
from vega_sim.null_service import VegaServiceNull
|
||||
from actions.vega import submit_order
|
||||
@ -87,4 +87,3 @@ def test_margin_and_fees_estimations(continuous_market, vega: VegaServiceNull, p
|
||||
# expect(page.get_by_test_id("toast-content")).to_contain_text(
|
||||
# "Your transaction has been confirmed"
|
||||
# )
|
||||
"""
|
@ -44,25 +44,25 @@ def create_position(vega: VegaServiceNull, market_id):
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup
|
||||
|
||||
@pytest.mark.usefixtures("auth_shared_vega", "risk_accepted_shared_vega")
|
||||
def test_stop_order_form_error_validation(shared_continuous_market, page_shared_vega: Page):
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_stop_order_form_error_validation(continuous_market, page: Page):
|
||||
# 7002-SORD-032
|
||||
page_shared_vega.goto(f"/#/markets/{shared_continuous_market}")
|
||||
page_shared_vega.get_by_test_id(stop_order_btn).click()
|
||||
page_shared_vega.get_by_test_id(stop_limit_order_btn).is_visible()
|
||||
page_shared_vega.get_by_test_id(stop_limit_order_btn).click()
|
||||
page_shared_vega.get_by_test_id(order_side_sell).click()
|
||||
page_shared_vega.get_by_test_id(submit_stop_order).click()
|
||||
expect(page_shared_vega.get_by_test_id("stop-order-error-message-trigger-price")).to_have_text(
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(stop_order_btn).click()
|
||||
page.get_by_test_id(stop_limit_order_btn).is_visible()
|
||||
page.get_by_test_id(stop_limit_order_btn).click()
|
||||
page.get_by_test_id(order_side_sell).click()
|
||||
page.get_by_test_id(submit_stop_order).click()
|
||||
expect(page.get_by_test_id("stop-order-error-message-trigger-price")).to_have_text(
|
||||
"You need provide a price"
|
||||
)
|
||||
expect(page_shared_vega.get_by_test_id("stop-order-error-message-size")).to_have_text(
|
||||
expect(page.get_by_test_id("stop-order-error-message-size")).to_have_text(
|
||||
"Size cannot be lower than 1"
|
||||
)
|
||||
|
||||
page_shared_vega.get_by_test_id(order_size).fill("1")
|
||||
page_shared_vega.get_by_test_id(order_price).fill("0.0000001")
|
||||
expect(page_shared_vega.get_by_test_id("stop-order-error-message-price")).to_have_text(
|
||||
page.get_by_test_id(order_size).fill("1")
|
||||
page.get_by_test_id(order_price).fill("0.0000001")
|
||||
expect(page.get_by_test_id("stop-order-error-message-price")).to_have_text(
|
||||
"Price cannot be lower than 0.00001"
|
||||
)
|
||||
|
||||
@ -257,7 +257,7 @@ def test_submit_stop_limit_order_cancel(
|
||||
).to_have_text("Cancelled")
|
||||
|
||||
|
||||
""" class TestStopOcoValidation:
|
||||
class TestStopOcoValidation:
|
||||
@pytest.fixture(scope="class")
|
||||
def vega(request):
|
||||
with init_vega(request) as vega_instance:
|
||||
@ -296,4 +296,3 @@ def test_submit_stop_limit_order_cancel(
|
||||
expect(page.get_by_test_id("stop-order-warning-limit")).to_have_text(
|
||||
"There is a limit of 4 active stop orders per market. Orders submitted above the limit will be immediately rejected."
|
||||
)
|
||||
"""
|
@ -1,30 +1,39 @@
|
||||
import pytest
|
||||
from playwright.sync_api import Page, expect, Locator
|
||||
from conftest import init_page, risk_accepted_setup
|
||||
|
||||
from conftest import init_page, init_vega, cleanup_container
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def page(shared_vega, browser, request):
|
||||
with init_page(shared_vega, browser, request) as page:
|
||||
risk_accepted_setup(page)
|
||||
page.goto("/#/disclaimer")
|
||||
def vega(request):
|
||||
with init_vega(request) as vega_instance:
|
||||
request.addfinalizer(lambda: cleanup_container(vega_instance))
|
||||
yield vega_instance
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def page(vega, browser, request):
|
||||
with init_page(vega, browser, request) as page:
|
||||
yield page
|
||||
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_network_switcher(page: Page):
|
||||
page.goto("/#/disclaimer")
|
||||
navbar = page.locator('nav[aria-label="Main"]')
|
||||
assert_network_switcher(navbar)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_navbar_pages(page: Page):
|
||||
page.goto("/#/disclaimer")
|
||||
navbar = page.locator('nav[aria-label="Main"]')
|
||||
assert_links(navbar)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_navigation_mobile(page: Page):
|
||||
page.goto("/#/disclaimer")
|
||||
page.set_viewport_size({"width": 800, "height": 1040})
|
||||
navbar = page.locator('nav[aria-label="Main"]')
|
||||
|
||||
@ -99,4 +108,4 @@ def assert_network_switcher(container: Locator):
|
||||
expect(mainnet_link).to_be_visible()
|
||||
# 0006-NETW-003
|
||||
expect(mainnet_link).to_have_attribute("href", "https://console.vega.xyz")
|
||||
expect(container.get_by_role("link", name="Fairground testnet")).to_be_visible()
|
||||
expect(container.get_by_role("link", name="Fairground testnet")).to_be_visible()
|
||||
|
@ -49,7 +49,7 @@ def markets(vega: VegaServiceNull):
|
||||
price=130,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -63,7 +63,7 @@ def markets(vega: VegaServiceNull):
|
||||
price=88,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -77,7 +77,7 @@ def markets(vega: VegaServiceNull):
|
||||
price=88,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -92,7 +92,7 @@ def markets(vega: VegaServiceNull):
|
||||
wait=False,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -105,7 +105,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=100,
|
||||
price=104,
|
||||
)
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -120,7 +120,7 @@ def markets(vega: VegaServiceNull):
|
||||
expires_at=vega.get_blockchain_time() + 5 * 1e9,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -134,7 +134,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=20,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -148,7 +148,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=40,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -162,7 +162,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=60,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -177,7 +177,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=60,
|
||||
)
|
||||
|
||||
vega.forward("5s")
|
||||
vega.forward("2s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -190,7 +190,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=10,
|
||||
price=150,
|
||||
)
|
||||
vega.forward("5s")
|
||||
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -203,7 +203,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=10,
|
||||
price=160,
|
||||
)
|
||||
vega.forward("5s")
|
||||
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@ -216,7 +216,7 @@ def markets(vega: VegaServiceNull):
|
||||
volume=10,
|
||||
price=60,
|
||||
)
|
||||
vega.forward("5s")
|
||||
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
import pytest
|
||||
from playwright.sync_api import expect, Page
|
||||
from conftest import init_page, risk_accepted_setup
|
||||
from conftest import init_vega, cleanup_container
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def page(shared_vega, browser, request):
|
||||
with init_page(shared_vega, browser, request) as page:
|
||||
risk_accepted_setup(page)
|
||||
yield page
|
||||
def vega(request):
|
||||
with init_vega(request) as vega_instance:
|
||||
request.addfinalizer(lambda: cleanup_container(vega_instance))
|
||||
yield vega_instance
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_share_usage_data(page: Page):
|
||||
page.goto("/")
|
||||
page.get_by_test_id("Settings").click()
|
||||
@ -40,6 +41,7 @@ ICON_TO_TOAST = {
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_toast_positions(page: Page):
|
||||
page.goto("/")
|
||||
page.get_by_test_id("Settings").click()
|
||||
@ -50,10 +52,10 @@ def test_toast_positions(page: Page):
|
||||
expect(page.locator(f"[{toast_selector}]")).to_be_visible()
|
||||
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_dark_mode(page: Page):
|
||||
page.goto("/")
|
||||
page.get_by_test_id("Settings").click()
|
||||
expect(page.locator("html")).not_to_have_attribute("class", "dark")
|
||||
page.locator("#switch-settings-theme-switch").click()
|
||||
expect(page.locator("html")).to_have_attribute("class", "dark")
|
||||
expect(page.locator("html")).to_have_attribute("class", "dark")
|
||||
|
Loading…
Reference in New Issue
Block a user