Skip to content

Commit 4b3ce4c

Browse files
authored
Merge branch 'trunk' into rb_add_support_for_chrome_beta
2 parents ce38cb2 + 25efb72 commit 4b3ce4c

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class LogEntryConverter : JsonConverter<Modules.Log.LogEntry>
3434
{
3535
"console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<ConsoleLogEntry>()),
3636
"javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<JavascriptLogEntry>()),
37-
_ => null,
37+
_ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<GenericLogEntry>()),
3838
};
3939
}
4040

dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Log;
2424

2525
// https://github.com/dotnet/runtime/issues/72604
2626
//[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
27+
//[JsonDerivedType(typeof(GenericLogEntry))] // Fallback when discriminator is not recognized, we have to double check
2728
//[JsonDerivedType(typeof(ConsoleLogEntry), "console")]
2829
//[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")]
2930
public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp)
@@ -32,6 +33,9 @@ public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, st
3233
public Script.StackTrace? StackTrace { get; set; }
3334
}
3435

36+
public record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp)
37+
: LogEntry(BiDi, Level, Source, Text, Timestamp);
38+
3539
public record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp, string Method, IReadOnlyList<Script.RemoteValue> Args)
3640
: LogEntry(BiDi, Level, Source, Text, Timestamp);
3741

java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class DefaultSlotMatcher implements SlotMatcher, Serializable {
4949
matched in the Node or in the browser driver.
5050
*/
5151
private static final List<String> EXTENSION_CAPABILITIES_PREFIXES =
52-
Arrays.asList("goog:", "moz:", "ms:", "se:");
52+
Arrays.asList("goog:", "moz:", "ms:", "safari:", "se:");
5353

5454
@Override
5555
public boolean matches(Capabilities stereotype, Capabilities capabilities) {
@@ -154,9 +154,12 @@ private Boolean extensionCapabilitiesMatch(Capabilities stereotype, Capabilities
154154
We match extension capabilities when they are not prefixed with any of the
155155
EXTENSION_CAPABILITIES_PREFIXES items. Also, we match them only when the capabilities
156156
of the new session request contains that specific extension capability.
157+
We are also filtering "options" extension capabilities, as they should be handled
158+
by the remote endpoint.
157159
*/
158160
return stereotype.getCapabilityNames().stream()
159161
.filter(name -> name.contains(":"))
162+
.filter(name -> !name.toLowerCase().contains("options"))
160163
.filter(name -> capabilities.asMap().containsKey(name))
161164
.filter(name -> EXTENSION_CAPABILITIES_PREFIXES.stream().noneMatch(name::contains))
162165
.map(

java/test/org/openqa/selenium/grid/data/DefaultSlotMatcherTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,32 @@ void vendorExtensionPrefixedCapabilitiesAreIgnoredForMatching() {
565565
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
566566
}
567567

568+
@Test
569+
void extensionPrefixedOptionCapabilityIsIgnoredForMatching() {
570+
Capabilities stereotype =
571+
new ImmutableCapabilities(
572+
CapabilityType.BROWSER_NAME,
573+
"chrome",
574+
CapabilityType.BROWSER_VERSION,
575+
"84",
576+
CapabilityType.PLATFORM_NAME,
577+
Platform.WINDOWS,
578+
"node:options",
579+
"appium");
580+
581+
Capabilities capabilities =
582+
new ImmutableCapabilities(
583+
CapabilityType.BROWSER_NAME,
584+
"chrome",
585+
CapabilityType.BROWSER_VERSION,
586+
"84",
587+
CapabilityType.PLATFORM_NAME,
588+
Platform.WINDOWS,
589+
"node:options",
590+
"selenium");
591+
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
592+
}
593+
568594
@Test
569595
void emptyCapabilitiesDoNotMatch() {
570596
Capabilities stereotype =

rb/lib/selenium/webdriver/support/guards.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def initialize(example, bug_tracker: '', conditions: nil)
3939

4040
def add_condition(name, condition = nil, &block)
4141
@guard_conditions << GuardCondition.new(name, condition, &block)
42+
WebDriver.logger.info "Running with Guard '#{name}' set to: #{!!condition}"
4243
end
4344

4445
def add_message(name, message)

0 commit comments

Comments
 (0)