diff --git a/package.json b/package.json index 5b816e9fe8..aefebb0f7b 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test:bdd": "cucumber-js --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", "test:unit": "nyc --all mocha --exit $(find test/unit -name '*.js')", "test:bdd:release": "cucumber-js --tags=@release --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", + "test:bdd:publish-errors": "cucumber-js --tags=@publish-errors --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", "lint": "eslint ." }, "repository": { diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index a59f140600..32e5fc6c1c 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -4,13 +4,15 @@ Feature: Publish errors test And 1 bootstrap is running #TODO: needs to be investigated; publish completes even with invalid configuration -# Scenario: Node is not able to publish on a node with invalid configuration -# Given I setup publish node 1 with invalid configuration -# Given I setup 3 nodes -# When I call publish on node 1 with validAssertion -# And Last publish finished with status: PublishStartError + @publish-errors + Scenario: Node is not able to publish on a node with invalid configuration + Given I setup publish node 1 with invalid configuration + Given I setup 3 nodes + When I call publish on node 1 with validAssertion + And Last publish finished with status: PublishStartError ## + @publish-errors Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index 7625af0555..1b9bb604e8 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -8,7 +8,7 @@ Feature: Release related tests Given I setup 4 nodes When I call publish on node 1 with validAssertion And Last publish finished with status: COMPLETED -# + @release Scenario: Node is able to get result of the operation previously published Given I setup 4 nodes diff --git a/test/bdd/steps/api/resolve.js b/test/bdd/steps/api/resolve.js index cbe1e9a688..dbd74ad950 100644 --- a/test/bdd/steps/api/resolve.js +++ b/test/bdd/steps/api/resolve.js @@ -13,18 +13,24 @@ When( 'Last publish data is undefined. Publish is not finalized.', ).to.be.equal(true); // const assertionIds = [this.state.lastPublishData.result.assertion.id]; - const result = await this.state.nodes[node - 1].client - .getResult(this.state.lastPublishData.UAL) - .catch((error) => { - assert.fail(`Error while trying to resolve assertion. ${error}`); - }); - const { operationId } = result.operation; - this.state.lastResolveData = { - nodeId: node - 1, - operationId, - result, - }; + // TODO: CALLING GET RESULT WITH WRONG UAL RETURNS UNDEFINED RESULT, IT SHOULD PROBABLY RETURN A FAILED RESULT MESSAGE OR SOMETHING LIKE THAT + try { + const result = await this.state.nodes[node - 1].client + .getResult(this.state.lastPublishData.UAL) + .catch((error) => { + assert.fail(`Error while trying to resolve assertion. ${error}`); + }); + const { operationId } = result.operation; + + this.state.lastResolveData = { + nodeId: node - 1, + operationId, + result, + }; + } catch (e) { + this.logger.log(`Error while getting operation result: ${e}`); + } }, ); @@ -77,7 +83,7 @@ Given( 'Last get result data is undefined. Get result not started.', ).to.be.equal(true); expect( - !!this.state.lastResolveData.result, + !!this.state.lastResolveData.result.operation, 'Last get result data result is undefined. Get result is not finished.', ).to.be.equal(true);