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

Extension/general api improvements #188

Merged
merged 2 commits into from
Jan 13, 2022
Merged
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
Expand Up @@ -172,7 +172,7 @@ public void addDependsOnMethod(MethodContext methodContext) {
}

private Stream<TestStepAction> readTestStepActions() {
return this.readTestSteps().flatMap(testStep -> testStep.getTestStepActions().stream());
return this.readTestSteps().flatMap(TestStep::readActions);
}

public TestStepAction addLogMessage(LogMessage logMessage) {
Expand All @@ -199,6 +199,10 @@ public void setFailedStep(TestStep step) {
this.lastFailedStep = step;
}

public Optional<TestStep> getFailedStep() {
return Optional.ofNullable(this.lastFailedStep);
}

public Stream<ErrorContext> readErrors() {
return readTestStepActions().flatMap(TestStepAction::readErrors);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

/**
* A static wrapper for {@link MethodContext#readTestSteps()}
Expand Down Expand Up @@ -66,10 +67,17 @@ public String getName() {
return name;
}

/**
* @deprecated Use {@link #readActions()} instead
*/
public List<TestStepAction> getTestStepActions() {
return testStepActions;
}

public Stream<TestStepAction> readActions() {
return this.testStepActions.stream();
}

/**
* @return The last action if it matches the name, otherwise a new action is returned.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public URL getSeleniumServerUrl() {
}

public DesktopWebDriverRequest setSeleniumServerUrl(String url) throws MalformedURLException {
this.seleniumServerURL = new URL(url);
return this;
return this.setSeleniumServerUrl(new URL(url));
}

public DesktopWebDriverRequest setSeleniumServerUrl(URL url) {
this.setWebDriverMode(WebDriverMode.remote);
this.seleniumServerURL = url;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import eu.tsystems.mms.tic.testframework.report.model.context.MethodContext;
import eu.tsystems.mms.tic.testframework.report.model.context.Screenshot;
import eu.tsystems.mms.tic.testframework.report.model.context.SessionContext;
import eu.tsystems.mms.tic.testframework.report.model.steps.TestStep;
import eu.tsystems.mms.tic.testframework.report.utils.ExecutionContextController;
import eu.tsystems.mms.tic.testframework.test.execution.TestStatusTest;
import eu.tsystems.mms.tic.testframework.test.page.PageFactoryTest;
Expand Down Expand Up @@ -105,7 +106,7 @@ private void screenshotIsPresentInMethodContext(String methodName, boolean exclu
.collect(Collectors.toList());

long count = methodContext.readTestSteps()
.flatMap(testStep -> testStep.getTestStepActions().stream())
.flatMap(TestStep::readActions)
.flatMap(testStepAction -> testStepAction.readEntries(Screenshot.class))
.filter(screenshot -> relevantSessionKeys.contains(screenshot.getMetaData().get(Screenshot.MetaData.SESSION_KEY)))
.count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public TestStep.Builder buildTestStep(eu.tsystems.mms.tic.testframework.report.m
TestStep.Builder builder = TestStep.newBuilder();

apply(testStep.getName(), builder::setName);
forEach(testStep.getTestStepActions(), testStepAction -> builder.addActions(buildTestStepAction(testStepAction)));
testStep.readActions().forEach(testStepAction -> builder.addActions(buildTestStepAction(testStepAction)));

return builder;
}
Expand Down