MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / setUp

Method setUp

java/test/org/openqa/selenium/grid/node/NodeTest.java:121–180  ·  view source on GitHub ↗
(TestInfo testInfo)

Source from the content-addressed store, hash-verified

119 }
120
121 @BeforeEach
122 public void setUp(TestInfo testInfo) throws URISyntaxException {
123 tracer = DefaultTestTracer.createTracer();
124 bus = new GuavaEventBus();
125
126 registrationSecret = new Secret("sussex charmer");
127 boolean isDownloadsTestCase = testInfo.getDisplayName().equalsIgnoreCase("DownloadsTestCase");
128
129 stereotype = new ImmutableCapabilities("browserName", "cheese");
130 caps = new ImmutableCapabilities("browserName", "cheese");
131 if (isDownloadsTestCase) {
132 stereotype = new ImmutableCapabilities("browserName", "chrome", ENABLE_DOWNLOADS, true);
133 caps = new ImmutableCapabilities("browserName", "chrome", ENABLE_DOWNLOADS, true);
134 }
135
136 uri = new URI("http://localhost:1234");
137
138 class Handler extends Session implements HttpHandler {
139 private Handler(Capabilities capabilities) {
140 super(new SessionId(UUID.randomUUID()), uri, stereotype, capabilities, Instant.now());
141 }
142
143 @Override
144 public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
145 return new HttpResponse();
146 }
147 }
148
149 Builder builder =
150 LocalNode.builder(tracer, bus, uri, uri, registrationSecret)
151 .add(caps, new TestSessionFactory((id, c) -> new Handler(c)))
152 .add(caps, new TestSessionFactory((id, c) -> new Handler(c)))
153 .add(caps, new TestSessionFactory((id, c) -> new Handler(c)))
154 .maximumConcurrentSessions(2);
155 if (isDownloadsTestCase) {
156 builder = builder.enableManagedDownloads(true).sessionTimeout(ofSeconds(1));
157 }
158 local = builder.build();
159 local2 = builder.build();
160
161 node =
162 new RemoteNode(
163 tracer,
164 new PassthroughHttpClient.Factory(local),
165 new NodeId(UUID.randomUUID()),
166 uri,
167 registrationSecret,
168 local.getSessionTimeout(),
169 Set.of(caps));
170
171 node2 =
172 new RemoteNode(
173 tracer,
174 new PassthroughHttpClient.Factory(local2),
175 new NodeId(UUID.randomUUID()),
176 uri,
177 registrationSecret,
178 local2.getSessionTimeout(),

Callers

nothing calls this directly

Calls 10

createTracerMethod · 0.95
builderMethod · 0.95
buildMethod · 0.95
sessionTimeoutMethod · 0.80
getDisplayNameMethod · 0.65
addMethod · 0.65
getSessionTimeoutMethod · 0.45
ofMethod · 0.45

Tested by

no test coverage detected