Test for accounts (#285)
This commit is contained in:
parent
cd343cc1fe
commit
ceab1cbac4
@ -16,6 +16,13 @@ Feature: Markets page
|
||||
When I click on "Suspended" market
|
||||
Then trading page for "suspended" market is displayed
|
||||
|
||||
Scenario: Accounts displayed when connected to wallet
|
||||
Given I am on the trading page for an active market
|
||||
And I connect to Vega Wallet
|
||||
When I click on accounts tab
|
||||
Then accounts are displayed
|
||||
And I can see account for tEURO
|
||||
|
||||
Scenario: Positions displayed
|
||||
Given I am on the trading page for an active market
|
||||
And I connect to Vega Wallet
|
||||
|
@ -6,6 +6,7 @@ export default class TradingPage extends BasePage {
|
||||
orderbookTab = 'Orderbook';
|
||||
ordersTab = 'Orders';
|
||||
positionsTab = 'Positions';
|
||||
accountsTab = 'Accounts';
|
||||
collateralTab = 'Collateral';
|
||||
tradesTab = 'Trades';
|
||||
completedTrades = 'Market-trades';
|
||||
@ -15,6 +16,10 @@ export default class TradingPage extends BasePage {
|
||||
cy.getByTestId(this.ordersTab).click();
|
||||
}
|
||||
|
||||
clickOnAccountsTab() {
|
||||
cy.getByTestId(this.accountsTab).click();
|
||||
}
|
||||
|
||||
clickOnPositionsTab() {
|
||||
cy.getByTestId(this.positionsTab).click();
|
||||
}
|
||||
|
@ -5,10 +5,12 @@ import { generateMarkets } from '../mocks/generate-markets';
|
||||
import MarketsPage from '../pages/markets-page';
|
||||
import TradingPage from '../pages/trading-page';
|
||||
import PositionsList from '../trading-windows/positions-list';
|
||||
import AccountsList from '../trading-windows/accounts-list';
|
||||
|
||||
const marketsPage = new MarketsPage();
|
||||
const tradingPage = new TradingPage();
|
||||
const positionsList = new PositionsList();
|
||||
const accountList = new AccountsList();
|
||||
|
||||
const mockMarkets = () => {
|
||||
cy.mockGQL('Markets', (req) => {
|
||||
@ -53,3 +55,21 @@ When('I click on positions tab', () => {
|
||||
Then('positions are displayed', () => {
|
||||
positionsList.verifyPositionsDisplayed();
|
||||
});
|
||||
|
||||
When('I click on accounts tab', () => {
|
||||
tradingPage.clickOnAccountsTab();
|
||||
});
|
||||
|
||||
Then('accounts are displayed', () => {
|
||||
accountList.verifyAccountsDisplayed();
|
||||
});
|
||||
|
||||
Then('I can see account for tEURO', () => {
|
||||
accountList.verifySingleAccountDisplayed(
|
||||
'General-tEURO-null',
|
||||
'tEURO',
|
||||
'General',
|
||||
'—',
|
||||
'1,000.00000'
|
||||
);
|
||||
});
|
||||
|
@ -0,0 +1,44 @@
|
||||
export default class AccountsList {
|
||||
accountSymbolColId = 'asset.symbol';
|
||||
accountTypeColId = 'type';
|
||||
accountMarketNameColId = 'market.name';
|
||||
accountBalanceColId = 'balance';
|
||||
|
||||
verifyAccountsDisplayed() {
|
||||
cy.get(`[col-id='${this.accountSymbolColId}']`).each(($accountSymbol) => {
|
||||
cy.wrap($accountSymbol).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.get(`[col-id='${this.accountTypeColId}']`).each(($accountType) => {
|
||||
cy.wrap($accountType).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.get(`[col-id='${this.accountMarketNameColId}']`).each(
|
||||
($accountMarketName) => {
|
||||
cy.wrap($accountMarketName).invoke('text').should('not.be.empty');
|
||||
}
|
||||
);
|
||||
cy.get(`[col-id='${this.accountBalanceColId}']`).each(($accountBalance) => {
|
||||
cy.wrap($accountBalance).invoke('text').should('not.be.empty');
|
||||
});
|
||||
}
|
||||
|
||||
verifySingleAccountDisplayed(
|
||||
accountRowId: string,
|
||||
accountSymbol: string,
|
||||
accountType: string,
|
||||
accountMarketName: string,
|
||||
accountBalance: string
|
||||
) {
|
||||
cy.get(`[row-id='${accountRowId}']`)
|
||||
.find(`[col-id='${this.accountSymbolColId}']`)
|
||||
.should('have.text', accountSymbol);
|
||||
cy.get(`[row-id='${accountRowId}']`)
|
||||
.find(`[col-id='${this.accountTypeColId}']`)
|
||||
.should('have.text', accountType);
|
||||
cy.get(`[row-id='${accountRowId}']`)
|
||||
.find(`[col-id='${this.accountMarketNameColId}']`)
|
||||
.should('have.text', accountMarketName);
|
||||
cy.get(`[row-id='${accountRowId}']`)
|
||||
.find(`[col-id='${this.accountBalanceColId}']`)
|
||||
.should('have.text', accountBalance);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user