Skip to content

Commit

Permalink
e2e(819): test coverage for root OnException support
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Feb 26, 2024
1 parent ea79208 commit 83cea14
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
97 changes: 97 additions & 0 deletions packages/ui-tests/cypress/e2e/designer/rootOnException.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
describe('Test for root containers', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Root onException steps config', () => {
cy.uploadFixture('flows/onExceptionCR.yaml');
cy.openDesignPage();

cy.selectInsertNode('onException-1234');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('aws2-sqs');
cy.get('#aws2-sqs').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);

cy.selectAppendNode('aws2-sqs');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('log');
cy.get('#log').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);

cy.checkNodeExist('aws2-sqs', 1);
cy.checkNodeExist('log', 1);

cy.openSourceCode();

cy.checkCodeSpanLine('onException:');
cy.checkCodeSpanLine('id: onException-1234');
cy.checkCodeSpanLine('steps:');
cy.checkCodeSpanLine('uri: aws2-sqs');
cy.checkCodeSpanLine('uri: log');
});

it('Root onException config', () => {
cy.uploadFixture('flows/onExceptionCR.yaml');
cy.openDesignPage();

cy.get('[data-id^="onException"]')
.find('.pf-topology__node__label')
.find('.pf-topology__node__label__background')
.click();

cy.get(`input[name="description"]`).clear().type('testDescription');
cy.get(`input[name="onExceptionOccurredRef"]`).clear().type('testOnExceptionOccurredRef');
cy.get(`input[name="onRedeliveryRef"]`).clear().type('testOnRedeliveryRef');
cy.get(`input[name="redeliveryPolicy.id"]`).clear().type('testRedeliveryPolicyId');
cy.get(`input[name="redeliveryPolicy.allowRedeliveryWhileStopping"]`).check();
cy.get(`input[name="redeliveryPolicy.asyncDelayedRedelivery"]`).check();
cy.get(`input[name="redeliveryPolicy.backOffMultiplier"]`).clear().type('3.0');
cy.get(`input[name="redeliveryPolicy.collisionAvoidanceFactor"]`).clear().type('0.2');
cy.get(`input[name="redeliveryPolicy.delayPattern"]`).clear().type('testRedeliveryPolicyDelayPattern');
cy.get(`input[name="redeliveryPolicy.disableRedelivery"]`).check();
cy.get(`input[name="redeliveryPolicy.exchangeFormatterRef"]`).clear().type('testExchangeFormatterRef');
cy.get(`input[name="redeliveryPolicy.logContinued"]`).check();
cy.get(`input[name="redeliveryPolicy.logExhausted"]`).check();
cy.get(`input[name="redeliveryPolicy.logExhaustedMessageBody"]`).check();
cy.get(`input[name="redeliveryPolicy.logExhaustedMessageHistory"]`).check();
cy.get(`input[name="redeliveryPolicy.logHandled"]`).check();
cy.get(`input[name="redeliveryPolicy.logNewException"]`).check();
cy.get(`input[name="redeliveryPolicy.logRetryAttempted"]`).check();
cy.get(`input[name="redeliveryPolicy.logRetryStackTrace"]`).check();
cy.get(`input[name="redeliveryPolicy.logStackTrace"]`).check();
cy.get(`input[name="redeliveryPolicy.maximumRedeliveries"]`).clear().type('10');
cy.get(`input[name="redeliveryPolicy.maximumRedeliveryDelay"]`).clear().type('40000');
cy.get(`input[name="redeliveryPolicy.redeliveryDelay"]`).clear().type('2000');
cy.get(`input[name="redeliveryPolicy.retryAttemptedLogInterval"]`).clear().type('2');
cy.get(`input[name="redeliveryPolicyRef"]`).clear().type('testRedeliveryPolicyRef');
cy.openSourceCode();

cy.checkCodeSpanLine('description: testDescription');
cy.checkCodeSpanLine('onExceptionOccurredRef: testOnExceptionOccurredRef');
cy.checkCodeSpanLine('redeliveryPolicy:');
cy.checkCodeSpanLine('allowRedeliveryWhileStopping: true');
cy.checkCodeSpanLine('asyncDelayedRedelivery: true');
cy.checkCodeSpanLine('backOffMultiplier: "3.0"');
cy.checkCodeSpanLine('collisionAvoidanceFactor: "0.2"');
cy.checkCodeSpanLine('delayPattern: testRedeliveryPolicyDelayPattern');
cy.checkCodeSpanLine('disableRedelivery: true');
cy.checkCodeSpanLine('exchangeFormatterRef: testExchangeFormatterRef');
cy.checkCodeSpanLine('logContinued: true');
cy.checkCodeSpanLine('logExhausted: true');
cy.checkCodeSpanLine('logExhaustedMessageBody: true');
cy.checkCodeSpanLine('logExhaustedMessageHistory: true');
cy.checkCodeSpanLine('logHandled: true');
cy.checkCodeSpanLine('logNewException: true');
cy.checkCodeSpanLine('logRetryAttempted: true');
cy.checkCodeSpanLine('logRetryStackTrace: true');
cy.checkCodeSpanLine('logStackTrace: true');
cy.checkCodeSpanLine('maximumRedeliveries: "10"');
cy.checkCodeSpanLine('maximumRedeliveryDelay: "40000"');
cy.checkCodeSpanLine('redeliveryDelay: "2000"');
cy.checkCodeSpanLine('retryAttemptedLogInterval: "2"');
cy.checkCodeSpanLine('redeliveryPolicyRef: testRedeliveryPolicyRef');
});
});
2 changes: 2 additions & 0 deletions packages/ui-tests/cypress/fixtures/flows/onExceptionCR.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- onException:
id: onException-1234
3 changes: 2 additions & 1 deletion packages/ui-tests/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export {};

declare global {
type ActionType = 'append' | 'prepend' | 'replace' | 'insert-special' | 'remove';
type ActionType = 'append' | 'prepend' | 'replace' | 'insert' | 'insert-special' | 'remove';

namespace Cypress {
interface Chainable {
Expand Down Expand Up @@ -40,6 +40,7 @@ declare global {
selectReplaceNode(inputName: string, nodeIndex?: number): Chainable<JQuery<Element>>;
selectAppendNode(inputName: string, nodeIndex?: number): Chainable<JQuery<Element>>;
selectInsertSpecialNode(inputName: string, nodeIndex?: number): Chainable<JQuery<Element>>;
selectInsertNode(inputName: string, nodeIndex?: number): Chainable<JQuery<Element>>;
selectPrependNode(inputName: string, nodeIndex?: number): Chainable<JQuery<Element>>;
performNodeAction(nodeName: string, action: ActionType, nodeIndex?: number): Chainable<JQuery<Element>>;
checkNodeExist(inputName: string, nodesCount: number): Chainable<JQuery<Element>>;
Expand Down
4 changes: 4 additions & 0 deletions packages/ui-tests/cypress/support/next-commands/design.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Cypress.Commands.add('selectAppendNode', (nodeName: string, nodeIndex?: number)
cy.performNodeAction(nodeName, 'append', nodeIndex);
});

Cypress.Commands.add('selectInsertNode', (nodeName: string, nodeIndex?: number) => {
cy.performNodeAction(nodeName, 'insert', nodeIndex);
});

Cypress.Commands.add('selectInsertSpecialNode', (nodeName: string, nodeIndex?: number) => {
cy.performNodeAction(nodeName, 'insert-special', nodeIndex);
});
Expand Down

0 comments on commit 83cea14

Please sign in to comment.