Skip to content

Commit

Permalink
Update to current TestingDriver project configurations where we have …
Browse files Browse the repository at this point in the history
…new functionalities, driver types are changed, and overall more robust
  • Loading branch information
Victor Zheng authored and Victor Zheng committed Dec 14, 2023
1 parent 0dc3733 commit 8680bde
Show file tree
Hide file tree
Showing 20 changed files with 1,673 additions and 274 deletions.
3 changes: 3 additions & 0 deletions TestingDriver/log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52146,3 +52146,6 @@
{"message":"Project 'C:\\Users\\ZhengVi\\Documents\\GitHub-victor-zheng-codes\\TestingDrivers\\TestingDriver\\TestingDriver.csproj' does not contain any documents.","source":"MetadataCommand.ExtractMetadata","date_time":"2023-12-14T17:10:05.7005545Z","message_severity":"warning","correlation_id":"0D992DA3-9BA4-4E72-B5EB-7E281846319A.1.1.8"}
{"message":"No metadata is generated for TestingDriver.","source":"MetadataCommand.ExtractMetadata","date_time":"2023-12-14T17:10:06.2065619Z","message_severity":"warning","correlation_id":"0D992DA3-9BA4-4E72-B5EB-7E281846319A.1.1.13"}
{"message":"Unable to find either toc.yml or toc.md inside api/. Make sure the file is included in config file docfx.json!","source":"BuildCommand.BuildCore.Build Document.CompilePhaseHandlerWithIncremental.TocDocumentProcessor.Prebuild.BuildTocDocument","file":"toc.yml","date_time":"2023-12-14T17:10:08.9368829Z","message_severity":"warning","correlation_id":"0D992DA3-9BA4-4E72-B5EB-7E281846319A.2.182.1.31.7.3.2.1"}
{"message":"Timeout (1000ms) exceeded. Killing process git.","source":"MetadataCommand.ExtractMetadata","date_time":"2023-12-14T18:22:06.6683865Z","message_severity":"warning","correlation_id":"B0D7AE86-9146-4323-8AC5-464318C2BA7B.1.1.8"}
{"message":"Timeout (1000ms) exceeded. Killing process git.","source":"MetadataCommand.ExtractMetadata","date_time":"2023-12-14T18:22:09.330511Z","message_severity":"warning","correlation_id":"B0D7AE86-9146-4323-8AC5-464318C2BA7B.1.1.9"}
{"message":"Skipping GetFileDetail. Exception found: Microsoft.DocAsCode.Common.Git.GitException, Message: The result can't be null or empty string","source":"MetadataCommand.ExtractMetadata","date_time":"2023-12-14T18:22:09.8880519Z","message_severity":"warning","correlation_id":"B0D7AE86-9146-4323-8AC5-464318C2BA7B.1.1.10"}
52 changes: 50 additions & 2 deletions TestingDriver/src/ITestingDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public enum TestingDriverType
/// </summary>
string ErrorContainer { get; set; }

/// <summary>
/// Gets or sets the local timeout to attempt to find and wait for elements.
/// </summary>
int LocalTimeout { get; set; }

/// <summary>
/// Goes back a page.
/// </summary>
Expand All @@ -129,10 +134,27 @@ public enum TestingDriverType
/// <param name="jsCommand">Any js command needed.</param>
void ClickElement(string xPath, bool byJS = false, string jsCommand = "");

/// <summary>
/// Performs the actions of clicking a check box. Uses Selenium binding by default.
/// </summary>
/// <param name="xPath">The xpath to find the specified element.</param>
/// <param name="byJS"> Whether to use JS to perform the click / not. </param>
/// <param name="jsCommand">Any js command needed.</param>
void Check(string xPath, bool byJS = false, string jsCommand = "");

/// <summary>
/// Performs the actions of unchecking the specified element. Uses Selenium binding by default.
/// </summary>
/// <param name="xPath">The xpath to find the specified element.</param>
/// <param name="byJS"> Whether to use JS to perform the click / not. </param>
/// <param name="jsCommand">Any js command needed.</param>
void Uncheck(string xPath, bool byJS = false, string jsCommand = "");

/// <summary>
/// Closes the current window. It will quit the browser if it is the last window opened.
/// </summary>
void CloseBrowser();
/// <param name="all"> Whether to close all tabs in the browser. </param>
void CloseBrowser(bool all = true);

/// <summary>
/// Accepts the alert provided that there is an alert.
Expand Down Expand Up @@ -205,6 +227,14 @@ public enum TestingDriverType
/// <returns>The <see cref="T:List{string}"/>.</returns>
List<string> GetAllLinksURL();

/// <summary>
/// Tells the browser to launch a new tab.
/// </summary>
/// <param name="url">URL for the browser to navigate to.</param>
/// <param name="instantiateNewDriver">Instantiates a new selenium driver.</param>
/// <returns> <code>true</code> if the navigation was successful. </returns>C:\Users\DuongCh\Projects\TestingDrivers\TestingDriver\src\ITestingDriver.cs
bool LaunchNewTab(string url = "", bool instantiateNewDriver = false);

/// <summary>
/// Tells the browser to navigate to the provided url.
/// </summary>
Expand Down Expand Up @@ -233,6 +263,15 @@ public enum TestingDriverType
/// <returns><code>true</code> if it is the same.</returns>
bool VerifyElementText(string expected, string xPath, string jsCommand = "");

/// <summary>
/// Returns whether or not the element's value attribute is the same as the expected value. Usually for form-like elements.
/// </summary>
/// <param name="expected">What the value is expected to be.</param>
/// <param name="xPath">The xpath of the element.</param>
/// <param name="jsCommand">Any js command needed.</param>
/// <returns><code>true</code> if it is the same.</returns>
bool VerifyFieldValue(string expected, string xPath, string jsCommand = "");

/// <summary>
/// Returns whether or not the element is selected or not.
/// </summary>
Expand Down Expand Up @@ -305,7 +344,16 @@ public enum TestingDriverType
/// <summary>
/// Takes a screenshot of the browser. Screenshot will have the datestamp as its name. Year Month Date Hour Minutes Seconds (AM/PM).
/// </summary>
void TakeScreenShot();
/// <param name="fileName">The fileName of the testing driver.</param>
void TakeScreenShot(string fileName);

/// <summary>
/// Takes a screenshot of the browser. Screenshot will have the datestamp as its name. Year Month Date Hour Minutes Seconds (AM/PM).
/// </summary>
/// <param name="fileName">The fileName of the testing driver.</param>
/// <param name="isMobile">Whether it is a mobile device.</param>
/// <returns><code>true</code> if screenshot was successfully taken. </returns>
bool TakeEntireScreenshot(string fileName, bool isMobile);

/// <summary>
/// Waits for an element state.
Expand Down
Loading

0 comments on commit 8680bde

Please sign in to comment.