Skip to content

Commit

Permalink
adds e2e test for filter value resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
thoniTUB committed Nov 29, 2024
1 parent fe8e705 commit 94cbd57
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 31 deletions.
45 changes: 42 additions & 3 deletions cypress/e2e/frontend/test_1_runQuery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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')
})
})
41 changes: 41 additions & 0 deletions cypress/support/test_data/all_types.table copy.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
3 changes: 3 additions & 0 deletions cypress/support/test_data/filter_value_reference_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a
abc
b
32 changes: 7 additions & 25 deletions cypress/support/test_data/multi_connector.concept.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": []
Expand Down
2 changes: 2 additions & 0 deletions cypress/support/test_data/table1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,STRING
1,abc
31 changes: 31 additions & 0 deletions cypress/support/test_data/table1.import.json
Original file line number Diff line number Diff line change
@@ -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"
}
13 changes: 13 additions & 0 deletions cypress/support/test_data/table1.table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "table1",
"columns": [
{
"name": "id",
"type": "STRING"
},
{
"name": "STRING",
"type": "STRING"
}
]
}
15 changes: 12 additions & 3 deletions scripts/load_e2e_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit 94cbd57

Please sign in to comment.