Conversation
| */ | ||
| public class ODPLocators { | ||
|
|
||
| @FindBy(how = How.XPATH, using = "//*[contains(text(),'SAP ODP')]") |
There was a problem hiding this comment.
should use something like @FindBy(how = How.XPATH, using = "//*[@data-cy=\"plugin-SapOdp-batchsource\"]") here
| @FindBy(how = How.XPATH, using = "//*[contains(text(),'SAP ODP')]") | ||
| public static WebElement sapODPSource; | ||
|
|
||
| @FindBy(how = How.XPATH, using = "//*[contains(text(),'-SNAPSHOT')]") |
There was a problem hiding this comment.
can this locator be made more specific so that it is used to locate properties of SAP ODP plugin specifically?because there can be other plugins as well which can match this.
| @When("User has selected Sap client macro to configure") | ||
| public void userHasSelectedSapClientMacroToConfigure() { | ||
| ODPLocators.macros.get(0).click(); | ||
| ODPLocators.sapClient.sendKeys(Keys.chord(Keys.CONTROL, A)); |
There was a problem hiding this comment.
concerned if this operation is OS specific because in MAC we use CMD+A to perform this operation?
If the use case is to clear the input text and add value can we use SeleniumHelper.replaceElementValue() for this? @rmstar what do you think?
| @When("User has selected Sap language macro to configure") | ||
| public void userHasSelectedSapLagMacroToConfigure() { | ||
| ODPLocators.macros.get(1).click(); | ||
| ODPLocators.language.sendKeys(Keys.chord(Keys.CONTROL, A)); |
There was a problem hiding this comment.
similar comment as above in the whole PR wherever (Keys.CONTROL, A) is used.
| public static WebElement validateButton; | ||
|
|
||
| @FindBy(how = How.XPATH, using = "//*[@data-cy='plugin-validation-success-msg']") | ||
| public static WebElement successMessage; |
There was a problem hiding this comment.
successMessage -> pluginValidationSuccessMsg
|
|
||
| @When("User has selected Sap server as host macro to configure") | ||
| public void userHasSelectedSapServerAsHostMacroToConfigure() { | ||
| ODPLocators.macros.get(2).click(); |
There was a problem hiding this comment.
Is there any better way to handle this? This makes the test brittle. In future, if the plugin configs order is changed then whole test will break! @rmstar What do you think?
There was a problem hiding this comment.
@itsankit-google I dont think so we can handle it any other way as these macros are in a single class only the index is the difference. If order changes then we need to again change the order of identification
There was a problem hiding this comment.
yeah seems brittle.. what happens if a new config param is added? would that affect the index of other macros?
would be good if we can find a better way to handle it.
There was a problem hiding this comment.
got the solution for every macro element we can capture an object path will remain constant- //*[@data-cy="jco.client.ashost"]//child::button//span//span//strong only the data-cy value will be changed. @sumitnigamcs please capture all the macros seprately and call via name
|
|
||
| @When("User has selected System Number macro to configure") | ||
| public void userHasSelectedSystemNumberMacroToConfigure() { | ||
| ODPLocators.macros.get(3).click(); |
There was a problem hiding this comment.
similar comment as above in the whole PR wherever macros are used.
| InputStream input; | ||
| Properties connection = new SAPProperties(); | ||
| input = new FileInputStream("src/e2e-test/resources/Google_SAP_Connection.properties"); | ||
| prop.load(input); |
There was a problem hiding this comment.
can we load property file once instead on every call?
| @Then("Get Count of no of records transferred from ODP to BigQuery in {string}") | ||
| public void getCountOfNoOfRecordsTransferredFromODPToBigQueryIn(String table) throws | ||
| IOException, InterruptedException { | ||
| countRecords = gcpClient.countBqQuery(CDAPUtils.getPluginProp(table)); |
There was a problem hiding this comment.
Here, we should also verify the metric in the UI, no of records out from the source to the no of records in sink.
There was a problem hiding this comment.
will fix this in CDAP-18634
pom.xml
Outdated
| <version>3.0.0-M5</version> | ||
| <configuration> | ||
| <includes> | ||
| <include>TestRunner.java, TestRunnerMand.java, TestRunnerOpt.java</include> |
There was a problem hiding this comment.
Use pattern instead of listing all classes
There was a problem hiding this comment.
@tivv since we have to maintain the execution order of the TestRunners, we had to add the runner filenames like this. We have to make sure TestRunnerOpt runs in the end, else it will impact TestRunnerMand
There was a problem hiding this comment.
Why do we need an execution order? It sounds like an issue. All tests must be independent. One should be able to run any test separately or tests in any sequence. That's basic principle.
There was a problem hiding this comment.
@tivv For config driven scenarios, wherein we are implementing cucumberJvm plugin, we are loading optional properties on the run, once they are loaded, the scenarios with only mandatory fields will not run. So mandatory field scenario should run first, then plugin loading the optional properties should execute followed by optional field scenarios. Suggest if I am not able to put forward my point, or if I am missing something to make the scenarios more independent
There was a problem hiding this comment.
Sure, could you please clarify in more details. Overall approach is that tests must be self-contained and do any necessary clean-up as needed. Why is it not possible here?
pom.xml
Outdated
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> |
There was a problem hiding this comment.
why are we adding a guava dependency here?
There was a problem hiding this comment.
I tried adding inside e2e-tests profile but it was not getting resolved there.
There was a problem hiding this comment.
What are the issues? The way it's not it's not going to fly. Guava versioning is pretty tricky, so we must not add it to production code unless needed by production code
There was a problem hiding this comment.
Hi @tivv I have removed guava from main dependency section, moved it to profile's dependency management, along with adding it to classpath via profile's maven-dependency-plugin. Please confirm if this is fine
pom.xml
Outdated
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> |
There was a problem hiding this comment.
why are these added outside e2e-tests profile?
There was a problem hiding this comment.
removed, these were rather duplicate
| /** | ||
| * DesginTimeODP. | ||
| */ | ||
| public class DesginTimeODP { |
| @When("User has selected Sap msServ macro to configure") | ||
| public void userHasSelectedSapMsServMacroToConfigure() { | ||
| ODPLocators.macros.get(4).click(); | ||
| SeleniumHelper.replaceElementValue(ODPLocators.portNumber, "${portN0}"); |
| @When("User has selected Sap msHost macro to configure") | ||
| public void userHasSelectedSapMsHostMacroToConfigure() { | ||
| ODPLocators.macros.get(2).click(); | ||
| SeleniumHelper.replaceElementValue(ODPLocators.msHost, "${msHOst}"); |
There was a problem hiding this comment.
Thats a macro variable which we have taken.
| JsonNode response = sapAdapterImpl.executeRFC(objectNode.toString(), opProps, | ||
| StringUtils.EMPTY, StringUtils.EMPTY); | ||
| } catch (Exception e) { | ||
| throw SystemException.throwException(e.getMessage(), e); |
There was a problem hiding this comment.
to abort the scenario in case record is not created
| (table) + "` WHERE " + | ||
| field.toUpperCase(); | ||
| switch (datasource) { | ||
| case "0MATERIAL_ATTR": |
There was a problem hiding this comment.
use constants for datasources and actions if possible
| static String deltaLog; | ||
| static String rawLog; | ||
| static PrintWriter out; | ||
| private List<String> numList = new ArrayList<>(); |
There was a problem hiding this comment.
what is stored in numList? maybe use a more descriptive name?
| field.toUpperCase(); | ||
| switch (datasource) { | ||
| case "0MATERIAL_ATTR": | ||
| for (i = 0; i < numList.size(); i++) { |
There was a problem hiding this comment.
for (String thing : numList) {
// do stuff with thing
}
| BeforeActions.scenario.write("Table Deleted Successfully"); | ||
| } | ||
| } catch (Exception e) { | ||
| BeforeActions.scenario.write(e.toString()); |
There was a problem hiding this comment.
should we fail the test if an exception was thrown?
There was a problem hiding this comment.
No we should not fail as if the table is not found in the catch block it will return table not found and we have written the same in the report.
tivv
left a comment
There was a problem hiding this comment.
What are the jars added? It's usually an antipattern as we must be very careful on versioning / licensing / availability.
Hi @tivv , we have added the jar com.google.adapter.cs-0.0.1.jar, which has JCO connectors for record creation deletion and updation. Please suggest if there is any other way to use the jar through artifactory or something |
|
POMs look good. What's about the jars? I don't think we can include them like this |
|
Removed the jars, and added github actions details to README, and a mention about it in pom. Please have a look |
|
@tivv @rmstar @itsankit-google all review comments addressed. Please review, mainly on the jars removal. |
Please review