Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e BigQueryArgumentSetter Test Scenarios #1168

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@BigQueryArgumentSetter
Feature: BigQuery Argument Setter - Validate BigQuery Argument Setter Plugin Error Scenarios

Scenario: Verify BigQuery Argument Setter plugin properties validation errors for mandatory fields
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
When Select plugin: "BigQuery Argument Setter" from the plugins list as: "Conditions and Actions"
When Navigate to the properties page of plugin: "BigQuery Argument Setter"
Then Click on the Validate button
Then Verify mandatory property error for below listed properties:
| dataset |
| table |
| argumentSelectionConditions |
| argumentsColumns |

Scenario:Verify BigQuery Argument Setter plugin properties validation errors for blank data in Argument selection value field
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
When Select plugin: "BigQuery Argument Setter" from the plugins list as: "Conditions and Actions"
When Navigate to the properties page of plugin: "BigQuery Argument Setter"
Then Replace input plugin property: "project" with value: "projectId"
Then Enter input plugin property: "datasetProject" with value: "projectId"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Enter key value pairs for plugin property: "bqArgumentSetterConditionField" with values from json: "bqArgumentSetterBlankArgSelectionConditionValue"
Then Enter the Arguments Columns field as list "bqArgumentSetterInvalidColumn"
Then Override Service account details if set in environment variables
Then Click on the Validate button
Then Verify that the Plugin Property: "argumentSelectionConditions" is displaying an in-line error message: "errorMessageBlankBQArgumentColumnName"
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
@BigQueryArgumentSetter
Feature: BigQuery Argument Setter - e2e data transfer with source and sink

@BQ_ARGUMENT_SETTER_TEST @BQ_SOURCE_TEST @BQ_SINK_TEST
Scenario: Verify BigQuery Argument Setter plugin functionality using BigQuery to BigQuery pipeline
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery" from the plugins list as: "Sink"
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
When Select plugin: "BigQuery Argument Setter" from the plugins list as: "Conditions and Actions"
Then Connect plugins: "BigQuery Argument Setter" and "BigQuery2" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery" to establish connection
When Navigate to the properties page of plugin: "BigQuery Argument Setter"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "datasetProjectId" with value: "projectId"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Enter key value pairs for plugin property: "bqArgumentSetterConditionField" with values from json: "bqArgumentSetterConditionName"
Then Enter the Arguments Columns field as list "bqArgumentSetterColumnValue"
Then Override Service account details if set in environment variables
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceName"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceNameSink"
Then Click on the Macro button of Property: "dataset" and set the value to: "dataset"
Then Enter input plugin property: "table" with value: "bqTargetTable"
Then Click on the Validate button
Then Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Run the Pipeline in Runtime with runtime arguments
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate records transferred to target table is equal to number of records from source table

@BQ_ARGUMENT_SETTER_TEST @BQ_SOURCE_TEST @BQ_SINK_TEST
Scenario: Verify BigQuery Argument Setter plugin functionality with multiple arguments using BigQuery to BigQuery pipeline
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery" from the plugins list as: "Sink"
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
When Select plugin: "BigQuery Argument Setter" from the plugins list as: "Conditions and Actions"
Then Connect plugins: "BigQuery Argument Setter" and "BigQuery2" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery" to establish connection
When Navigate to the properties page of plugin: "BigQuery Argument Setter"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "datasetProjectId" with value: "projectId"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Enter key value pairs for plugin property: "bqArgumentSetterConditionField" with values from json: "bqArgumentSetterConditionName2"
Then Enter the Arguments Columns field as list "bqArgumentSetterColumnValue"
Then Override Service account details if set in environment variables
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceName"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceNameSink"
Then Click on the Macro button of Property: "dataset" and set the value to: "dataset"
Then Enter input plugin property: "table" with value: "bqTargetTable"
Then Click on the Validate button
Then Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Run the Pipeline in Runtime with runtime arguments
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate records transferred to target table is equal to number of records from source table

