From 9b238a4538ee099989e1c474f419d295a39234da Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Thu, 28 Nov 2024 11:40:19 -0500 Subject: [PATCH] Feedback --- .../groovy/grails/plugin/geb/ContainerGebSpec.groovy | 2 +- .../grails/plugin/geb/GebRecordingTestListener.groovy | 6 +----- .../grails/plugin/geb/GrailsContainerGebExtension.groovy | 3 +-- .../grails/plugin/geb/WebDriverContainerHolder.groovy | 8 ++++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/testFixtures/groovy/grails/plugin/geb/ContainerGebSpec.groovy b/src/testFixtures/groovy/grails/plugin/geb/ContainerGebSpec.groovy index 2bde82b..d805bc3 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/ContainerGebSpec.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/ContainerGebSpec.groovy @@ -73,7 +73,7 @@ abstract class ContainerGebSpec extends Specification implements ContainerAwareD } /** - * The reporter that GebShould use when reporting is enabled. + * The reporter that Geb should use when reporting is enabled. */ Reporter createReporter() { new CompositeReporter(new PageSourceReporter()) diff --git a/src/testFixtures/groovy/grails/plugin/geb/GebRecordingTestListener.groovy b/src/testFixtures/groovy/grails/plugin/geb/GebRecordingTestListener.groovy index 2df784d..a4bbf05 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/GebRecordingTestListener.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/GebRecordingTestListener.groovy @@ -37,12 +37,8 @@ class GebRecordingTestListener extends AbstractRunListener { WebDriverContainerHolder containerHolder ErrorInfo errorInfo - SpecInfo spec - LocalDateTime runDate - GebRecordingTestListener(WebDriverContainerHolder containerHolder, SpecInfo spec) { - this.spec = spec - this.runDate = runDate + GebRecordingTestListener(WebDriverContainerHolder containerHolder) { this.containerHolder = containerHolder } diff --git a/src/testFixtures/groovy/grails/plugin/geb/GrailsContainerGebExtension.groovy b/src/testFixtures/groovy/grails/plugin/geb/GrailsContainerGebExtension.groovy index 72b97e8..3a60fe1 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/GrailsContainerGebExtension.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/GrailsContainerGebExtension.groovy @@ -111,8 +111,7 @@ class GrailsContainerGebExtension implements IGlobalExtension { addGebExtensionOnFailureReporter(spec) GebRecordingTestListener recordingListener = new GebRecordingTestListener( - holder, - spec + holder ) spec.addListener(recordingListener) } diff --git a/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy b/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy index 85ec7ff..6ee8a01 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy @@ -116,7 +116,7 @@ class WebDriverContainerHolder { ConfigObject configObject = new ConfigObject() if (currentConfiguration.reporting) { - configObject.reportsDir = grailsGebSettings.getReportingDirectory() + configObject.reportsDir = grailsGebSettings.reportingDirectory configObject.reporter = (invocation.sharedInstance as ContainerGebSpec).createReporter() } @@ -132,7 +132,7 @@ class WebDriverContainerHolder { // real url cannot be set (it will be checked as part of the geb test manager startup in reporting mode) // set the url to localhost, which the selenium server should respond to (albeit with an error that will be ignored) - currentBrowser.baseUrl = "http://localhost" + currentBrowser.baseUrl = 'http://localhost' testManager = createTestManager() @@ -167,13 +167,13 @@ class WebDriverContainerHolder { private static String getHostIp() { try { - PortForwardingContainer.getDeclaredMethod("getNetwork").with { + PortForwardingContainer.getDeclaredMethod('getNetwork').with { accessible = true Optional network = invoke(PortForwardingContainer.INSTANCE) as Optional return network.get().ipAddress } } catch (Exception e) { - throw new RuntimeException("Could not access network from PortForwardingContainer", e) + throw new RuntimeException('Could not access network from PortForwardingContainer', e) } }