Skip to content

Commit

Permalink
KOGITO-5428: Introduce DMN Runner cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozef Marko committed Sep 14, 2021
1 parent 4ddd516 commit c938dd8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
54 changes: 54 additions & 0 deletions packages/online-editor/it-tests/integration/DMNRunnerTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2021 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as buildEnv from "@kogito-tooling/build-env";

describe("DMN Runner Test", () => {
beforeEach(() => {
cy.visit(`http://localhost:${buildEnv.onlineEditor.dev.port}/`);
});

it("Test DMN Runner on DMN sample", () => {
// click Create new decision model button (new DMN)
cy.get("[data-ouia-component-id='try-dmn-sample-button']").click();

// wait until loading dialog disappears
cy.loadEditor();

// check editor logo
cy.get("[class='pf-c-brand']").within(($logo) => {
expect($logo.attr("src")).contain("dmn");
expect($logo.attr("alt")).contain("dmn");
});

// start the DMN Runner set up
cy.get("[data-ouia-component-id='dmn-guided-tour'] button").contains("Skip tour and start DMN Runner").click();

// fill in
cy.get("[data-testid='dmn-form']").within(($form) => {
cy.get("input[name='Credit Score.FICO']").type("300");
cy.get("input[name='Applicant Data.Age']").type("25");

cy.get("[x-dmn-type*='Marital_Status'] button").click();
cy.get("ul[name='Applicant Data.Marital Status'] button").contains("M").click();

// cy.get("[x-dmn-type*='Employment_Status'] button").click();
// cy.get("ul[name='Applicant Data.Employment Status'] button").contains("Employed").click();

cy.get("input[name='Applicant Data.Existing Customer']").check();
});
});
});
3 changes: 2 additions & 1 deletion packages/online-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"start": "webpack serve --host 0.0.0.0 --env dev",
"cy:open": "yarn run cypress open --project it-tests",
"cy:run": "yarn run cypress run -b chrome --project it-tests",
"test:it": "yarn run run-script-if --bool \"$(build-env global.build.testIT)\" --then \"yarn rimraf ./dist-it-tests\" \"yarn run start-server-and-test start http-get://0.0.0.0:$(build-env onlineEditor.dev.port) cy:run\""
"test:it:start:extended-services": "npm --prefix ../extended-services run start",
"test:it": "yarn run run-script-if --bool \"$(build-env global.build.testIT)\" --then \"yarn rimraf ./dist-it-tests\" \"yarn run start-server-and-test test:it:start:extended-services http-get://0.0.0.0:21345/ping start http-get://0.0.0.0:$(build-env onlineEditor.dev.port) cy:run\""
},
"babel": {
"presets": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ export function KieToolingExtendedServicesModal() {

return (
<Modal
ouiaId="kie-tooling-extended-services-modal"
isOpen={kieToolingExtendedServices.isModalOpen}
onClose={onClose}
variant={modalVariant}
Expand Down

0 comments on commit c938dd8

Please sign in to comment.