chore(trading): migrate LP cypress tests (#5286)
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
This commit is contained in:
parent
11317cdb2e
commit
65ad4fffda
@ -1,311 +0,0 @@
|
|||||||
import { checkSorting } from '@vegaprotocol/cypress';
|
|
||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
const liquidityTab = 'Liquidity';
|
|
||||||
const rowSelector =
|
|
||||||
'[data-testid="tab-liquidity"] .ag-center-cols-container .ag-row';
|
|
||||||
const rowSelectorLiquidityActive =
|
|
||||||
'[data-testid="tab-active"] .ag-center-cols-container .ag-row';
|
|
||||||
const rowSelectorLiquidityInactive =
|
|
||||||
'[data-testid="tab-inactive"] .ag-center-cols-container .ag-row';
|
|
||||||
const marketSummaryBlock = 'header-summary';
|
|
||||||
const itemValue = 'item-value';
|
|
||||||
const itemHeader = 'item-header';
|
|
||||||
const colCommitmentAmount = '[col-id="commitmentAmount"]';
|
|
||||||
const colEquityLikeShare = '[col-id="feeShare.equityLikeShare"]';
|
|
||||||
const colFee = '[col-id="fee"]';
|
|
||||||
const colCommitmentAmount_1 = '[col-id="commitmentAmount_1"]';
|
|
||||||
const colBalance = '[col-id="balance"]';
|
|
||||||
const colStatus = '[col-id="status"]';
|
|
||||||
const colCreatedAt = '[col-id="createdAt"] button';
|
|
||||||
const colUpdatedAt = '[col-id="updatedAt"] button';
|
|
||||||
|
|
||||||
const headers = [
|
|
||||||
'Party',
|
|
||||||
'Status',
|
|
||||||
'Commitment (tDAI)',
|
|
||||||
'Obligation',
|
|
||||||
'Fee',
|
|
||||||
'Adjusted stake share',
|
|
||||||
'Share',
|
|
||||||
'Live supplied liquidity',
|
|
||||||
'Fees accrued this epoch',
|
|
||||||
'Live time on book',
|
|
||||||
'Live liquidity quality score (%)',
|
|
||||||
'Last time on the book',
|
|
||||||
'Last fee penalty',
|
|
||||||
'Last bond penalty',
|
|
||||||
'Created',
|
|
||||||
'Updated',
|
|
||||||
];
|
|
||||||
|
|
||||||
describe('liquidity table - trading', { tags: '@smoke' }, () => {
|
|
||||||
before(() => {
|
|
||||||
cy.setOnBoardingViewed();
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.mockTradingPage(
|
|
||||||
Schema.MarketState.STATE_ACTIVE,
|
|
||||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
|
||||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
|
||||||
);
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@MarketData');
|
|
||||||
cy.getByTestId(liquidityTab).click();
|
|
||||||
cy.wait('@LiquidityProvisions');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see table headers', () => {
|
|
||||||
// 5002-LIQP-001
|
|
||||||
cy.getByTestId('tab-liquidity').within(($headers) => {
|
|
||||||
cy.wrap($headers)
|
|
||||||
.get('.ag-header-cell-text')
|
|
||||||
.each(($header, i) => {
|
|
||||||
cy.wrap($header).should('have.text', headers[i]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders liquidity table correctly', () => {
|
|
||||||
// 5002-LIQP-002
|
|
||||||
cy.get(rowSelector)
|
|
||||||
.first()
|
|
||||||
.find('[col-id="partyId"]')
|
|
||||||
.should('have.text', '69464e…dc6f');
|
|
||||||
|
|
||||||
cy.get(rowSelector)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelector)
|
|
||||||
.first()
|
|
||||||
.find(colEquityLikeShare)
|
|
||||||
.should('have.text', '100.00%');
|
|
||||||
|
|
||||||
cy.get(rowSelector).first().find(colFee).should('have.text', '0.09%');
|
|
||||||
|
|
||||||
cy.get(rowSelector)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount_1)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelector)
|
|
||||||
.first()
|
|
||||||
.find(colBalance)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelector).first().find(colStatus).should('have.text', 'Active');
|
|
||||||
|
|
||||||
cy.get(rowSelector).first().find(colCreatedAt).should('not.be.empty');
|
|
||||||
cy.get(rowSelector).first().find(colUpdatedAt).should('not.be.empty');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('liquidity status column should be sorted properly', () => {
|
|
||||||
// 5002-LIQP-003
|
|
||||||
const liquidityColDefault = ['Active', 'Pending'];
|
|
||||||
const liquidityColAsc = ['Active', 'Pending'];
|
|
||||||
const liquidityColDesc = ['Pending', 'Active'];
|
|
||||||
checkSorting(
|
|
||||||
'status',
|
|
||||||
liquidityColDefault,
|
|
||||||
liquidityColAsc,
|
|
||||||
liquidityColDesc
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('liquidity table view', { tags: '@smoke' }, () => {
|
|
||||||
before(() => {
|
|
||||||
cy.setOnBoardingViewed();
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.mockTradingPage(
|
|
||||||
Schema.MarketState.STATE_ACTIVE,
|
|
||||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
|
||||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
|
||||||
);
|
|
||||||
cy.visit('/#/liquidity/market-0');
|
|
||||||
cy.wait('@LiquidityProvisions');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see header title', () => {
|
|
||||||
// 5002-LIQP-004
|
|
||||||
// 5002-LIQP-005
|
|
||||||
cy.getByTestId('header-title').should(
|
|
||||||
'contain.text',
|
|
||||||
'BTCUSD.MF21 liquidity provision'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see target stake', () => {
|
|
||||||
// 5002-LIQP-006
|
|
||||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
|
||||||
cy.getByTestId('target-stake').within(() => {
|
|
||||||
cy.getByTestId(itemHeader).should('have.text', 'Target stake');
|
|
||||||
cy.getByTestId(itemValue).should('have.text', '10.00 tDAI').realHover();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
cy.getByTestId('tooltip-content').should(
|
|
||||||
'contain.text',
|
|
||||||
`The market's liquidity requirement which is derived from the maximum open interest observed over a rolling time window.The market's liquidity requirement which is derived from the maximum open interest observed over a rolling time window.`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see supplied stake', () => {
|
|
||||||
// 5002-LIQP-007
|
|
||||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
|
||||||
cy.getByTestId('supplied-stake').within(() => {
|
|
||||||
cy.getByTestId(itemHeader).should('have.text', 'Supplied stake');
|
|
||||||
cy.getByTestId(itemValue).should('have.text', '0.01 tDAI').realHover();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
cy.getByTestId('tooltip-content').should(
|
|
||||||
'contain.text',
|
|
||||||
'The current amount of liquidity supplied for this market.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see liquidity supplied', () => {
|
|
||||||
// 5002-LIQP-008
|
|
||||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
|
||||||
cy.getByTestId('liquidity-supplied').within(() => {
|
|
||||||
cy.getByTestId(itemHeader).should('have.text', 'Liquidity supplied');
|
|
||||||
cy.getByTestId('indicator').should('be.visible');
|
|
||||||
cy.getByTestId(itemValue).should('have.text', ' 0.10%').realHover();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see market id', () => {
|
|
||||||
// 5002-LIQP-009
|
|
||||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
|
||||||
cy.getByTestId('liquidity-market-id').within(() => {
|
|
||||||
cy.getByTestId(itemHeader).should('have.text', 'Market ID');
|
|
||||||
cy.getByTestId(itemValue).should('have.text', 'market-0');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can see market id', () => {
|
|
||||||
// 5002-LIQP-010
|
|
||||||
cy.getByTestId(marketSummaryBlock).within(() => {
|
|
||||||
cy.getByTestId('liquidity-learn-more').within(() => {
|
|
||||||
cy.getByTestId(itemHeader).should('have.text', 'Learn more');
|
|
||||||
cy.getByTestId(itemValue).should('have.text', 'Providing liquidity');
|
|
||||||
cy.getByTestId('external-link')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and(
|
|
||||||
'include',
|
|
||||||
'https://docs.vega.xyz/testnet/concepts/liquidity/provision'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('liquidity table view', { tags: '@smoke' }, () => {
|
|
||||||
it('can see table headers', () => {
|
|
||||||
cy.getByTestId('tab-active').within(($headers) => {
|
|
||||||
cy.wrap($headers)
|
|
||||||
.get('.ag-header-cell-text')
|
|
||||||
.each(($header, i) => {
|
|
||||||
cy.wrap($header).should('have.text', headers[i]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders liquidity active table correctly', () => {
|
|
||||||
// 5002-LIQP-011
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find('[col-id="partyId"]')
|
|
||||||
.should('have.text', '69464e…dc6f');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colEquityLikeShare)
|
|
||||||
.should('have.text', '100.00%');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colFee)
|
|
||||||
.should('have.text', '0.09%');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount_1)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colBalance)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colStatus)
|
|
||||||
.should('have.text', 'Active');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colCreatedAt)
|
|
||||||
.should('not.be.empty');
|
|
||||||
cy.get(rowSelectorLiquidityActive)
|
|
||||||
.first()
|
|
||||||
.find(colUpdatedAt)
|
|
||||||
.should('not.be.empty');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders liquidity inactive table correctly', () => {
|
|
||||||
// 5002-LIQP-012
|
|
||||||
cy.getByTestId('Inactive').click();
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find('[col-id="partyId"]')
|
|
||||||
.should('have.text', 'cc464e…dc6f');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colEquityLikeShare)
|
|
||||||
.should('have.text', '100.00%');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colFee)
|
|
||||||
.should('have.text', '0.40%');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colCommitmentAmount_1)
|
|
||||||
.should('have.text', '4,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colBalance)
|
|
||||||
.should('have.text', '2,000.00');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colStatus)
|
|
||||||
.should('have.text', 'Pending');
|
|
||||||
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colCreatedAt)
|
|
||||||
.should('not.be.empty');
|
|
||||||
cy.get(rowSelectorLiquidityInactive)
|
|
||||||
.first()
|
|
||||||
.find(colUpdatedAt)
|
|
||||||
.should('not.be.empty');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -34,4 +34,14 @@ def next_epoch(vega: VegaServiceNull):
|
|||||||
"Epoch not started after forwarding the duration of two epochs."
|
"Epoch not started after forwarding the duration of two epochs."
|
||||||
)
|
)
|
||||||
vega.wait_fn(1)
|
vega.wait_fn(1)
|
||||||
vega.wait_for_total_catchup()
|
vega.wait_for_total_catchup()
|
||||||
|
|
||||||
|
def truncate_middle(market_id, start=6, end=4):
|
||||||
|
if len(market_id) < 11:
|
||||||
|
return market_id
|
||||||
|
return market_id[:start] + '\u2026' + market_id[-end:]
|
||||||
|
|
||||||
|
def change_keys(page: Page, vega:VegaServiceNull, key_name):
|
||||||
|
page.get_by_test_id("manage-vega-wallet").click()
|
||||||
|
page.get_by_test_id("key-" + vega.wallet.public_key(key_name)).click()
|
||||||
|
page.reload()
|
||||||
|
@ -1,26 +1,13 @@
|
|||||||
from collections import namedtuple
|
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_multiple_orders, submit_order, submit_liquidity
|
from actions.vega import submit_multiple_orders, submit_order, submit_liquidity
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2, TERMINATE_WALLET, wallets
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
mint_amount: float = 10e5
|
mint_amount: float = 10e5
|
||||||
market_name = "BTC:DAI_2023"
|
market_name = "BTC:DAI_2023"
|
||||||
|
|
||||||
|
|
||||||
def setup_simple_market(
|
def setup_simple_market(
|
||||||
vega: VegaService,
|
vega: VegaService,
|
||||||
approve_proposal=True,
|
approve_proposal=True,
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
from actions.utils import wait_for_toast_confirmation
|
from actions.utils import wait_for_toast_confirmation
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
|
|
||||||
notional = "deal-ticket-fee-notional"
|
notional = "deal-ticket-fee-notional"
|
||||||
fees = "deal-ticket-fee-fees"
|
fees = "deal-ticket-fee-fees"
|
||||||
margin_required = "deal-ticket-fee-margin-required"
|
margin_required = "deal-ticket-fee-margin-required"
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
@ -7,14 +6,6 @@ from datetime import datetime, timedelta
|
|||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_continuous_market
|
from fixtures.market import setup_continuous_market
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
stop_order_btn = "order-type-Stop"
|
stop_order_btn = "order-type-Stop"
|
||||||
stop_limit_order_btn = "order-type-StopLimit"
|
stop_limit_order_btn = "order-type-StopLimit"
|
||||||
stop_market_order_btn = "order-type-StopMarket"
|
stop_market_order_btn = "order-type-StopMarket"
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_continuous_market
|
from fixtures.market import setup_continuous_market
|
||||||
from actions.utils import wait_for_toast_confirmation
|
from actions.utils import wait_for_toast_confirmation
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2, TERMINATE_WALLET, wallets
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
stop_order_btn = "order-type-Stop"
|
stop_order_btn = "order-type-Stop"
|
||||||
stop_limit_order_btn = "order-type-StopLimit"
|
stop_limit_order_btn = "order-type-StopLimit"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.utils import wait_for_toast_confirmation
|
from actions.utils import change_keys
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_continuous_market
|
from fixtures.market import setup_continuous_market
|
||||||
|
|
||||||
@ -39,9 +39,7 @@ def test_should_display_info_and_button_for_deposit(continuous_market, vega: Veg
|
|||||||
def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: VegaService, page: Page):
|
def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: VegaService, page: Page):
|
||||||
page.goto(f"/#/markets/{continuous_market}")
|
page.goto(f"/#/markets/{continuous_market}")
|
||||||
vega.create_key("key_empty")
|
vega.create_key("key_empty")
|
||||||
page.get_by_test_id("manage-vega-wallet").click()
|
change_keys(page, vega, "key_empty")
|
||||||
page.locator('[role="menuitemradio"]').nth(4).click()
|
|
||||||
page.reload()
|
|
||||||
page.get_by_test_id(order_size).fill("200")
|
page.get_by_test_id(order_size).fill("200")
|
||||||
page.get_by_test_id(order_price).fill("20")
|
page.get_by_test_id(order_price).fill("20")
|
||||||
# 7002-SORD-060
|
# 7002-SORD-060
|
||||||
|
@ -4,8 +4,8 @@ import json
|
|||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from fixtures.market import setup_simple_market
|
from fixtures.market import setup_simple_market
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from collections import namedtuple
|
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
|
from wallet_config import MM_WALLET, TERMINATE_WALLET, wallets
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
@ -74,16 +74,6 @@ class TestGetStarted:
|
|||||||
|
|
||||||
page.reload()
|
page.reload()
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
mint_amount: float = 10e5
|
mint_amount: float = 10e5
|
||||||
|
|
||||||
for wallet in wallets:
|
for wallet in wallets:
|
||||||
|
@ -1,22 +1,10 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import expect, Page
|
from playwright.sync_api import expect, Page
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_continuous_market
|
from fixtures.market import setup_continuous_market
|
||||||
|
from wallet_config import MM_WALLET2
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
|
|
||||||
def hover_and_assert_tooltip(page: Page, element_text):
|
def hover_and_assert_tooltip(page: Page, element_text):
|
||||||
element = page.get_by_text(element_text)
|
element = page.get_by_text(element_text)
|
||||||
|
@ -3,7 +3,8 @@ from playwright.sync_api import Page, expect
|
|||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_continuous_market
|
from fixtures.market import setup_continuous_market
|
||||||
from actions.utils import next_epoch
|
from actions.utils import next_epoch, truncate_middle, change_keys
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def vega(request):
|
def vega(request):
|
||||||
@ -20,19 +21,28 @@ def continuous_market(vega):
|
|||||||
def test_liquidity_provision_amendment(continuous_market, vega: VegaService, page: Page):
|
def test_liquidity_provision_amendment(continuous_market, vega: VegaService, page: Page):
|
||||||
# TODO Refactor asserting the grid
|
# TODO Refactor asserting the grid
|
||||||
page.goto(f"/#/liquidity/{continuous_market}")
|
page.goto(f"/#/liquidity/{continuous_market}")
|
||||||
page.get_by_test_id("manage-vega-wallet").click()
|
change_keys(page, vega, "market_maker")
|
||||||
#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
|
row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first
|
||||||
expect(row).to_contain_text(
|
expect(row).to_contain_text(
|
||||||
"Active"
|
"Active"
|
||||||
)
|
)
|
||||||
|
# 5002-LIQP-006
|
||||||
|
expect(page.get_by_test_id("target-stake")).to_have_text("Target stake5.82757 tDAI")
|
||||||
|
# 5002-LIQP-007
|
||||||
|
expect(page.get_by_test_id("supplied-stake")).to_have_text("Supplied stake10,000.00 tDAI")
|
||||||
|
# 5002-LIQP-008
|
||||||
|
expect(page.get_by_test_id("liquidity-supplied")).to_have_text("Liquidity supplied 171,598.11%")
|
||||||
|
expect(page.get_by_test_id("fees-paid")).to_have_text("Fees paid-")
|
||||||
|
# 5002-LIQP-009
|
||||||
|
expect(page.get_by_test_id("liquidity-market-id")).to_have_text("Market ID" + truncate_middle(continuous_market))
|
||||||
|
expect(page.get_by_test_id("liquidity-learn-more")).to_have_text("Learn moreProviding liquidity")
|
||||||
|
# 002-LIQP-010
|
||||||
|
expect(page.get_by_test_id("liquidity-learn-more").get_by_test_id("external-link")).to_have_attribute("href", "https://docs.vega.xyz/testnet/concepts/liquidity/provision")
|
||||||
|
|
||||||
vega.submit_simple_liquidity(
|
vega.submit_simple_liquidity(
|
||||||
key_name="mm",
|
key_name="market_maker",
|
||||||
market_id=continuous_market,
|
market_id=continuous_market,
|
||||||
commitment_amount=100,
|
commitment_amount=1,
|
||||||
fee=0.001,
|
fee=0.001,
|
||||||
is_amendment=True,
|
is_amendment=True,
|
||||||
)
|
)
|
||||||
@ -46,7 +56,30 @@ def test_liquidity_provision_amendment(continuous_market, vega: VegaService, pag
|
|||||||
)
|
)
|
||||||
next_epoch(vega=vega)
|
next_epoch(vega=vega)
|
||||||
page.reload()
|
page.reload()
|
||||||
|
expect(page.get_by_test_id("supplied-stake")).to_have_text("Supplied stake1.00001 tDAI")
|
||||||
|
expect(page.get_by_test_id("liquidity-supplied")).to_have_text("Liquidity supplied 17.16%")
|
||||||
row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first
|
row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first
|
||||||
expect(row).to_contain_text(
|
expect(row).to_contain_text(
|
||||||
"Active"
|
"Active"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@pytest.mark.skip("Waiting for the ability to cancel LP")
|
||||||
|
@pytest.mark.usefixtures("page", "auth", "risk_accepted")
|
||||||
|
def test_liquidity_provision_inactive(continuous_market, vega: VegaService, page: Page):
|
||||||
|
# TODO Refactor asserting the grid
|
||||||
|
page.goto(f"/#/liquidity/{continuous_market}")
|
||||||
|
change_keys(page,vega, "market_maker")
|
||||||
|
row = page.get_by_test_id("tab-myLP").locator(".ag-center-cols-container .ag-row").first
|
||||||
|
expect(row).to_contain_text(
|
||||||
|
"Active"
|
||||||
|
)
|
||||||
|
vega.submit_simple_liquidity(
|
||||||
|
key_name="market_maker",
|
||||||
|
market_id=continuous_market,
|
||||||
|
commitment_amount=0,
|
||||||
|
fee=0,
|
||||||
|
is_amendment=False,
|
||||||
|
)
|
||||||
|
vega.wait_fn(1)
|
||||||
|
vega.wait_for_total_catchup()
|
||||||
|
|
@ -1,23 +1,12 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService, PeggedOrder
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
table_row_selector = (
|
table_row_selector = (
|
||||||
'[data-testid="tab-open-markets"] .ag-center-cols-container .ag-row'
|
'[data-testid="tab-open-markets"] .ag-center-cols-container .ag-row'
|
||||||
)
|
)
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
from math import exp
|
|
||||||
import pytest
|
import pytest
|
||||||
import vega_sim.api.governance as governance
|
import vega_sim.api.governance as governance
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
|
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_simple_market
|
from fixtures.market import setup_simple_market
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2, TERMINATE_WALLET, wallets
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
row_selector = '[data-testid="tab-proposed-markets"] .ag-center-cols-container .ag-row'
|
row_selector = '[data-testid="tab-proposed-markets"] .ag-center-cols-container .ag-row'
|
||||||
col_market_id = '[col-id="market"] [data-testid="stack-cell-primary"]'
|
col_market_id = '[col-id="market"] [data-testid="stack-cell-primary"]'
|
||||||
@ -29,7 +16,6 @@ def vega(request):
|
|||||||
with init_vega(request) as vega:
|
with init_vega(request) as vega:
|
||||||
yield vega
|
yield vega
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def proposed_market(vega: VegaService):
|
def proposed_market(vega: VegaService):
|
||||||
# setup market without liquidity provided
|
# setup market without liquidity provided
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
from fixtures.market import setup_simple_market
|
from fixtures.market import setup_simple_market
|
||||||
from conftest import init_vega
|
from conftest import init_vega
|
||||||
|
|
||||||
from actions.utils import wait_for_toast_confirmation
|
from actions.utils import wait_for_toast_confirmation
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET]
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def vega(request):
|
def vega(request):
|
||||||
|
@ -1,27 +1,11 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import vega_sim.api.governance as governance
|
import vega_sim.api.governance as governance
|
||||||
import re
|
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService, PeggedOrder
|
from vega_sim.service import VegaService, PeggedOrder
|
||||||
import vega_sim.proto.vega as vega_protos
|
|
||||||
import vega_sim.api.governance as governance
|
import vega_sim.api.governance as governance
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
from fixtures.market import setup_continuous_market
|
from wallet_config import MM_WALLET, MM_WALLET2, GOVERNANCE_WALLET
|
||||||
from datetime import datetime
|
|
||||||
from datetime import timedelta
|
|
||||||
from vega_sim.service import MarketStateUpdateType
|
|
||||||
|
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
GOVERNANCE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
|
||||||
|
|
||||||
wallets = [MM_WALLET, MM_WALLET2, GOVERNANCE_WALLET]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("vega", "page", "proposed_market", "risk_accepted")
|
@pytest.mark.usefixtures("vega", "page", "proposed_market", "risk_accepted")
|
||||||
@ -135,7 +119,7 @@ def test_market_closing_banners(page: Page, continuous_market, vega: VegaService
|
|||||||
page.goto(f"/#/markets/{market_id}")
|
page.goto(f"/#/markets/{market_id}")
|
||||||
proposalID = vega.update_market_state(
|
proposalID = vega.update_market_state(
|
||||||
continuous_market,
|
continuous_market,
|
||||||
"mm",
|
"market_maker",
|
||||||
MarketStateUpdateType.Terminate,
|
MarketStateUpdateType.Terminate,
|
||||||
approve_proposal=False,
|
approve_proposal=False,
|
||||||
vote_enactment_time = datetime.now() + timedelta(weeks=1),
|
vote_enactment_time = datetime.now() + timedelta(weeks=1),
|
||||||
@ -148,7 +132,7 @@ def test_market_closing_banners(page: Page, continuous_market, vega: VegaService
|
|||||||
|
|
||||||
vega.update_market_state(
|
vega.update_market_state(
|
||||||
continuous_market,
|
continuous_market,
|
||||||
"mm",
|
"market_maker",
|
||||||
MarketStateUpdateType.Terminate,
|
MarketStateUpdateType.Terminate,
|
||||||
approve_proposal=False,
|
approve_proposal=False,
|
||||||
vote_enactment_time = datetime.now() + timedelta(weeks=1),
|
vote_enactment_time = datetime.now() + timedelta(weeks=1),
|
||||||
@ -161,7 +145,7 @@ def test_market_closing_banners(page: Page, continuous_market, vega: VegaService
|
|||||||
governance.approve_proposal(
|
governance.approve_proposal(
|
||||||
proposal_id=proposalID,
|
proposal_id=proposalID,
|
||||||
wallet=vega.wallet,
|
wallet=vega.wallet,
|
||||||
key_name="mm"
|
key_name="market_maker"
|
||||||
|
|
||||||
)
|
)
|
||||||
vega.forward("60s")
|
vega.forward("60s")
|
||||||
|
@ -1,19 +1,10 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from collections import namedtuple
|
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
|
||||||
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
|
from conftest import init_vega
|
||||||
from fixtures.market import setup_simple_market
|
from fixtures.market import setup_simple_market
|
||||||
|
from wallet_config import MM_WALLET, MM_WALLET2
|
||||||
# Defined namedtuples
|
|
||||||
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
|
||||||
|
|
||||||
# Wallet Configurations
|
|
||||||
MM_WALLET = WalletConfig("mm", "pin")
|
|
||||||
MM_WALLET2 = WalletConfig("mm2", "pin2")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def vega():
|
def vega():
|
||||||
|
@ -2,6 +2,7 @@ import pytest
|
|||||||
from playwright.sync_api import Page
|
from playwright.sync_api import Page
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.vega import submit_order
|
from actions.vega import submit_order
|
||||||
|
from actions.utils import change_keys
|
||||||
|
|
||||||
def check_pnl_color_value(element, expected_color, expected_value):
|
def check_pnl_color_value(element, expected_color, expected_value):
|
||||||
color = element.evaluate("element => getComputedStyle(element).color")
|
color = element.evaluate("element => getComputedStyle(element).color")
|
||||||
@ -29,18 +30,16 @@ def test_pnl(continuous_market, vega: VegaService, page: Page):
|
|||||||
check_pnl_color_value(unrealised_pnl, "rgb(236, 0, 60)", "-4.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(236, 0, 60)", "-4.00")
|
||||||
|
|
||||||
# profit Trading unrealised
|
# profit Trading unrealised
|
||||||
page.get_by_test_id("manage-vega-wallet").click()
|
change_keys(page, vega, "market_maker")
|
||||||
page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(1).click(position={ "x": 0, "y": 0}, force=True)
|
|
||||||
check_pnl_color_value(realised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(realised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
check_pnl_color_value(unrealised_pnl, "rgb(1, 145, 75)", "4.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(1, 145, 75)", "4.00")
|
||||||
|
|
||||||
# neutral Trading unrealised
|
# neutral Trading unrealised
|
||||||
page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(2).click(position={ "x": 0, "y": 0}, force=True)
|
change_keys(page, vega, "market_maker_2")
|
||||||
check_pnl_color_value(realised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(realised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
|
|
||||||
# Portfolio Unrealised
|
# Portfolio Unrealised
|
||||||
page.get_by_test_id("manage-vega-wallet").click(force=True)
|
|
||||||
page.get_by_role("link", name="Portfolio").click()
|
page.get_by_role("link", name="Portfolio").click()
|
||||||
page.get_by_test_id("Positions").click()
|
page.get_by_test_id("Positions").click()
|
||||||
page.wait_for_selector(
|
page.wait_for_selector(
|
||||||
@ -52,10 +51,10 @@ def test_pnl(continuous_market, vega: VegaService, page: Page):
|
|||||||
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="Key 1"]]'
|
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="Key 1"]]'
|
||||||
)
|
)
|
||||||
key_mm = page.query_selector(
|
key_mm = page.query_selector(
|
||||||
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="mm"]]'
|
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="market_maker"]]'
|
||||||
)
|
)
|
||||||
key_mm2 = page.query_selector(
|
key_mm2 = page.query_selector(
|
||||||
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="mm2"]]'
|
'//div[@role="row" and .//div[@col-id="partyId"]/div/span[text()="market_maker_2"]]'
|
||||||
)
|
)
|
||||||
|
|
||||||
key_1_unrealised_pnl = key_1.query_selector('xpath=./div[@col-id="unrealisedPNL"]')
|
key_1_unrealised_pnl = key_1.query_selector('xpath=./div[@col-id="unrealisedPNL"]')
|
||||||
@ -101,12 +100,11 @@ def test_pnl(continuous_market, vega: VegaService, page: Page):
|
|||||||
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
|
|
||||||
# profit trading realised
|
# profit trading realised
|
||||||
page.get_by_test_id("manage-vega-wallet").click()
|
change_keys(page, vega, "market_maker")
|
||||||
page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(1).click(position={ "x": 0, "y": 0}, force=True)
|
|
||||||
check_pnl_color_value(realised_pnl, "rgb(1, 145, 75)", "8.00")
|
check_pnl_color_value(realised_pnl, "rgb(1, 145, 75)", "8.00")
|
||||||
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
|
|
||||||
# loss trading realised
|
# loss trading realised
|
||||||
page.locator('[role="menuitemradio"] >> .mr-2.uppercase').nth(0).click(position={ "x": 0, "y": 0}, force=True)
|
change_keys(page, vega, "Key 1")
|
||||||
check_pnl_color_value(realised_pnl, "rgb(236, 0, 60)", "-8.00")
|
check_pnl_color_value(realised_pnl, "rgb(236, 0, 60)", "-8.00")
|
||||||
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
check_pnl_color_value(unrealised_pnl, "rgb(0, 0, 0)", "0.00")
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
# page.goto(f"/#/markets/{continuous_market}")
|
# page.goto(f"/#/markets/{continuous_market}")
|
||||||
# vega.forward("24h")
|
# vega.forward("24h")
|
||||||
# vega.wait_for_total_catchup()
|
# vega.wait_for_total_catchup()
|
||||||
# submit_order(vega, "mm", continuous_market, "SIDE_SELL", 1, 101.50000)
|
# submit_order(vega, "market_maker", continuous_market, "SIDE_SELL", 1, 101.50000)
|
||||||
# submit_order(vega, "mm2", continuous_market, "SIDE_SELL", 1, 101.50000)
|
# submit_order(vega, "market_maker_2", continuous_market, "SIDE_SELL", 1, 101.50000)
|
||||||
# vega.forward("10s")
|
# vega.forward("10s")
|
||||||
# vega.wait_for_total_catchup()
|
# vega.wait_for_total_catchup()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import pytest
|
|||||||
import re
|
import re
|
||||||
from playwright.sync_api import Page, expect
|
from playwright.sync_api import Page, expect
|
||||||
from vega_sim.service import VegaService
|
from vega_sim.service import VegaService
|
||||||
from actions.utils import wait_for_toast_confirmation, create_and_faucet_wallet, WalletConfig, next_epoch
|
from actions.utils import wait_for_toast_confirmation, create_and_faucet_wallet, WalletConfig, next_epoch, change_keys
|
||||||
import vega_sim.proto.vega as vega_protos
|
import vega_sim.proto.vega as vega_protos
|
||||||
|
|
||||||
LIQ = WalletConfig("liq", "liq")
|
LIQ = WalletConfig("liq", "liq")
|
||||||
@ -50,7 +50,7 @@ def test_transfer_submit(continuous_market, vega: VegaService, page: Page):
|
|||||||
@pytest.mark.usefixtures("page", "auth", "risk_accepted")
|
@pytest.mark.usefixtures("page", "auth", "risk_accepted")
|
||||||
def test_transfer_vesting_below_minimum(continuous_market, vega: VegaService, page: Page):
|
def test_transfer_vesting_below_minimum(continuous_market, vega: VegaService, page: Page):
|
||||||
vega.update_network_parameter(
|
vega.update_network_parameter(
|
||||||
"mm", parameter="transfer.minTransferQuantumMultiple", new_value="100000"
|
"market_maker", parameter="transfer.minTransferQuantumMultiple", new_value="100000"
|
||||||
)
|
)
|
||||||
vega.wait_for_total_catchup()
|
vega.wait_for_total_catchup()
|
||||||
|
|
||||||
@ -97,9 +97,7 @@ def test_transfer_vesting_below_minimum(continuous_market, vega: VegaService, pa
|
|||||||
page.goto('/#/portfolio')
|
page.goto('/#/portfolio')
|
||||||
expect(page.get_by_test_id('transfer-form')).to_be_visible
|
expect(page.get_by_test_id('transfer-form')).to_be_visible
|
||||||
|
|
||||||
page.get_by_test_id("manage-vega-wallet").click()
|
change_keys(page, vega, "party_b")
|
||||||
page.locator('[role="menuitemradio"]').nth(5).click()
|
|
||||||
page.reload()
|
|
||||||
page.get_by_test_id('select-asset').click()
|
page.get_by_test_id('select-asset').click()
|
||||||
page.get_by_test_id('rich-select-option').click()
|
page.get_by_test_id('rich-select-option').click()
|
||||||
|
|
||||||
|
12
apps/trading/e2e/wallet_config.py
Normal file
12
apps/trading/e2e/wallet_config.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
# Defined namedtuples
|
||||||
|
WalletConfig = namedtuple("WalletConfig", ["name", "passphrase"])
|
||||||
|
|
||||||
|
# Wallet Configurations
|
||||||
|
MM_WALLET = WalletConfig("market_maker", "pin")
|
||||||
|
MM_WALLET2 = WalletConfig("market_maker_2", "pin2")
|
||||||
|
TERMINATE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
||||||
|
GOVERNANCE_WALLET = WalletConfig("FJMKnwfZdd48C8NqvYrG", "bY3DxwtsCstMIIZdNpKs")
|
||||||
|
|
||||||
|
wallets = [MM_WALLET, MM_WALLET2, TERMINATE_WALLET, GOVERNANCE_WALLET]
|
@ -1,24 +1,60 @@
|
|||||||
import LiquidityTable from './liquidity-table';
|
import LiquidityTable from './liquidity-table';
|
||||||
import { act, render, screen } from '@testing-library/react';
|
import { act, render, screen, within } from '@testing-library/react';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { LiquidityProvisionData } from './liquidity-data-provider';
|
import type { LiquidityProvisionData } from './liquidity-data-provider';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
|
||||||
const singleRow = {
|
const partyId1 = 'party1';
|
||||||
party: 'a3f762f0a6e998e1d0c6e73017a13ec8a22386c30f7f64a1bdca47330bc592dd',
|
const partyId2 = 'party2';
|
||||||
|
|
||||||
|
const singleRow: LiquidityProvisionData = {
|
||||||
|
id: 'lp-single',
|
||||||
|
commitmentMinTimeFraction: '100',
|
||||||
|
performanceHysteresisEpochs: 4,
|
||||||
|
priceRange: '1',
|
||||||
|
slaCompetitionFactor: '1',
|
||||||
|
partyId: partyId1,
|
||||||
|
party: {
|
||||||
|
id: partyId1,
|
||||||
|
},
|
||||||
createdAt: '2022-08-19T17:18:36.257028Z',
|
createdAt: '2022-08-19T17:18:36.257028Z',
|
||||||
updatedAt: '2022-08-19T17:18:36.257028Z',
|
updatedAt: '2022-08-19T17:18:36.257028Z',
|
||||||
commitmentAmount: '56298653179',
|
commitmentAmount: '100',
|
||||||
fee: '0.001',
|
fee: '0.001',
|
||||||
status: Schema.LiquidityProvisionStatus.STATUS_ACTIVE,
|
status: Schema.LiquidityProvisionStatus.STATUS_ACTIVE,
|
||||||
feeShare: {
|
feeShare: {
|
||||||
equityLikeShare: '0.5',
|
equityLikeShare: '0.5',
|
||||||
averageEntryValuation: '0.5',
|
averageEntryValuation: '0.5',
|
||||||
|
virtualStake: '0.5',
|
||||||
|
averageScore: '0.5',
|
||||||
},
|
},
|
||||||
supplied: '67895',
|
};
|
||||||
obligation: '56785',
|
|
||||||
} as unknown as LiquidityProvisionData;
|
const multiRow: LiquidityProvisionData = {
|
||||||
|
id: 'lp-multi',
|
||||||
|
commitmentMinTimeFraction: '100',
|
||||||
|
performanceHysteresisEpochs: 4,
|
||||||
|
priceRange: '1',
|
||||||
|
slaCompetitionFactor: '1',
|
||||||
|
partyId: partyId2,
|
||||||
|
party: {
|
||||||
|
id: partyId2,
|
||||||
|
},
|
||||||
|
createdAt: '2022-08-19T17:18:37.257028Z',
|
||||||
|
updatedAt: '2022-08-19T17:18:37.257028Z',
|
||||||
|
commitmentAmount: '200',
|
||||||
|
fee: '0.002',
|
||||||
|
status: Schema.LiquidityProvisionStatus.STATUS_ACTIVE,
|
||||||
|
feeShare: {
|
||||||
|
equityLikeShare: '0.5',
|
||||||
|
averageEntryValuation: '0.5',
|
||||||
|
virtualStake: '0.5',
|
||||||
|
averageScore: '0.5',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const singleRowData = [singleRow];
|
const singleRowData = [singleRow];
|
||||||
|
const multiRowData = [singleRow, multiRow];
|
||||||
|
|
||||||
describe('LiquidityTable', () => {
|
describe('LiquidityTable', () => {
|
||||||
it('should render successfully', async () => {
|
it('should render successfully', async () => {
|
||||||
@ -26,6 +62,10 @@ describe('LiquidityTable', () => {
|
|||||||
const { baseElement } = render(
|
const { baseElement } = render(
|
||||||
<LiquidityTable rowData={[]} stakeToCcyVolume={'1'} />
|
<LiquidityTable rowData={[]} stakeToCcyVolume={'1'} />
|
||||||
);
|
);
|
||||||
|
// 5002-LIQP-002
|
||||||
|
// 5002-LIQP-004
|
||||||
|
// 5002-LIQP-005
|
||||||
|
// 5002-LIQP-011
|
||||||
expect(baseElement).toBeTruthy();
|
expect(baseElement).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -65,7 +105,30 @@ describe('LiquidityTable', () => {
|
|||||||
'Created',
|
'Created',
|
||||||
'Updated',
|
'Updated',
|
||||||
];
|
];
|
||||||
|
// 5002-LIQP-001
|
||||||
expect(headers).toHaveLength(expectedHeaders.length);
|
expect(headers).toHaveLength(expectedHeaders.length);
|
||||||
expect(headerTexts).toEqual(expectedHeaders);
|
expect(headerTexts).toEqual(expectedHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to sort', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
render(
|
||||||
|
<LiquidityTable rowData={multiRowData} stakeToCcyVolume={'0.3'} />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const headers = await screen.findAllByRole('columnheader');
|
||||||
|
|
||||||
|
const commitmentHeader = headers.find(
|
||||||
|
(h) => h.getAttribute('col-id') === 'commitmentAmount'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!commitmentHeader) {
|
||||||
|
throw new Error('No commitment header found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5002-LIQP-003
|
||||||
|
expect(commitmentHeader).toHaveAttribute('aria-sort', 'none');
|
||||||
|
await userEvent.click(within(commitmentHeader).getByText(/commitment/i));
|
||||||
|
expect(commitmentHeader).toHaveAttribute('aria-sort', 'ascending');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user