|
|
@@ -20,11 +20,11 @@ export class AgoraSTTPage {
|
|
|
constructor(page: Page) {
|
|
|
this.page = page;
|
|
|
this.pageTitle = page.getByRole('heading', { name: '语音转文字' });
|
|
|
- this.joinChannelButton = page.getByRole('button', { name: /加入语音频道|连接中\.\.\./ });
|
|
|
- this.leaveChannelButton = page.getByRole('button', { name: '离开频道' });
|
|
|
- this.startRecordingButton = page.getByRole('button', { name: '开始录音' });
|
|
|
- this.stopRecordingButton = page.getByRole('button', { name: '停止录音' });
|
|
|
- this.clearTranscriptionsButton = page.getByRole('button', { name: '清空转录' });
|
|
|
+ this.joinChannelButton = page.getByTestId('join-channel-button');
|
|
|
+ this.leaveChannelButton = page.getByTestId('leave-channel-button');
|
|
|
+ this.startRecordingButton = page.getByTestId('start-recording-button');
|
|
|
+ this.stopRecordingButton = page.getByTestId('stop-recording-button');
|
|
|
+ this.clearTranscriptionsButton = page.getByTestId('clear-transcriptions-button');
|
|
|
|
|
|
// 状态徽章
|
|
|
this.connectionStatusBadge = page.getByText(/已连接|未连接/).first();
|
|
|
@@ -73,7 +73,15 @@ export class AgoraSTTPage {
|
|
|
|
|
|
async joinChannel() {
|
|
|
await this.joinChannelButton.click();
|
|
|
- await expect(this.connectionStatusBadge).toHaveText('已连接');
|
|
|
+
|
|
|
+ // 等待连接状态更新
|
|
|
+ await expect(this.connectionStatusBadge).toHaveText('已连接', { timeout: 15000 });
|
|
|
+
|
|
|
+ // 等待按钮状态更新 - 先等待加入按钮消失
|
|
|
+ await expect(this.joinChannelButton).not.toBeVisible({ timeout: 5000 });
|
|
|
+
|
|
|
+ // 然后等待离开频道按钮可见
|
|
|
+ await expect(this.leaveChannelButton).toBeVisible({ timeout: 10000 });
|
|
|
}
|
|
|
|
|
|
async leaveChannel() {
|
|
|
@@ -83,7 +91,8 @@ export class AgoraSTTPage {
|
|
|
|
|
|
async startRecording() {
|
|
|
await this.startRecordingButton.click();
|
|
|
- await expect(this.recordingStatusBadge).toHaveText('录制中');
|
|
|
+ // 等待录制状态更新,增加超时时间
|
|
|
+ await expect(this.recordingStatusBadge).toHaveText('录制中', { timeout: 15000 });
|
|
|
}
|
|
|
|
|
|
async stopRecording() {
|