diff --git a/cypress/e2e/frontend/test_1_runQuery.cy.js b/cypress/e2e/frontend/test_1_runQuery.cy.js index 76e8039095..d20a199c3e 100644 --- a/cypress/e2e/frontend/test_1_runQuery.cy.js +++ b/cypress/e2e/frontend/test_1_runQuery.cy.js @@ -12,7 +12,7 @@ describe("Run query", () => { visitWithToken(USER_TOKEN_WITH_PERMISSIONS); }); - it.skip("Can execute query and see it in the queries tab", () => { + it("Can execute query and see it in the queries tab", () => { cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor"); // Drag concept to editor @@ -42,7 +42,7 @@ describe("Run query", () => { cy.get("@queryEditor").contains("Ergebnisse"); }); - it.skip("Can see the executed query in the queries tab", () => { + it("Can see the executed query in the queries tab", () => { cy.get('[data-test-id="left-pane"]').contains("Anfragen").click(); cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer"); @@ -51,7 +51,7 @@ describe("Run query", () => { cy.get("@leftPaneContainer").contains("Concept1"); }); - it.skip("Can delete the query", () => { + it("Can delete the query", () => { cy.get('[data-test-id="left-pane"]').contains("Anfragen").click(); cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer"); @@ -106,4 +106,43 @@ describe("Reference list", () => { cy.get('@queryEditor').find('[data-test-id="query-group"]').contains("My List") }) + it("Use reference list to resolve filter values", () =>{ + cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor"); + + // We need force here because the input is invisible + cy.get("@queryEditor").get('input[type=file]').selectFile('cypress/support/test_data/filter_value_reference_list.txt', {"force": true}) + cy.get('@queryEditor') + .find('[data-test-id="uploadConceptListModal"]') + .as("uploadConceptListModal") + .find('[data-test-id="selection-dropdown"]').click() + + // Choose a concept + cy.get('@uploadConceptListModal') + .find('[data-test-id="select-options"]').contains("connector1").first().click() + + // We expect that one value 'b' cannot be resolved + cy.get('@uploadConceptListModal').contains("1 Wert nicht aufgelöst") + cy.get('@uploadConceptListModal').find('[data-test-id="unresolvable-list"]').contains('b') + // 'a1' can be resolved + cy.get('@uploadConceptListModal').contains("2 Werte aufgelöst.") + + // Change list name + cy.get('@uploadConceptListModal').find('[data-test-id="insert-form"]').as("insert-form") + cy.get('@insert-form').find('input[type=text]').should('have.value', 'filter_value_reference_list') + cy.get('@insert-form').find('button[type=button]').click() + cy.get('@insert-form').find('input[type=text]').type("My List") + + // Insert elements + cy.get('@uploadConceptListModal').find('[data-test-id="insert"]').click() + + // Check that node was inserted in query editor + cy.get('@queryEditor').find('[data-test-id="query-group"]').contains("MultiConnector").click() + + // Check that filter values are set corretly + cy.get("@queryEditor") + .find('[data-test-id="table-filter-dataset1.multiconnector.connector1.big_multi_select"]').as("multi_select") + cy.get("@multi_select").scrollIntoView() + cy.get("@multi_select").find('p').eq(0).contains('a') + cy.get("@multi_select").find('p').eq(1).contains('abc') + }) }) \ No newline at end of file diff --git a/cypress/support/test_data/all_types.table copy.json b/cypress/support/test_data/all_types.table copy.json new file mode 100644 index 0000000000..8e994da651 --- /dev/null +++ b/cypress/support/test_data/all_types.table copy.json @@ -0,0 +1,41 @@ +{ + "name": "table", + "columns": [ + { + "name": "id", + "type": "STRING" + }, + { + "name": "STRING", + "type": "STRING" + }, + { + "name": "INTEGER", + "type": "INTEGER" + }, + { + "name": "BOOLEAN", + "type": "BOOLEAN" + }, + { + "name": "REAL", + "type": "REAL" + }, + { + "name": "DECIMAL", + "type": "DECIMAL" + }, + { + "name": "MONEY", + "type": "MONEY" + }, + { + "name": "DATE", + "type": "DATE" + }, + { + "name": "DATE_RANGE", + "type": "DATE_RANGE" + } + ] +} \ No newline at end of file diff --git a/cypress/support/test_data/filter_value_reference_list.txt b/cypress/support/test_data/filter_value_reference_list.txt new file mode 100644 index 0000000000..aa1727a649 --- /dev/null +++ b/cypress/support/test_data/filter_value_reference_list.txt @@ -0,0 +1,3 @@ +a +abc +b diff --git a/cypress/support/test_data/multi_connector.concept.json b/cypress/support/test_data/multi_connector.concept.json index e6297081f0..d9d22dec0a 100644 --- a/cypress/support/test_data/multi_connector.concept.json +++ b/cypress/support/test_data/multi_connector.concept.json @@ -6,17 +6,6 @@ { "name": "connector0", "column": "table.STRING", - "validityDatesDescription": "Tooltip for the available validity dates", - "validityDates": [ - { - "label": "DATE", - "column": "table.DATE" - }, - { - "label": "DATE_RANGE", - "column": "table.DATE_RANGE" - } - ], "filters": [ { "label": "BIG_MULTI_SELECT", @@ -29,24 +18,17 @@ }, { "name": "connector1", - "column": "table.STRING", - "validityDatesDescription": "Tooltip for the available validity dates", - "validityDates": [ - { - "label": "DATE", - "column": "table.DATE" - }, - { - "label": "DATE_RANGE", - "column": "table.DATE_RANGE" - } - ], + "column": "table1.STRING", "filters": [ { "label": "BIG_MULTI_SELECT", - "column": "table.STRING", + "column": "table1.STRING", "type": "BIG_MULTI_SELECT", - "allowDropFile": true + "allowDropFile": true, + "labels": { + "Value A": "a", + "Value A1": "a1" + } } ], "selects": [] diff --git a/cypress/support/test_data/table1.csv b/cypress/support/test_data/table1.csv new file mode 100644 index 0000000000..f2acb0ce6b --- /dev/null +++ b/cypress/support/test_data/table1.csv @@ -0,0 +1,2 @@ +id,STRING +1,abc \ No newline at end of file diff --git a/cypress/support/test_data/table1.import.json b/cypress/support/test_data/table1.import.json new file mode 100644 index 0000000000..281aac393e --- /dev/null +++ b/cypress/support/test_data/table1.import.json @@ -0,0 +1,31 @@ +{ + "inputs": [ + { + "output": [ + { + "inputColumn": "id", + "name": "id", + "inputType": "STRING", + "operation": "COPY" + }, + { + "inputColumn": "STRING", + "name": "STRING", + "inputType": "STRING", + "operation": "COPY" + } + ], + "primary": { + "inputColumn": "id", + "inputType": "STRING", + "name": "id", + "operation": "COPY", + "required": true + }, + "sourceFile": "table1.csv" + } + ], + "label": "Table 1", + "name": "table1", + "table": "table1" +} \ No newline at end of file diff --git a/cypress/support/test_data/table1.table.json b/cypress/support/test_data/table1.table.json new file mode 100644 index 0000000000..8175103b5a --- /dev/null +++ b/cypress/support/test_data/table1.table.json @@ -0,0 +1,13 @@ +{ + "name": "table1", + "columns": [ + { + "name": "id", + "type": "STRING" + }, + { + "name": "STRING", + "type": "STRING" + } + ] +} \ No newline at end of file diff --git a/scripts/load_e2e_data.sh b/scripts/load_e2e_data.sh index 3347a84709..7ab6c404d0 100755 --- a/scripts/load_e2e_data.sh +++ b/scripts/load_e2e_data.sh @@ -14,7 +14,7 @@ until $(curl --output /dev/null --silent --head -H "$h_auth" --fail $admin_api/u done echo "Preprocess test data" -java -jar ./executable/target/executable*.jar preprocess --in cypress/support/test_data/ --out cypress/support/test_data/ --desc cypress/support/test_data/data.import.json +java -jar ./executable/target/executable*.jar preprocess --in cypress/support/test_data/ --out cypress/support/test_data/ --desc cypress/support/test_data/*.import.json # Create users echo "Creating users and permissions" @@ -35,7 +35,10 @@ sleep 3 # TODO secondary ID echo "Creating tables" -curl --fail -X POST "$admin_api/datasets/dataset1/tables" -H "$h_ct" -H "$h_auth" -d "@./cypress/support/test_data/all_types.table.json" +for table_json in `ls ./cypress/support/test_data/*.table.json` +do + curl --fail -X POST "$admin_api/datasets/dataset1/tables" -H "$h_ct" -H "$h_auth" -d "@$table_json" +done sleep 3 echo "Creating concepts" @@ -45,6 +48,12 @@ do done echo "Upload test data" -curl --fail -X POST --compressed "$admin_api/datasets/dataset1/cqpp" -H "content-type:application/octet-stream" -H "$h_auth" --data-binary "@./cypress/support/test_data/table.cqpp" +for cqpp in `ls ./cypress/support/test_data/*.cqpp` +do + curl --fail -X POST --compressed "$admin_api/datasets/dataset1/cqpp" -H "content-type:application/octet-stream" -H "$h_auth" --data-binary "@$cqpp" +done + +echo "Init Matching Stats and Search" +curl --fail -X POST "$admin_api/datasets/dataset1/update-matching-stats" -H "$h_ct" -H "$h_auth" echo "Done loading data"