mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
test(editor): Add e2e test cases for the logs view (#15060)
This commit is contained in:
@@ -9,6 +9,9 @@ export const getWorkflowExecutionPreviewIframe = () => cy.getByTestId('workflow-
|
||||
export const getExecutionPreviewBody = () =>
|
||||
getWorkflowExecutionPreviewIframe()
|
||||
.its('0.contentDocument.body')
|
||||
.should((body) => {
|
||||
expect(body.querySelector('[data-test-id="canvas-wrapper"]')).to.exist;
|
||||
})
|
||||
.then((el) => cy.wrap(el));
|
||||
|
||||
export const getExecutionPreviewBodyNodes = () =>
|
||||
@@ -21,9 +24,23 @@ export function getExecutionPreviewOutputPanelRelatedExecutionLink() {
|
||||
return getExecutionPreviewBody().findChildByTestId('related-execution-link');
|
||||
}
|
||||
|
||||
export function getLogsOverviewStatus() {
|
||||
return getExecutionPreviewBody().findChildByTestId('logs-overview-status');
|
||||
}
|
||||
|
||||
export function getLogEntries() {
|
||||
return getExecutionPreviewBody().findChildByTestId('logs-overview-body').find('[role=treeitem]');
|
||||
}
|
||||
|
||||
export function getManualChatMessages() {
|
||||
return getExecutionPreviewBody().find('.chat-messages-list .chat-message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
|
||||
export const openExecutionPreviewNode = (name: string) =>
|
||||
getExecutionPreviewBodyNodesByName(name).dblclick();
|
||||
|
||||
export const toggleAutoRefresh = () => cy.getByTestId('auto-refresh-checkbox').click();
|
||||
|
||||
@@ -2,8 +2,20 @@
|
||||
* Accessors
|
||||
*/
|
||||
|
||||
export function getLogEntryAtRow(rowIndex: number) {
|
||||
return cy.getByTestId('logs-overview-body').find('[role=treeitem]').eq(rowIndex);
|
||||
export function getOverviewStatus() {
|
||||
return cy.getByTestId('logs-overview-status');
|
||||
}
|
||||
|
||||
export function getLogEntries() {
|
||||
return cy.getByTestId('logs-overview-body').find('[role=treeitem]');
|
||||
}
|
||||
|
||||
export function getSelectedLogEntry() {
|
||||
return cy.getByTestId('logs-overview-body').find('[role=treeitem][aria-selected=true]');
|
||||
}
|
||||
|
||||
export function getInputPanel() {
|
||||
return cy.getByTestId('log-details-input');
|
||||
}
|
||||
|
||||
export function getInputTableRows() {
|
||||
@@ -14,6 +26,22 @@ export function getInputTbodyCell(row: number, col: number) {
|
||||
return cy.getByTestId('log-details-input').find('table tr').eq(row).find('td').eq(col);
|
||||
}
|
||||
|
||||
export function getNodeErrorMessageHeader() {
|
||||
return cy.getByTestId('log-details-output').findChildByTestId('node-error-message');
|
||||
}
|
||||
|
||||
export function getOutputPanel() {
|
||||
return cy.getByTestId('log-details-output');
|
||||
}
|
||||
|
||||
export function getOutputTableRows() {
|
||||
return cy.getByTestId('log-details-output').find('table tr');
|
||||
}
|
||||
|
||||
export function getOutputTbodyCell(row: number, col: number) {
|
||||
return cy.getByTestId('log-details-output').find('table tr').eq(row).find('td').eq(col);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
@@ -22,8 +50,12 @@ export function openLogsPanel() {
|
||||
cy.getByTestId('logs-overview-header').click();
|
||||
}
|
||||
|
||||
export function pressClearExecutionButton() {
|
||||
cy.getByTestId('logs-overview-header').find('button').contains('Clear execution').click();
|
||||
}
|
||||
|
||||
export function clickLogEntryAtRow(rowIndex: number) {
|
||||
getLogEntryAtRow(rowIndex).click();
|
||||
getLogEntries().eq(rowIndex).click();
|
||||
}
|
||||
|
||||
export function toggleInputPanel() {
|
||||
@@ -31,11 +63,21 @@ export function toggleInputPanel() {
|
||||
}
|
||||
|
||||
export function clickOpenNdvAtRow(rowIndex: number) {
|
||||
getLogEntryAtRow(rowIndex).realHover();
|
||||
getLogEntryAtRow(rowIndex).find('[aria-label="Open..."]').click();
|
||||
getLogEntries().eq(rowIndex).realHover();
|
||||
getLogEntries().eq(rowIndex).find('[aria-label="Open..."]').click();
|
||||
}
|
||||
|
||||
export function setInputDisplayMode(mode: 'table') {
|
||||
export function clickTriggerPartialExecutionAtRow(rowIndex: number) {
|
||||
getLogEntries().eq(rowIndex).realHover();
|
||||
getLogEntries().eq(rowIndex).find('[aria-label="Test step"]').click();
|
||||
}
|
||||
|
||||
export function setInputDisplayMode(mode: 'table' | 'ai' | 'json' | 'schema') {
|
||||
cy.getByTestId('log-details-input').realHover();
|
||||
cy.getByTestId('log-details-input').findChildByTestId(`radio-button-${mode}`).click();
|
||||
}
|
||||
|
||||
export function setOutputDisplayMode(mode: 'table' | 'ai' | 'json' | 'schema') {
|
||||
cy.getByTestId('log-details-output').realHover();
|
||||
cy.getByTestId('log-details-output').findChildByTestId(`radio-button-${mode}`).click();
|
||||
}
|
||||
|
||||
@@ -25,14 +25,6 @@ export type EndpointType =
|
||||
* Getters
|
||||
*/
|
||||
|
||||
export function executeWorkflowAndWait(waitForSuccessBannerToDisappear = true) {
|
||||
cy.get('[data-test-id="execute-workflow-button"]').click();
|
||||
cy.contains('Workflow executed successfully', { timeout: 4000 }).should('be.visible');
|
||||
if (waitForSuccessBannerToDisappear) {
|
||||
cy.contains('Workflow executed successfully', { timeout: 10000 }).should('not.exist');
|
||||
}
|
||||
}
|
||||
|
||||
export function getCanvas() {
|
||||
return cy.getByTestId('canvas');
|
||||
}
|
||||
@@ -141,7 +133,7 @@ export function getWorkflowHistoryCloseButton() {
|
||||
|
||||
export function disableNode(name: string) {
|
||||
const target = getNodeByName(name);
|
||||
target.rightclick(name ? 'center' : 'topLeft', { force: true });
|
||||
target.trigger('contextmenu');
|
||||
cy.getByTestId('context-menu-item-toggle_activation').click();
|
||||
}
|
||||
|
||||
@@ -201,6 +193,22 @@ export function getNodeIssuesByName(nodeName: string) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
export function executeWorkflow() {
|
||||
cy.get('[data-test-id="execute-workflow-button"]').click();
|
||||
}
|
||||
|
||||
export function waitForSuccessBannerToAppear() {
|
||||
cy.contains(/(Workflow|Node) executed successfully/, { timeout: 4000 }).should('be.visible');
|
||||
}
|
||||
|
||||
export function executeWorkflowAndWait(waitForSuccessBannerToDisappear = true) {
|
||||
executeWorkflow();
|
||||
waitForSuccessBannerToAppear();
|
||||
if (waitForSuccessBannerToDisappear) {
|
||||
cy.contains('Workflow executed successfully', { timeout: 10000 }).should('not.exist');
|
||||
}
|
||||
}
|
||||
|
||||
export function addNodeToCanvas(
|
||||
nodeDisplayName: string,
|
||||
plusButtonClick = true,
|
||||
@@ -373,3 +381,7 @@ export function openContextMenu(
|
||||
export function clickContextMenuAction(action: string) {
|
||||
getContextMenuAction(action).click({ force: true });
|
||||
}
|
||||
|
||||
export function openExecutions() {
|
||||
cy.getByTestId('radio-button-executions').click();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user