@BQ_ARGUMENT_SETTER_TEST @BQ_SOURCE_TEST @BQ_SINK_TEST
Scenario: Verify BigQuery Argument Setter e2e data transfer with Invalid Values
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery" from the plugins list as: "Sink"
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
When Select plugin: "BigQuery Argument Setter" from the plugins list as: "Conditions and Actions"
Then Connect plugins: "BigQuery Argument Setter" and "BigQuery2" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery" to establish connection
When Navigate to the properties page of plugin: "BigQuery Argument Setter"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "datasetProjectId" with value: "projectId"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Enter key value pairs for plugin property: "bqArgumentSetterConditionField" with values from json: "bqArgumentSetterConditionInvalidName"
Then Enter the Arguments Columns field as list "bqArgumentSetterColumnValue"
Then Override Service account details if set in environment variables
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceName"
Then Enter input plugin property: "dataset" with value: "dataset"
Then Enter input plugin property: "table" with value: "bqSourceTable"
Then Click on the Validate button
Then Close the Plugin Properties page
When Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "projectId" with value: "projectId"
Then Enter input plugin property: "datasetProjectId" with value: "projectId"
Then Override Service account details if set in environment variables
Then Enter input plugin property: "referenceName" with value: "bqArgumentSetterReferenceNameSink"
Then Click on the Macro button of Property: "dataset" and set the value to: "dataset"
Then Enter input plugin property: "table" with value: "bqTargetTable"
Then Click on the Validate button
Then Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Run the Pipeline in Runtime with runtime arguments
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Failed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright © 2022 Cask Data, Inc.
*
* 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.
*/
package io.cdap.plugin.bigqueryargumentsetter.actions;

import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.SeleniumHelper;
import io.cdap.plugin.bigqueryargumentsetter.locators.BQArgumentSetterLocators;
import io.cucumber.core.logging.Logger;
import io.cucumber.core.logging.LoggerFactory;

