diff --git a/apps/trading-e2e/src/integration/trading-orders.cy.ts b/apps/trading-e2e/src/integration/trading-orders.cy.ts index 294e63ee5..af5ef4e11 100644 --- a/apps/trading-e2e/src/integration/trading-orders.cy.ts +++ b/apps/trading-e2e/src/integration/trading-orders.cy.ts @@ -30,9 +30,6 @@ describe('orders list', { tags: '@smoke' }, () => { cy.setVegaWallet(); cy.visit('/#/markets/market-0'); cy.getByTestId('Orders').click(); - cy.wait('@Orders').then(() => { - expect(subscriptionMocks.OrdersUpdate).to.be.calledThrice; - }); cy.wait('@Markets'); }); @@ -135,14 +132,19 @@ describe('subscribe orders', { tags: '@smoke' }, () => { cy.setVegaWallet(); cy.visit('/#/markets/market-0'); cy.getByTestId('Orders').click(); - cy.wait('@Orders').then(() => { - expect(subscriptionMocks.OrdersUpdate).to.be.calledThrice; + cy.getByTestId('tab-orders').within(() => { + cy.get('[col-id="status"][role="columnheader"]') + .focus() + .find('.ag-header-cell-menu-button') + .click(); + cy.get('.ag-filter-apply-panel-button').click(); }); }); const orderId = '1234567890'; // 7002-SORD-053 // 7002-SORD-040 // 7003-MORD-001 + it('must see an active order', () => { // 7002-SORD-041 updateOrder({ @@ -151,6 +153,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => { }); cy.getByTestId(`order-status-${orderId}`).should('have.text', 'Active'); }); + it('must see an expired order', () => { // 7002-SORD-042 updateOrder({ @@ -353,8 +356,12 @@ describe('amend and cancel order', { tags: '@smoke' }, () => { cy.setVegaWallet(); cy.visit('/#/markets/market-0'); cy.getByTestId('Orders').click(); - cy.wait('@Orders').then(() => { - expect(subscriptionMocks.OrdersUpdate).to.be.calledThrice; + cy.getByTestId('tab-orders').within(() => { + cy.get('[col-id="status"][role="columnheader"]') + .focus() + .find('.ag-header-cell-menu-button') + .click(); + cy.get('.ag-filter-apply-panel-button').click(); }); cy.mockVegaWalletTransaction(); }); diff --git a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx index 0404d9aaf..385588dd8 100644 --- a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx +++ b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx @@ -16,6 +16,7 @@ import { useOrderListData } from './use-order-list-data'; import { useHasActiveOrder } from '../../order-hooks/use-has-active-order'; import type { Filter, Sort } from './use-order-list-data'; import { useBottomPlaceholder } from '@vegaprotocol/react-helpers'; +import { OrderStatus } from '@vegaprotocol/types'; import { normalizeOrderAmendment, useVegaTransactionStore, @@ -53,6 +54,12 @@ const CancelAllOrdersButton = ({ ) : null; }; +const initialFilter: Filter = { + status: { + value: [OrderStatus.STATUS_ACTIVE, OrderStatus.STATUS_PARKED], + }, +}; + export const OrderListManager = ({ partyId, marketId, @@ -62,7 +69,7 @@ export const OrderListManager = ({ const gridRef = useRef(null); const scrolledToTop = useRef(true); const [sort, setSort] = useState(); - const [filter, setFilter] = useState(); + const [filter, setFilter] = useState(initialFilter); const [editOrder, setEditOrder] = useState(null); const create = useVegaTransactionStore((state) => state.create); const hasActiveOrder = useHasActiveOrder(marketId); @@ -160,10 +167,11 @@ export const OrderListManager = ({ ); const onGridReady = useCallback( - (event: GridReadyEvent) => { - event.api.setDatasource({ + ({ api }: GridReadyEvent) => { + api.setDatasource({ getRows, }); + api.setFilterModel(initialFilter); }, [getRows] );