Skip to content

Commit

Permalink
Merge pull request #25 from MicroFocus/jane_fix_new_cases
Browse files Browse the repository at this point in the history
Jane fix new cases - partially matching feature names; change started time to creation time of report file
  • Loading branch information
bingyujin authored May 22, 2024
2 parents 5740344 + f049ba3 commit 76e07bf
Show file tree
Hide file tree
Showing 45 changed files with 427 additions and 69 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.microfocus.adm.almoctane.bdd</groupId>
<artifactId>bdd2octane</artifactId>
<version>1.1.7-SNAPSHOT</version>
<version>1.1.8-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>bdd2octane</name>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/microfocus/bdd/Bdd2Octane.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void run() throws IOException, XMLStreamException, InstantiationException
}

if (previousFeature != null && previousFeature != octaneFeature) {
previousFeature.setStarted(FileUtil.getFileCreationTime(file));
writeFeatureToXML(writer, previousFeature);
}
previousFeature = octaneFeature;
Expand All @@ -150,6 +151,7 @@ public void run() throws IOException, XMLStreamException, InstantiationException
count++;
}
if (previousFeature != null) {
previousFeature.setStarted(FileUtil.getFileCreationTime(file));
writeFeatureToXML(writer, previousFeature);
previousFeature = null;
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/microfocus/bdd/CucumberJvmHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ public Optional<String> getFeatureName(OctaneFeatureLocator... octaneFeatureLoca
if (octaneFeatureLocator != null && octaneFeatureLocator.length > 0) {
Optional<OctaneFeature> octaneFeatureOpt;
String classnamePart = classname;
while (classnamePart.contains("-")) {
int lastIndex = classnamePart.lastIndexOf("-");
classnamePart = classnamePart.substring(0, lastIndex).trim();
while (!classnamePart.isEmpty()) {
try {
octaneFeatureOpt = octaneFeatureLocator[0].getOctaneFeatureByName(classnamePart);
} catch (IOException e) {
Expand All @@ -203,6 +201,12 @@ public Optional<String> getFeatureName(OctaneFeatureLocator... octaneFeatureLoca
if (octaneFeatureOpt.isPresent()) {
return Optional.of(classnamePart);
}
if (classnamePart.contains("-")) {
int lastIndex = classnamePart.lastIndexOf("-");
classnamePart = classnamePart.substring(0, lastIndex).trim();
} else {
return Optional.of(classname);
}
}
}
return Optional.of(classname);
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/microfocus/bdd/FeatureFileLocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,7 @@ private Optional<FeatureFileMeta> tryToGetFeatureFileMeta(String featureName, St
}

private OctaneFeature parseFeatureFile(FeatureFileMeta featureFileMeta) {
OctaneFeature octaneFeature = GherkinDocumentUtil.generateSkeletonFeature(featureFileMeta);
String creationTime = FileUtil.getFileCreationTime(featureFileMeta.getFeatureFile());
octaneFeature.setStarted(creationTime);
return octaneFeature;
return GherkinDocumentUtil.generateSkeletonFeature(featureFileMeta);
}

private void cacheScenarios(OctaneFeature octaneFeature, FeatureFileMeta meta) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public static List<Object[]> data() {
{Framework.CUCUMBER_JVM, "src/test/resources/cucumber-jvm/3outlines/junit5_scenario_contain_hyphen_outline4.xml", "src/test/resources/features/robustgherkin_has_3_examples_feature_scenario_name_contain_hyphen.feature", "separateResults/cucumber-jvm-final14.xml", "**/separateResults/standard-cucumber-jvm-final14.xml"},
{Framework.CUCUMBER_JVM, "src/test/resources/cucumber-jvm/3outlines/junit5_scenario_outline_name_similar.xml", "src/test/resources/features/OutlineConfusion.feature", "separateResults/cucumber-jvm-final15.xml", "**/separateResults/standard-cucumber-jvm-final15.xml"},
//scenario outlines failed beforeClass case
{Framework.CUCUMBER_JVM, "src/test/resources/cucumber-jvm/3outlines/failed_scenario_outlines_without_any_failed_step_info.xml", "src/test/resources/features/check_payment_method_status.feature", "separateResults/cucumber-jvm-final16.xml", "**/separateResults/standard-cucumber-jvm-final16.xml"}

{Framework.CUCUMBER_JVM, "src/test/resources/cucumber-jvm/3outlines/failed_scenario_outlines_without_any_failed_step_info.xml", "src/test/resources/features/check_payment_method_status.feature", "separateResults/cucumber-jvm-final16.xml", "**/separateResults/standard-cucumber-jvm-final16.xml"},
//1 junit report + 3 feature files (Feature names contain hyphens and are partially same.)
{Framework.CUCUMBER_JVM, "src/test/resources/cucumber-jvm/separate-test17/junit.xml", "src/test/resources/features/ContainHyphens*.feature", "separateResults/cucumber-jvm-final17.xml", "**/separateResults/standard-cucumber-jvm-final17.xml"},
});

}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/microfocus/bdd/ut/FilesLocatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public void matchPatternFailTest() {
public void matchPatternPassTest() {
final String pattern = "src/**/*junit*.xml";
List<String> reports = FilesLocator.getReportFiles(pattern);
Assert.assertEquals(23, reports.size());
Assert.assertEquals(24, reports.size());
}
}
130 changes: 130 additions & 0 deletions src/test/resources/cucumber-jvm/separate-test17/junit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<testsuite errors="0" failures="7" name="io.cucumber.core.plugin.JUnitFormatter" skipped="0" tests="31" time="884.541">
<testcase classname="MyAccount - Footer" name="Verify Footer - Important Information About Us Hyperlink" time="157.348">
<failure message="Expected condition failed: waiting for com.hastings.automation.function.pageaction.webpageaction.ClickAction$1@7b93d7e1 (tried for 30 second(s) with 200 milliseconds interval)" type="org.openqa.selenium.TimeoutException"><![CDATA[Given User login into My Account with Multi Product Policies................passed
When User clicks on "Important Information About Us" link in My Account Footer.failed
Then User should be navigated to the respective footer page.................skipped
StackTrace:
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for com.hastings.automation.function.pageaction.webpageaction.ClickAction$1@7b93d7e1 (tried for 30 second(s) with 200 milliseconds interval)
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:263)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231)
at com.hastings.automation.function.pageaction.webpageaction.ClickAction.waitAndClickElement(ClickAction.java:45)
at com.hastings.automation.function.ui.pageobjects.digital.reactmyaccount.MaReactMarketingPreferenceOverlayPage.clickMarketingPreferenceCloseButton(MaReactMarketingPreferenceOverlayPage.java:68)
at com.hastings.automation.automationtest.bdd.definitions.stepdefinitions.digital.digitalsteps.MyAccountReactSteps.userClickOnFooterLink(MyAccountReactSteps.java:179)
at ✽.User clicks on "Important Information About Us" link in My Account Footer(classpath:src/test/resources/features/ContainHyphensFooterUIValidations.feature:51)
]]></failure>
</testcase>
<testcase classname="MyAccount - Footer" name="Verify Footer - Our Fees Hyperlink" time="172.683">
<failure message="Expected condition failed: waiting for com.hastings.automation.function.pageaction.webpageaction.ClickAction$1@149b6966 (tried for 30 second(s) with 200 milliseconds interval)" type="org.openqa.selenium.TimeoutException"><![CDATA[Given User logs into My Account with a policy...............................passed
When User clicks on "Our Fees" link in My Account Footer....................failed
Then User should be navigated to the respective footer page.................skipped
StackTrace:
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for com.hastings.automation.function.pageaction.webpageaction.ClickAction$1@149b6966 (tried for 30 second(s) with 200 milliseconds interval)
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:263)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231)
at com.hastings.automation.function.pageaction.webpageaction.ClickAction.waitAndClickElement(ClickAction.java:45)
at com.hastings.automation.function.ui.pageobjects.digital.reactmyaccount.MaReactMarketingPreferenceOverlayPage.clickMarketingPreferenceCloseButton(MaReactMarketingPreferenceOverlayPage.java:68)
at com.hastings.automation.automationtest.bdd.definitions.stepdefinitions.digital.digitalsteps.MyAccountReactSteps.userClickOnFooterLink(MyAccountReactSteps.java:179)
at ✽.User clicks on "Our Fees" link in My Account Footer(classpath:src/test/resources/features/ContainHyphensFooterUIValidations.feature:8)
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//img[@alt="Close"]"}
(Session info: headless chrome=104.0.5112.81)
For documentation on this error, please visit: https://selenium.dev/exceptions/#no_such_element
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'EGS2HSTMCSTAU02', ip: '10.100.51.151', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.2'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [0eff3e94bb4a19c40ab2338acfa32771, findElement {using=xpath, value=//img[@alt="Close"]}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 104.0.5112.81, chrome: {chromedriverVersion: 104.0.5112.79 (3cf3e8c8a07d..., userDataDir: C:\Users\AUTOMA~1\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:64453}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://egs2hstmcstau01.test.h..., se:cdpVersion: 104.0.5112.81, se:name: TemenosToReact_TestValidati..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 0eff3e94bb4a19c40ab2338acfa32771
at jdk.internal.reflect.GeneratedConstructorAccessor104.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:162)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:60)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:387)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:379)
at org.openqa.selenium.By$BaseW3CLocator.findElement(By.java:399)
at org.openqa.selenium.By$ByXPath.findElement(By.java:279)
at com.hastings.automation.function.ui.pageobjects.BasePage$ByProperty.findElement(BasePage.java:135)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$1.findElement(ElementLocation.java:136)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:60)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:387)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:379)
at com.hastings.automation.function.pageaction.webpageaction.ReturnAction.waitAndReturnElement(ReturnAction.java:158)
at com.hastings.automation.function.pageaction.webpageaction.ReturnAction.waitAndReturnElement(ReturnAction.java:132)
at com.hastings.automation.function.pageaction.webpageaction.ReturnAction.waitAndReturnElement(ReturnAction.java:97)
at com.hastings.automation.function.pageaction.webpageaction.ClickAction$1.apply(ClickAction.java:49)
at com.hastings.automation.function.pageaction.webpageaction.ClickAction$1.apply(ClickAction.java:45)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
at com.hastings.automation.function.pageaction.webpageaction.ClickAction.waitAndClickElement(ClickAction.java:45)
at com.hastings.automation.function.ui.pageobjects.digital.reactmyaccount.MaReactMarketingPreferenceOverlayPage.clickMarketingPreferenceCloseButton(MaReactMarketingPreferenceOverlayPage.java:68)
at com.hastings.automation.automationtest.bdd.definitions.stepdefinitions.digital.digitalsteps.MyAccountReactSteps.userClickOnFooterLink(MyAccountReactSteps.java:179)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
at io.cucumber.java.Invoker.invoke(Invoker.java:24)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:85)
at io.cucumber.core.runner.TestStep.run(TestStep.java:57)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
at io.cucumber.core.runner.TestCase.run(TestCase.java:84)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$1(TestNGCucumberRunner.java:132)
at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:129)
at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:129)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:129)
at com.hastings.automation.automationtest.bdd.testrunners.JenkinsCucumberBrowserRunner.scenario(JenkinsCucumberBrowserRunner.java:33)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
]]></failure>
</testcase>

