* -------------------------------------------------------------------------
* This file is part of the MindStudio project.
* Copyright (c) 2025 Huawei Technologies Co.,Ltd.
*
* MindStudio is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*/
import { type FrameLocator, type Page, type Locator } from '@playwright/test';
import { FrameworkPage } from './framework';
import { TableHelpers } from '../components';
export class CommunicationPage {
readonly page: Page;
readonly communicationFrame: FrameLocator;
readonly fullPage: Locator;
readonly filters: Locator;
readonly hcclChart: Locator;
readonly stepSelector: Locator;
readonly communicationGroupSelector: Locator;
readonly operatorNameSelector: Locator;
readonly durationAnalysisRadio: Locator;
readonly communicationMatrixRadio: Locator;
readonly communicationMatrixTypeSelector: Locator;
readonly fullmask: Locator;
readonly communicationMatrixMinRangeInput: Locator;
readonly communicationMatrixMaxRangeInput: Locator;
readonly matrixChart: Locator;
constructor(page: Page) {
this.page = page;
this.communicationFrame = page.frameLocator('#Communication');
this.fullPage = this.communicationFrame.locator('#root');
this.filters = this.communicationFrame.getByTestId('filters');
this.hcclChart = this.communicationFrame.locator('#hccl');
this.stepSelector = this.communicationFrame.locator('#step-select');
this.communicationGroupSelector = this.communicationFrame.locator('#communicationGroup-select');
this.operatorNameSelector = this.communicationFrame.locator('#operatorName-select');
this.communicationMatrixRadio = this.communicationFrame.locator('input[type="radio"][value="CommunicationMatrix"]');
this.durationAnalysisRadio = this.communicationFrame.locator('input[type="radio"][value="CommunicationDurationAnalysis"]');
this.communicationMatrixTypeSelector = this.communicationFrame.locator('#communicationMatrixType-select');
this.fullmask = this.communicationFrame.locator('.fullmask');
this.communicationMatrixMinRangeInput = this.communicationFrame.getByTestId('communicationMatrixMinRangeInput');
this.communicationMatrixMaxRangeInput = this.communicationFrame.getByTestId('communicationMatrixMaxRangeInput');
this.matrixChart = this.communicationFrame.locator('#matrixchart');
}
async goto(): Promise<void> {
const frameworkPage = new FrameworkPage(this.page);
await frameworkPage.clickTab('communication');
await this.page.mouse.move(0,0);
}
async switchDurationAnalysis(communicationMatrixRadio: Locator, durationAnalysisRadio: Locator): Promise<void> {
await communicationMatrixRadio.click();
await durationAnalysisRadio.click();
}
* 定位到表格查看详情按钮并跳转到带宽分析页
*/
async toOperatorpage(page: Page, communicationFrame: FrameLocator): Promise<void> {
const tableLocator = communicationFrame.getByTestId('dataAnalysisTable').locator('.ant-table-container > .ant-table-content > table').first();
const dataAnalysisTable = new TableHelpers(page, tableLocator, communicationFrame);
const td = await dataAnalysisTable.getCell(1, 11);
const linkBtn = td.locator('button');
await linkBtn.click();
}
}