mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
test: Set up e2e tests for Code node (#4730)
* 🧪 Set up Code node tests * ⚡ Address comments
This commit is contained in:
parent
efbf7366fb
commit
8f6fd009b9
34
cypress/e2e/6-code-node.cy.ts
Normal file
34
cypress/e2e/6-code-node.cy.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
||||
|
||||
const WorkflowPage = new WorkflowPageClass();
|
||||
|
||||
describe('Code node', () => {
|
||||
beforeEach(() => {
|
||||
cy.task('db:reset');
|
||||
cy.skipSetup();
|
||||
});
|
||||
|
||||
it('should execute the placeholder in all-items mode successfully', () => {
|
||||
WorkflowPage.actions.visit();
|
||||
WorkflowPage.actions.addInitialNodeToCanvas('Manual Trigger');
|
||||
WorkflowPage.actions.addNodeToCanvas('Code');
|
||||
WorkflowPage.actions.openNodeNdv('Code');
|
||||
|
||||
WorkflowPage.actions.executeNodeFromNdv();
|
||||
|
||||
WorkflowPage.getters.successToast().contains('Node executed successfully');
|
||||
});
|
||||
|
||||
it('should execute the placeholder in each-item mode successfully', () => {
|
||||
WorkflowPage.actions.visit();
|
||||
WorkflowPage.actions.addInitialNodeToCanvas('Manual Trigger');
|
||||
WorkflowPage.actions.addNodeToCanvas('Code');
|
||||
WorkflowPage.actions.openNodeNdv('Code');
|
||||
WorkflowPage.getters.ndvParameterInput('mode').click();
|
||||
WorkflowPage.actions.selectOptionInParameterDropdown('mode', 'Run Once for Each Item');
|
||||
|
||||
WorkflowPage.actions.executeNodeFromNdv();
|
||||
|
||||
WorkflowPage.getters.successToast().contains('Node executed successfully');
|
||||
});
|
||||
});
|
|
@ -25,6 +25,9 @@ export class WorkflowPage extends BasePage {
|
|||
ndvParameterInput: (parameterName: string) =>
|
||||
cy.getByTestId(`parameter-input-${parameterName}`),
|
||||
ndvOutputPanel: () => cy.getByTestId('output-panel'),
|
||||
ndvRunDataPaneHeader: () => cy.getByTestId('run-data-pane-header'),
|
||||
|
||||
successToast: () => cy.get('.el-notification__title'),
|
||||
activatorSwitch: () => cy.getByTestId('workflow-activate-switch'),
|
||||
workflowMenu: () => cy.getByTestId('workflow-menu'),
|
||||
firstStepButton: () => cy.getByTestId('canvas-add-button'),
|
||||
|
@ -53,6 +56,13 @@ export class WorkflowPage extends BasePage {
|
|||
typeIntoParameterInput: (parameterName: string, content: string) => {
|
||||
this.getters.ndvParameterInput(parameterName).type(content);
|
||||
},
|
||||
selectOptionInParameterDropdown: (parameterName: string, content: string) => {
|
||||
this.getters
|
||||
.ndvParameterInput(parameterName)
|
||||
.find('.option-headline')
|
||||
.contains(content)
|
||||
.click();
|
||||
},
|
||||
executeNodeFromNdv: () => {
|
||||
cy.contains('Execute node').click();
|
||||
},
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<div :class="$style.header">
|
||||
<slot name="header"></slot>
|
||||
|
||||
<div v-show="!hasRunError" @click.stop :class="$style.displayModes">
|
||||
<div v-show="!hasRunError" @click.stop :class="$style.displayModes" data-test-id="run-data-pane-header">
|
||||
<n8n-radio-buttons
|
||||
v-show="hasNodeRun && ((jsonData && jsonData.length > 0) || (binaryData && binaryData.length > 0)) && !editMode.enabled"
|
||||
:value="displayMode"
|
||||
|
|
Loading…
Reference in a new issue