<testcase classname="MyAccount - Footer - Help UI Validation" name="Verify Help page on My Account" time="38.92">
<system-out><![CDATA[Given User logs into My Account with a policy...............................passed
When User clicks on Help button.............................................passed
Then User should be directed to the Hastings Direct Help page...............passed
]]></system-out>
</testcase>

<testcase classname="MyAccount - Footer - GoGreen Overlay Ui Validations" name="Verify the Help us go green modal overlay for postal document delivery in My Account" time="81.777">
<system-out><![CDATA[Given User logs into My Account with Postal document delivery method policy.passed
When User is on Dashboard screen for Go Green Modal.........................passed
Then User should be presented with Help us go green modal overlay...........passed
]]></system-out>
</testcase>

<testcase classname="MyAccount - Footeeer - GoGreen Overlay Ui Validations" name="Verify the Help us go green modal overlay for postal document delivery in My Account" time="81.777">
<system-out><![CDATA[Given User logs into My Account with Postal document delivery method policy.passed
When User is on Dashboard screen for Go Green Modal.........................passed
Then User should be presented with Help us go green modal overlay...........passed
]]></system-out>
</testcase>
</testsuite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Auto generated Octane revision tag
@BSPID174090REV0.18.0
Feature: MyAccount - Footer

@TSCID523715 @TemenosReactTeam
Scenario: Verify Footer - Our Fees Hyperlink
Given User logs into My Account with a policy
When User clicks on "Our Fees" link in My Account Footer
Then User should be navigated to the respective footer page
@TSCID523721 @TemenosReactTeam
Scenario: Verify Footer - Important Information About Us Hyperlink
Given User login into My Account with Multi Product Policies
|Bike | 1 |
|Van | 1 |
When User clicks on "Important Information About Us" link in My Account Footer
Then User should be navigated to the respective footer page
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Auto generated Octane revision tag
@BSPID182030REV0.12.0
Feature: MyAccount - Footer - GoGreen Overlay Ui Validations

