From 2770c4746653e2f99ef2119c32759ea4361443bb Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 10 Jun 2024 07:28:05 -0400 Subject: [PATCH 1/5] add getters to private properties, re: #148 --- src/Browser/PantherBrowser.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Browser/PantherBrowser.php b/src/Browser/PantherBrowser.php index 3b9919a..8010977 100644 --- a/src/Browser/PantherBrowser.php +++ b/src/Browser/PantherBrowser.php @@ -227,4 +227,24 @@ final public function rightClick(string $selector): self return $this; } + + public function getScreenshotDir(): ?string + { + return $this->screenshotDir; + } + + public function getConsoleLogDir(): ?string + { + return $this->consoleLogDir; + } + + public function getSavedScreenshots(): array + { + return $this->savedScreenshots; + } + + public function getSavedConsoleLogs(): array + { + return $this->savedConsoleLogs; + } } From 659625b9ea2a5fd830466b992e1dee24507f1392 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 10 Jun 2024 07:31:36 -0400 Subject: [PATCH 2/5] add setters for directories --- src/Browser/PantherBrowser.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Browser/PantherBrowser.php b/src/Browser/PantherBrowser.php index 8010977..6ae0a2d 100644 --- a/src/Browser/PantherBrowser.php +++ b/src/Browser/PantherBrowser.php @@ -247,4 +247,15 @@ public function getSavedConsoleLogs(): array { return $this->savedConsoleLogs; } + + public function setScreenshotDir(?string $screenshotDir): void + { + $this->screenshotDir = $screenshotDir; + } + + public function setConsoleLogDir(?string $consoleLogDir): void + { + $this->consoleLogDir = $consoleLogDir; + } + } From 0f407143f9c65da150c3e1cadcba9a5489b65fb0 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 10 Jun 2024 07:37:50 -0400 Subject: [PATCH 3/5] add simple tests for directory setter/getters --- tests/PantherBrowserTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/PantherBrowserTest.php b/tests/PantherBrowserTest.php index 3a79c11..e4aa1b1 100644 --- a/tests/PantherBrowserTest.php +++ b/tests/PantherBrowserTest.php @@ -38,6 +38,18 @@ public function can_use_panther_browser_as_typehint(): void ; } + /** + * @test + */ + public function can_configure_directories(): void + { + $this->browser()->setScreenshotDir($screenshotDir = '/path/to/screenshot'); + assert($this->browser()->getScreenshotDir() === $screenshotDir); + + $this->browser()->setConsoleLogDir($logDir = '/path/to/consoleLogs'); + assert($this->browser()->getScreenshotDir() === $logDir); + } + /** * @test */ From a93dc823b56de3580796fb17917f52adae8ded78 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 22 Jul 2024 09:13:11 -0400 Subject: [PATCH 4/5] Update src/Browser/PantherBrowser.php Co-authored-by: Nicolas PHILIPPE --- src/Browser/PantherBrowser.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Browser/PantherBrowser.php b/src/Browser/PantherBrowser.php index 6ae0a2d..6c83d3c 100644 --- a/src/Browser/PantherBrowser.php +++ b/src/Browser/PantherBrowser.php @@ -238,6 +238,9 @@ public function getConsoleLogDir(): ?string return $this->consoleLogDir; } + /** + * @return list + */ public function getSavedScreenshots(): array { return $this->savedScreenshots; From 7862fc44bc6bf973134ba7b8117762f84ece26b0 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Mon, 22 Jul 2024 09:15:24 -0400 Subject: [PATCH 5/5] use self::assertSame() --- tests/PantherBrowserTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/PantherBrowserTest.php b/tests/PantherBrowserTest.php index e4aa1b1..c3e4748 100644 --- a/tests/PantherBrowserTest.php +++ b/tests/PantherBrowserTest.php @@ -44,10 +44,10 @@ public function can_use_panther_browser_as_typehint(): void public function can_configure_directories(): void { $this->browser()->setScreenshotDir($screenshotDir = '/path/to/screenshot'); - assert($this->browser()->getScreenshotDir() === $screenshotDir); + self::assertSame($this->browser()->getScreenshotDir(), $screenshotDir); $this->browser()->setConsoleLogDir($logDir = '/path/to/consoleLogs'); - assert($this->browser()->getScreenshotDir() === $logDir); + self::assertSame($this->browser()->getScreenshotDir(), $logDir); } /**