/**
* BQArgumentSetter plugin step actions.
*/
public class BQArgumentSetterActions {
private static final Logger logger = (Logger) LoggerFactory.getLogger(BQArgumentSetterActions.class);

static {
SeleniumHelper.getPropertiesLocators(BQArgumentSetterLocators.class);
}

public static void enterArgumentColumn(int row, String argumentColumn) {
ElementHelper.sendKeys(BQArgumentSetterLocators.locateArgumentColumn(row), argumentColumn);
}

public static void clickArgumentColumnsAddRowButton(int row) {
ElementHelper.clickOnElement(BQArgumentSetterLocators.locateArgumentColumnsAddRowButton(row));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Package contains the step actions for the bigquery argument setter features.
*/
package io.cdap.plugin.bigqueryargumentsetter.actions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright © 2022 Cask Data, Inc.
*
* 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.
*/
package io.cdap.plugin.bigqueryargumentsetter.locators;

import io.cdap.e2e.utils.SeleniumDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
* BQArgumentSetter Related Locators.
*/
public class BQArgumentSetterLocators {
public static WebElement locateArgumentColumn(int row) {
String xpath = "//*[@data-cy='argumentsColumns']//*[@data-cy= '" + row + "']//*[@data-cy='key']/input";
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
}

public static WebElement locateArgumentColumnsAddRowButton(int row) {
String xpath = "//*[@data-cy='argumentsColumns']//*[@data-cy='" + row + "']//button[@data-cy='add-row']";
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Package contains the locators for the BQ Argument Setter plugin.
*/
package io.cdap.plugin.bigqueryargumentsetter.locators;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright © 2022 Cask Data, Inc.
*
* 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.
*/
package io.cdap.plugin.bigqueryargumentsetter.runners;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

/**
* Test Runner to execute BQArgumentSetter action cases.
*/
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/e2e-test/features"},
glue = {"io.cdap.plugin.bigqueryargumentsetter.stepsdesign", "stepsdesign",
"io.cdap.plugin.common.stepsdesign"},
tags = {"@BigQueryArgumentSetter"},
monochrome = true,
plugin = {"pretty", "html:target/cucumber-html-report/bigqueryargumentsetter",
"json:target/cucumber-reports/cucumber-bigqueryargumentsetter.json",
"junit:target/cucumber-reports/cucumber-bigqueryargumentsetter.xml"}
)
public class TestRunner {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Package contains the runner for the bqArgumentSetter features.
*/
package io.cdap.plugin.bigqueryargumentsetter.runners;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright © 2022 Cask Data, Inc.
*
* 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.
*/
package io.cdap.plugin.bigqueryargumentsetter.stepsdesign;

import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.plugin.bigqueryargumentsetter.actions.BQArgumentSetterActions;
import io.cucumber.java.en.Then;

/**
* BQArgumentSetter Action related stepDesigns.
*/

public class BQArgumentSetter {

@Then("Enter the Arguments Columns field as list {string}")
public void enterTheArgumentsColumnsFieldAsList(String commaSeparatedFieldList) {
String[] fields = PluginPropertyUtils.pluginProp(commaSeparatedFieldList).split(",");
for (int index = 0; index < fields.length; index++) {
if (index != 0) {
BQArgumentSetterActions.clickArgumentColumnsAddRowButton(index - 1);
}
BQArgumentSetterActions.enterArgumentColumn(index, fields[index]);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Package contains the stepDesign for the BQ Argument Setter features.
*/
package io.cdap.plugin.bigqueryargumentsetter.stepsdesign;
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ public static void createTempSourceBQTable() throws IOException, InterruptedExce
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " created successfully");
}

@After(order = 1, value = "@BQ_SOURCE_TEST or @BQ_PARTITIONED_SOURCE_TEST or @BQ_SOURCE_DATATYPE_TEST")
@After(order = 1, value = "@BQ_SOURCE_TEST or @BQ_PARTITIONED_SOURCE_TEST or @BQ_SOURCE_DATATYPE_TEST or " +
" @BQ_ARGUMENT_SETTER_TEST")
public static void deleteTempSourceBQTable() throws IOException, InterruptedException {
BigQueryClient.dropBqQuery(bqSourceTable);
PluginPropertyUtils.removePluginProp("bqSourceTable");
Expand Down Expand Up @@ -732,4 +733,9 @@ private static void deleteConnection(String connectionType, String connectionNam
CdfConnectionActions.selectConnectionAction(connectionType, connectionName, "Delete");
CdfPluginPropertiesActions.clickPluginPropertyButton("Delete");
}
@Before(order = 1, value = "@BQ_ARGUMENT_SETTER_TEST")
public static void createSourceBQTable() throws IOException, InterruptedException {
createSourceBQTableWithQueries(PluginPropertyUtils.pluginProp("bqArgumentSetterCreateTableQueryFile"),
PluginPropertyUtils.pluginProp("bqArgumentSetterInsertDataQueryFile"));
}
}
1 change: 1 addition & 0 deletions src/e2e-test/resources/errorMessage.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ errorMessageIncorrectBQChunkSize=Value must be a multiple of 262144.
errorMessageIncorrectBQBucketName=Bucket name can only contain lowercase letters, numbers, '.', '_', and '-'.
errorMessageIncorrectBQProperty=PROPERTY name can only contain letters (lower or uppercase), numbers and '_'.
errorMessageInvalidPath=Error when trying to detect schema: Input path not found
errorMessageBlankBQArgumentColumnName=1 Invalid key value pair for Argument Selection Conditions.
4 changes: 4 additions & 0 deletions src/e2e-test/resources/pluginDataCyAttributes.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ testConnection=connection-test-button
connectionCreate=connection-submit-button
parsingOptionConfirm=parsing-config-confirm
## CONNECTION-MANAGEMENT-END

## BQ-ARGUMENT-SETTER-START
bqArgumentSetterConditionField=argumentSelectionConditions
## BQ-ARGUMENT-SETTER-END
Loading