@TSCID545389 @TemenosReactTeam
Scenario: Verify the Help us go green modal overlay for postal document delivery in My Account
Given User logs into My Account with Postal document delivery method policy
When User is on Dashboard screen for Go Green Modal
Then User should be presented with Help us go green modal overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Auto generated Octane revision tag
@BSPID183048REV0.5.0
Feature: MyAccount - Footer - Help UI Validation

@TSCID564947 @TemenosReactTeam
Scenario: Verify Help page on My Account
Given User logs into My Account with a policy
When User clicks on Help button
Then User should be directed to the Hastings Direct Help page
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<features version="1">
<feature name="Some terse yet descriptive text of what is desired like bla bla"
path="src\test\resources\features\robustgherkin.feature" started="1630044647564" tag="BSPID1001REV0.2.0">
path="src\test\resources\features\robustgherkin.feature" started="1685009046862" tag="BSPID1001REV0.2.0">
<file>
<![CDATA[#Auto generated Octane revision tag
@BSPID1001REV0.2.0
Expand Down Expand Up @@ -136,7 +136,7 @@ this is comment
</scenarios>
</feature>
<feature name="Some terse yet descriptive text of what is desired like bla bla"
path="src\test\resources\features\robustgherkin03.feature" started="1630044647564" tag="BSPID1037REV0.0.1">
path="src\test\resources\features\robustgherkin03.feature" started="1685009046862" tag="BSPID1037REV0.0.1">
<file>
<![CDATA[@billing @bicker @annoy
@BSPID1037REV0.0.1
Expand Down
Loading

0 comments on commit 76e07bf

Please sign in to comment.