ljmotta commented on code in PR #3129:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3129#discussion_r2086474652


##########
packages/dmn-editor/tests-e2e/drgElements/addDecision.spec.ts:
##########
@@ -33,10 +33,11 @@ test.describe("Add node - Decision", () => {
         await palette.dragNewNode({ type: NodeType.DECISION, targetPosition: { 
x: 100, y: 100 } });
 
         await expect(nodes.get({ name: DefaultNodeName.DECISION 
})).toBeAttached();
-        await 
expect(diagram.get()).toHaveScreenshot("add-decision-node-from-palette.png");
+        // await 
expect(diagram.get()).toHaveScreenshot("add-decision-node-from-palette.png");
 
         // JSON model assertions
         const decision = await jsonModel.drgElements.getDecision({ 
drgElementIndex: 0, drdIndex: 0 });
+        console.log(decision);

Review Comment:
   Leftover?



##########
packages/dmn-editor/tests-e2e/drgDataTypes/deleteDataType.spec.ts:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Delete - Data Type", () => {
+  test(`Should delete a data type `, async ({ jsonModel, editor, dataTypes, 
page }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      typeRef: dataType["typeRef"],
+    });

Review Comment:
   For this case, I don't think we need to assert the `dataType` before the 
removal, but instead we need to assert after the removal.



##########
packages/dmn-editor/tests-e2e/drgDataTypes/copyPasteDataType.spec.ts:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Copy and Paste Data Type", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test("Should copy and paste data type - empty state", async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });

Review Comment:
   same



##########
packages/dmn-editor/tests-e2e/drgDataTypes/createDataTypeWithoutConstraint.spec.ts:
##########
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Create Data Types - Without Constraint", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test(`Create data type - Undefined`, async ({ jsonModel, dataTypes }) => {
+    await dataTypes.changeDataTypeName({ newName: 
DefaultDataTypeName.Undefined });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });

Review Comment:
   The ` description` is missing in the other test cases.



##########
packages/dmn-editor/tests-e2e/drgDataTypes/copyPasteDataType.spec.ts:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Copy and Paste Data Type", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test("Should copy and paste data type - empty state", async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });
+
+    //copy data type
+    await context.grantPermissions(["clipboard-read", "clipboard-write"]);
+    await dataTypes.get().getByLabel("Action").click();
+    await page.getByRole("menuitem").getByText("Copy", { exact: true 
}).click();
+
+    //remove data type
+    await dataTypes.get().getByLabel("Action").click();
+    await page.getByRole("menuitem").getByText("Remove", { exact: true 
}).click();
+    await 
expect(dataTypes.get()).toHaveScreenshot("copy-paste-data-type-after-remove.png");
+
+    //paste copied first data type
+    await dataTypes.pasteFirstDataType();
+    await 
expect(dataTypes.get()).toHaveScreenshot("copy-paste-data-type-empty-state.png");
+  });
+
+  test(`Should copy and paste data type - non empty state`, async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });

Review Comment:
   As mentioned in another test, I think the assertion should be the last 
operation, so we can be sure the model is as expected.



##########
packages/dmn-editor/tests-e2e/drgDataTypes/createDataTypeWithConstraint.spec.ts:
##########
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Create Data Types - With Constraint", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test(`Create Any data type - Expression Constraint`, async ({ jsonModel, 
dataTypes }) => {
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+    await dataTypes.getExpressionConstraintButton().click();
+    await dataTypes.addExpressionConstraint({ value: "> 20" });
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      typeRef: dataType["typeRef"],
+      typeConstraint: {
+        "@_id": dataType.typeConstraint?.["@_id"],
+        text: { __$$text: dataType.typeConstraint?.text.__$$text },
+        "@_kie:constraintType": 
dataType.typeConstraint?.["@_kie:constraintType"],

Review Comment:
   For this case, I think it would be better to write the expected values 
instead of using the `dataType` object.
   I mean, we can't be sure of the values here. So you can repeat the valeus "> 
20" and "Expression" in the object. For the `kie:constraintType` you can use a 
enumeration. This applies for the other cases as well.



##########
packages/dmn-editor/tests-e2e/drgDataTypes/copyPasteDataType.spec.ts:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Copy and Paste Data Type", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test("Should copy and paste data type - empty state", async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });
+
+    //copy data type
+    await context.grantPermissions(["clipboard-read", "clipboard-write"]);
+    await dataTypes.get().getByLabel("Action").click();
+    await page.getByRole("menuitem").getByText("Copy", { exact: true 
}).click();
+
+    //remove data type
+    await dataTypes.get().getByLabel("Action").click();
+    await page.getByRole("menuitem").getByText("Remove", { exact: true 
}).click();
+    await 
expect(dataTypes.get()).toHaveScreenshot("copy-paste-data-type-after-remove.png");
+
+    //paste copied first data type
+    await dataTypes.pasteFirstDataType();
+    await 
expect(dataTypes.get()).toHaveScreenshot("copy-paste-data-type-empty-state.png");
+  });
+
+  test(`Should copy and paste data type - non empty state`, async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });
+
+    //copy data type
+    await context.grantPermissions(["clipboard-read", "clipboard-write"]);

Review Comment:
   Please, add the permission in the `beforeEach` using the `clipboard.setup` 
method.



##########
packages/dmn-editor/tests-e2e/drgDataTypes/copyPasteDataType.spec.ts:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 { test, expect } from "../__fixtures__/base";
+import { DataType, DefaultDataTypeName, DMN15_SPEC_TYPE_LANGUAGE } from 
"../__fixtures__/dataTypes";
+import { TabName } from "../__fixtures__/editor";
+
+test.describe("Copy and Paste Data Type", () => {
+  test.beforeEach(async ({ editor, dataTypes }) => {
+    await editor.open();
+    await editor.changeTab({ tab: TabName.DATA_TYPES });
+    await dataTypes.createFirstCustonDataType();
+  });
+
+  test("Should copy and paste data type - empty state", async ({
+    jsonModel,
+    browserName,
+    context,
+    dataTypes,
+    page,
+  }) => {
+    test.skip(
+      browserName === "webkit",
+      "Playwright Webkit doesn't support clipboard permissions: 
https://github.com/microsoft/playwright/issues/13037";
+    );
+
+    //create any data type without constaint
+    await dataTypes.changeDataTypeName({ newName: DefaultDataTypeName.Any });
+    await dataTypes.addDataTypeDescription({ newDescription: "New Data Type 
Description" });
+    await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Any });
+
+    const dataType = await jsonModel.drgDataType.getDataType({ 
drgDataTypeIndex: 0, drdIndex: 0 });
+    expect(dataType).toEqual({
+      "@_id": dataType["@_id"],
+      "@_name": DefaultDataTypeName.Any,
+      "@_isCollection": dataType["@_isCollection"],
+      "@_typeLanguage": DMN15_SPEC_TYPE_LANGUAGE,
+      description: { __$$text: "New Data Type Description" },
+      typeRef: dataType["typeRef"],
+    });
+
+    //copy data type
+    await context.grantPermissions(["clipboard-read", "clipboard-write"]);

Review Comment:
   Same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to