-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(trading): margin mode selector (#5660)
Co-authored-by: Bartłomiej Głownia <[email protected]> Co-authored-by: Dariusz Majcherczyk <[email protected]>
- Loading branch information
1 parent
053775b
commit 261f32a
Showing
37 changed files
with
874 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
apps/trading/e2e/tests/deal_ticket/test_isolated_cross_margin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import pytest | ||
from playwright.sync_api import Page, expect | ||
from vega_sim.null_service import VegaServiceNull | ||
from actions.vega import submit_order | ||
from actions.utils import next_epoch, wait_for_toast_confirmation | ||
|
||
tooltip_content = "tooltip-content" | ||
leverage_input = "#leverage-input" | ||
tab_positions = "tab-positions" | ||
margin_row = '[col-id="margin"]' | ||
|
||
|
||
def create_position(vega: VegaServiceNull, market_id): | ||
submit_order(vega, "Key 1", market_id, "SIDE_SELL", 100, 110) | ||
submit_order(vega, "Key 1", market_id, "SIDE_BUY", 100, 110) | ||
vega.wait_fn(1) | ||
vega.wait_for_total_catchup | ||
|
||
|
||
@pytest.mark.usefixtures("auth", "risk_accepted") | ||
def test_switch_cross_isolated_margin( | ||
continuous_market, vega: VegaServiceNull, page: Page): | ||
create_position(vega, continuous_market) | ||
page.goto(f"/#/markets/{continuous_market}") | ||
expect(page.locator(margin_row).nth(1)).to_have_text("874.21992Cross1.0x") | ||
# tbd - tooltip is not visible without this wait | ||
page.wait_for_timeout(1000) | ||
page.get_by_test_id(tab_positions).get_by_text("Cross").hover() | ||
expect(page.get_by_test_id(tooltip_content).nth(0)).to_have_text( | ||
"Liquidation: 582.81328Margin: 874.21992General account: 998,084.95183" | ||
) | ||
page.get_by_role("button", name="Isolated 10x").click() | ||
page.locator(leverage_input).clear() | ||
page.locator(leverage_input).type("1") | ||
page.get_by_role("button", name="Confirm").click() | ||
wait_for_toast_confirmation(page) | ||
next_epoch(vega=vega) | ||
expect(page.get_by_test_id("toast-content")).to_have_text( | ||
"ConfirmedYour transaction has been confirmedView in block explorerUpdate margin modeBTC:DAI_2023Isolated margin mode, leverage: 1.0x") | ||
expect(page.locator(margin_row).nth(1) | ||
).to_have_text("11,109.99996Isolated1.0x") | ||
# tbd - tooltip is not visible without this wait | ||
page.wait_for_timeout(1000) | ||
page.get_by_test_id(tab_positions).get_by_text("Isolated").hover() | ||
expect(page.get_by_test_id(tooltip_content).nth(0)).to_have_text( | ||
"Liquidation: 583.62409Margin: 11,109.99996Order: 11,000.00" | ||
) | ||
page.get_by_role("button", name="Cross").click() | ||
page.get_by_role("button", name="Confirm").click() | ||
wait_for_toast_confirmation(page) | ||
next_epoch(vega=vega) | ||
expect(page.locator(margin_row).nth(1)).to_have_text( | ||
"22,109.99996Cross1.0x") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.