fix: test

This commit is contained in:
DarkPhoenix2704
2025-10-11 06:35:47 +00:00
parent 7472a7e7fb
commit 66827cf60c
2 changed files with 47 additions and 3 deletions

View File

@@ -43,7 +43,15 @@ export class ScriptsTopbar extends BasePage {
await this.rootPage.waitForTimeout(500);
}
async verifyRunButtonState(enabled: boolean) {
async verifyRunButtonVisible(): Promise<void> {
await expect(this.getRunButton()).toBeVisible();
}
async verifyRunButtonEnabled(): Promise<void> {
await expect(this.getRunButton()).toBeEnabled();
}
async verifyRunButtonState(enabled: boolean): Promise<void> {
if (enabled) {
await expect(this.getRunButton()).toBeEnabled();
} else {

View File

@@ -22,13 +22,26 @@ export class ScriptsPage extends BasePage {
get() {
return this.dashboardPage.get().locator('.nc-scripts-content-resizable-wrapper');
}
// Editor methods
getEditor() {
return this.rootPage.getByTestId('nc-scripts-editor');
}
async isEditorVisible(): Promise<boolean> {
return await this.getEditor().isVisible();
}
async getEditorContent(): Promise<string> {
const editorContainer = this.rootPage.getByTestId('nc-scripts-editor');
const editorContainer = this.getEditor();
const content = await editorContainer.getAttribute('data-code');
return content || '';
}
async verifyEditorHasContent(): Promise<void> {
const content = await this.getEditorContent();
expect(content.length).toBeGreaterThan(0);
}
async setEditorContent(
content: string,
scriptId: string,
@@ -56,4 +69,27 @@ export class ScriptsPage extends BasePage {
const content = await this.getEditorContent();
expect(content).toContain(text);
}
getBottomBar() {
return this.dashboardPage.get().locator('.h-9.border-t-1');
}
async toggleEditor(): Promise<void> {
const toggleButton = this.getBottomBar().locator('button').first();
await toggleButton.click();
await this.rootPage.waitForTimeout(300);
}
async verifyEditorToggleState(isOpen: boolean): Promise<void> {
const toggleButton = this.getBottomBar().locator('button').first();
if (isOpen) {
await expect(toggleButton).toHaveClass(/bg-nc-bg-brand/);
} else {
await expect(toggleButton).not.toHaveClass(/bg-nc-bg-brand/);
}
}
async isPlaygroundVisible(): Promise<boolean> {
return await this.playground.get().isVisible();
}
}