/* global cy */ import {} from 'script' import InfoResource from './index.vue' // 模拟 vue-router 分页组件中有用到 const routerCreate = () => { let win = window as any win.router = { options: { history: { base: '/' } } } win.route = { fullPath: '/test' } } describe('数据源组件', () => { const dateSourceConfig = { isShowTable: true, mutiSelect: false, type: 'datasource' } routerCreate() it('挂载数据源组件', () => { cy.mount(InfoResource, { props: { config: dateSourceConfig }, emits: { handleSelectionChange: cy.spy().as('handleSelectionChange') } }).then((r: any) => { if (r) { r.component.optionsDialog.isShowDialog = true cy.get('.tree-ref').should('be.visible') } }) }) // it('should display the table when propsConfig.isShowTable is not false', () => { // // 您需要根据实际情况修改此选择器,以便正确选择表格元素 // cy.get('.table-list-selector').should('be.visible'); // }); // it('should display the pagination when propsConfig.isShowTable is not false', () => { // cy.get('.pagination').should('be.visible'); // }); // it('should display the search input', () => { // cy.get('.info-form input').should('be.visible'); // }); // it('should filter the table when search input is used', () => { // // 在此示例中,我们将搜索名称为 "test" 的项目 // cy.get('.info-form input').type('test{enter}'); // // 您需要根据实际情况修改此选择器,以便正确选择表格行元素 // cy.get('.table-list-selector tr').each(($row) => { // cy.wrap($row).contains('test'); // }); // }); })