Fix for failing test in CI (#374)

* Fix for failing test in CI

* Resolve PR comment

* Add check for visible

* Real fix for failing market test
This commit is contained in:
Joe Tsang 2022-05-06 09:31:28 +01:00 committed by GitHub
parent d03e4cf785
commit 6746d3e003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View File

@ -8,10 +8,10 @@ Feature: Markets page
Scenario: Select active market
Given I am on the markets page
When I click on "Active" market
When I click on "Active" mocked market
Then trading page for "active" market is displayed
Scenario: Select suspended market
Given I am on the markets page
When I click on "Suspended" market
When I click on "Suspended" mocked market
Then trading page for "suspended" market is displayed

View File

@ -7,6 +7,7 @@ export default class MarketPage extends BasePage {
'tradableInstrument.instrument.product.settlementAsset.symbol';
marketRowPrices = 'flash-cell';
marketRowDescription = 'name';
marketStateColId = 'data';
validateMarketsAreDisplayed() {
cy.get('.ag-root-wrapper').should('be.visible');
@ -54,6 +55,8 @@ export default class MarketPage extends BasePage {
}
clickOnMarket(text: string) {
cy.contains(text).click();
cy.get(`[col-id=${this.marketStateColId}]`)
.contains(text)
.click({ force: true });
}
}

View File

@ -14,9 +14,11 @@ import AccountsList from '../trading-windows/accounts-list';
import TradesList from '../trading-windows/trades-list';
import TradingPage from '../pages/trading-page';
import OrdersList from '../trading-windows/orders-list';
import MarketPage from '../pages/markets-page';
const tradesList = new TradesList();
const tradingPage = new TradingPage();
const marketPage = new MarketPage();
const positionsList = new PositionsList();
const accountList = new AccountsList();
const ordersList = new OrdersList();
@ -97,15 +99,25 @@ Given('I am on the trading page for a suspended market', () => {
cy.contains('Market: SUSPENDED MARKET');
});
When('I click on {string} mocked market', (marketType) => {
switch (marketType) {
case 'Active':
mockMarket(MarketState.Active);
break;
case 'Suspended':
mockMarket(MarketState.Suspended);
break;
}
marketPage.clickOnMarket(marketType);
});
Then('trading page for {string} market is displayed', (marketType) => {
switch (marketType) {
case 'active':
mockMarket(MarketState.Active);
cy.wait('@Market');
cy.contains('Market: ACTIVE MARKET');
break;
case 'suspended':
mockMarket(MarketState.Suspended);
cy.wait('@Market');
cy.contains('Market: SUSPENDED MARKET');
break;