Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

#875 FIX#894

Merged
TikhomirovSergey merged 4 commits intoappium:masterappium/java-client:masterfrom
TikhomirovSergey:masterTikhomirovSergey/java-client:masterCopy head branch name to clipboard
May 22, 2018
Merged

#875 FIX#894
TikhomirovSergey merged 4 commits intoappium:masterappium/java-client:masterfrom
TikhomirovSergey:masterTikhomirovSergey/java-client:masterCopy head branch name to clipboard

Conversation

@TikhomirovSergey
Copy link
Contributor

Change list

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

It seems it is needed to propose some changes to Selenium. Make some methods protected, for instance.

@TikhomirovSergey
Copy link
Contributor Author

@Tenit2012 @Trucnt you can check out these changes too.
@SrinivasanTarget it needs to be checked on iOS.

int threshold = (int) Math.min(Runtime.getRuntime().freeMemory() / 10, Integer.MAX_VALUE);
FileBackedOutputStream os = new FileBackedOutputStream(threshold);
try (
CountingOutputStream counter = new CountingOutputStream(os);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the formatting here is a bit confusing

return getPrivateFieldValue("client", HttpClient.class);
}

private Response createSession(Command command) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be handy to add some documentation on this method

Response response;
try {
response = super.execute(command);
if (!NEW_SESSION.equals(command.getName())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use ternary operator:

response = NEW_SESSION.equals(command.getName()) ? createSession(command) : super.execute(command)



public class NewSessionPayload implements Closeable {
class NewAppiumSessionPayload implements Closeable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy does not appreciate default access modifiers

@@ -54,11 +60,17 @@ public class DesktopBrowserCompatibilityTest {
* The starting.
*/
@BeforeClass public static void beforeClass() {
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach May 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could keep both tests for Firefox and Chrome drivers

Optional<Result> result = (Optional<Result>) createSessionMethod
.invoke(this, client, contentStream, counter.getCount());

if (result.isPresent()) {
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach May 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return result.map(x -> { .... }).orElseThrow(() -> new SessionNotCreatedException(...))

Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities");
desired = desired == null ? new ImmutableCapabilities() : desired;

int threshold = (int) Math.min(Runtime.getRuntime().freeMemory() / 10, Integer.MAX_VALUE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some magic numbers explanation might be handy here

.createSession(getClient(), command);
Dialect dialect = result.getDialect();
setCommandCodec(dialect.getCommandCodec());
for (Map.Entry<String, CommandInfo> entry : getAdditionalCommands().entrySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be done with forEach?

@TikhomirovSergey
Copy link
Contributor Author

@mykola-mokhnach will make required improvements soon.

@TikhomirovSergey
Copy link
Contributor Author

@mykola-mokhnach There are updates
@SrinivasanTarget how does iOS feel?

@appium appium deleted a comment May 17, 2018

return result.map(result1 -> {
Result toReturn = result.get();
System.out.print(format("Detected dialect: %s", toReturn.getDialect()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot we use logger object instead of System.print?

.createSession(getClient(), command);
Dialect dialect = result.getDialect();
setCommandCodec(dialect.getCommandCodec());
getAdditionalCommands().forEach(this::defineCommand);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


@Override
public Response execute(Command command) throws WebDriverException {
public Response execute(Command command) throws WebDriverException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to make it throwing the checked exception? Id rather wrap IOException into WebDriverException and keep the previous method signature

@TikhomirovSergey TikhomirovSergey mentioned this pull request May 20, 2018
3 tasks
@TikhomirovSergey
Copy link
Contributor Author

@mykola-mokhnach There new updates. Sorry for the delaying. I was busy.
ping @SrinivasanTarget

Copy link
Contributor

@mykola-mokhnach mykola-mokhnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, there is only one small thing left about missing docstring

@appium appium deleted a comment May 21, 2018
Copy link
Member

@SrinivasanTarget SrinivasanTarget left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on iOS too

@TikhomirovSergey TikhomirovSergey merged commit 6ff2071 into appium:master May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.