forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
335c14c
commit f394f7b
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using NUnit.Framework; | ||
using OpenQA.Selenium.Firefox; | ||
using System; | ||
using System.IO; | ||
|
||
namespace OpenQA.Selenium.Firefox | ||
{ | ||
[TestFixture] | ||
public class FirefoxDriverServiceTests | ||
{ | ||
private string tempFileName; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
tempFileName = Path.GetTempFileName(); | ||
File.Delete(tempFileName); | ||
} | ||
|
||
[TearDown] | ||
public void Teardown() | ||
{ | ||
if (File.Exists(tempFileName)) | ||
{ | ||
File.Delete(tempFileName); | ||
} | ||
} | ||
|
||
[Test] | ||
public void CanSetLogPath() | ||
{ | ||
var service = FirefoxDriverService.CreateDefaultService(); | ||
service.LogPath = tempFileName; | ||
|
||
Assert.That(service.LogPath, Is.EqualTo(tempFileName), "LogPath should be set correctly"); | ||
|
||
string commandLineArgs = service.CommandLineArguments; | ||
Assert.That(commandLineArgs, Contains.Substring($"--log \"{tempFileName}\""), | ||
"Command line arguments should contain the log path"); | ||
} | ||
|
||
[Test] | ||
public void LogFileIsCreatedWhenDriverStarts() | ||
{ | ||
var service = FirefoxDriverService.CreateDefaultService(); | ||
service.LogPath = tempFileName; | ||
|
||
service.Start(); | ||
|
||
try | ||
{ | ||
Assert.That(File.Exists(tempFileName), Is.True, "Log file should be created when service starts"); | ||
|
||
string logContent = File.ReadAllText(tempFileName); | ||
Assert.That(logContent, Is.Not.Empty, "Log file should contain content"); | ||
} | ||
finally | ||
{ | ||
service.Dispose(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters