mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
test: Migrate 6-code-node tests to Playwright (#18454)
This commit is contained in:
@@ -47,4 +47,106 @@ export class NodeDisplayViewPage extends BasePage {
|
||||
getParameterExpressionPreviewValue() {
|
||||
return this.page.getByTestId('parameter-expression-preview-value');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter input by name (for Code node and similar)
|
||||
* @param parameterName - The name of the parameter e.g 'jsCode', 'mode'
|
||||
*/
|
||||
getParameterInput(parameterName: string) {
|
||||
return this.page.getByTestId(`parameter-input-${parameterName}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select option in parameter dropdown
|
||||
* @param parameterName - The parameter name
|
||||
* @param optionText - The text of the option to select
|
||||
*/
|
||||
async selectOptionInParameterDropdown(parameterName: string, optionText: string) {
|
||||
const dropdown = this.getParameterInput(parameterName);
|
||||
await dropdown.click();
|
||||
await this.page.getByRole('option', { name: optionText }).click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click on a floating node in the NDV (for switching between connected nodes)
|
||||
* @param nodeName - The name of the node to click
|
||||
*/
|
||||
async clickFloatingNode(nodeName: string) {
|
||||
await this.page.locator(`[data-test-id="floating-node"][data-node-name="${nodeName}"]`).click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the previous node (useful for providing input data)
|
||||
*/
|
||||
async executePrevious() {
|
||||
await this.clickByTestId('execute-previous-node');
|
||||
}
|
||||
|
||||
async clickAskAiTab() {
|
||||
await this.page.locator('#tab-ask-ai').click();
|
||||
}
|
||||
|
||||
getAskAiTabPanel() {
|
||||
return this.page.getByTestId('code-node-tab-ai');
|
||||
}
|
||||
|
||||
getAskAiCtaButton() {
|
||||
return this.page.getByTestId('ask-ai-cta');
|
||||
}
|
||||
|
||||
getAskAiPromptInput() {
|
||||
return this.page.getByTestId('ask-ai-prompt-input');
|
||||
}
|
||||
|
||||
getAskAiPromptCounter() {
|
||||
return this.page.getByTestId('ask-ai-prompt-counter');
|
||||
}
|
||||
|
||||
getAskAiCtaTooltipNoInputData() {
|
||||
return this.page.getByTestId('ask-ai-cta-tooltip-no-input-data');
|
||||
}
|
||||
|
||||
getAskAiCtaTooltipNoPrompt() {
|
||||
return this.page.getByTestId('ask-ai-cta-tooltip-no-prompt');
|
||||
}
|
||||
|
||||
getAskAiCtaTooltipPromptTooShort() {
|
||||
return this.page.getByTestId('ask-ai-cta-tooltip-prompt-too-short');
|
||||
}
|
||||
|
||||
getCodeTabPanel() {
|
||||
return this.page.getByTestId('code-node-tab-code');
|
||||
}
|
||||
|
||||
getCodeTab() {
|
||||
return this.page.locator('#tab-code');
|
||||
}
|
||||
|
||||
getCodeEditor() {
|
||||
return this.getParameterInput('jsCode').locator('.cm-content');
|
||||
}
|
||||
|
||||
getLintErrors() {
|
||||
return this.getParameterInput('jsCode').locator('.cm-lintRange-error');
|
||||
}
|
||||
|
||||
getLintTooltip() {
|
||||
return this.page.locator('.cm-tooltip-lint');
|
||||
}
|
||||
|
||||
getPlaceholderText(text: string) {
|
||||
return this.page.getByText(text);
|
||||
}
|
||||
|
||||
getHeyAiText() {
|
||||
return this.page.locator('text=Hey AI, generate JavaScript');
|
||||
}
|
||||
|
||||
getCodeGenerationCompletedText() {
|
||||
return this.page.locator('text=Code generation completed');
|
||||
}
|
||||
|
||||
getErrorMessageText(message: string) {
|
||||
return this.page.locator(`text=${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user