-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from ERNI-Academy/feature/selenoid
Add Selenoid engine
- Loading branch information
Showing
90 changed files
with
1,345 additions
and
231 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
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
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Appium.Mobile/POM/Product/ProductPage.cs
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
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Selenium.Web/POM/Stinto/Chat/ChatPage.cs
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Selenium.Web/POM/Stinto/CreateChat/CreateChatPage.cs
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Selenium.Web/POM/Stinto/Home/HomePage.cs
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Selenium.Web/POM/SwagLabs/Login/LoginPage.cs
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
2 changes: 1 addition & 1 deletion
2
samples/TestWare.Samples.Selenium.Web/POM/SwagLabs/Menu/MenuPage.cs
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
32 changes: 32 additions & 0 deletions
32
samples/TestWare.Samples.Selenoid.Web/Features/SwagLabs/Login.feature
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,32 @@ | ||
@RemoteDriver | ||
Feature: Login | ||
|
||
Scenario Outline: Login | ||
Given the user enters username '<username>' | ||
And the user enters password '<password>' | ||
When the user clicks submit | ||
Then the user can login | ||
|
||
@Chrome | ||
Examples: | ||
| Example Description | username | password | | ||
| standard | standard_user | secret_sauce | | ||
| problem | problem_user | secret_sauce | | ||
|
||
@Firefox | ||
Examples: | ||
| Example Description | username | password | | ||
| standard | standard_user | secret_sauce | | ||
| problem | problem_user | secret_sauce | | ||
|
||
@Edge | ||
Examples: | ||
| Example Description | username | password | | ||
| standard | standard_user | secret_sauce | | ||
| problem | problem_user | secret_sauce | | ||
|
||
@Chrome | ||
Scenario: Logout | ||
Given user 'standard_user' is logged with 'secret_sauce' into SwagLabs | ||
When the user clicks Logout button | ||
Then the user is at Login page |
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,110 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using TestWare.Reporting.ExtentReport; | ||
|
||
namespace TestWare.Samples.Selenoid.Web; | ||
|
||
[Binding] | ||
public sealed class Hook | ||
{ | ||
private readonly TestContext _testContext; | ||
private int _stepCounter; | ||
private static readonly LifeCycle _lifeCycle = new(); | ||
private static ExtentReport _testReport; | ||
|
||
public Hook(TestContext testContext) | ||
{ | ||
_testContext = testContext; | ||
} | ||
|
||
[BeforeFeature] | ||
public static void BeforeFeature(FeatureContext featureContext) | ||
{ | ||
var name = featureContext.FeatureInfo.Title; | ||
var tags = featureContext.FeatureInfo.Tags; | ||
|
||
_lifeCycle.BeginTestSuite(name); | ||
_testReport.CreateFeature(name, tags); | ||
} | ||
|
||
[AfterFeature] | ||
public static void AfterFeature(FeatureContext featureContext) | ||
{ | ||
_lifeCycle.EndTestSuite(); | ||
} | ||
|
||
[BeforeScenario] | ||
public void BeforeScenario(FeatureContext featureContext, ScenarioContext scenarioContext) | ||
{ | ||
var name = scenarioContext.ScenarioInfo.Arguments.Count > 0 | ||
? $"{DateTime.UtcNow.ToString("yyy-MM-dd HH-mm-ss", CultureInfo.InvariantCulture)} - {scenarioContext.ScenarioInfo.Title}" | ||
: scenarioContext.ScenarioInfo.Title; | ||
|
||
var description = scenarioContext.ScenarioInfo.Description ?? ""; | ||
var scenarioTags = scenarioContext.ScenarioInfo.Tags; | ||
_testReport.CreateTestCase(name, description, scenarioTags); | ||
|
||
_testContext.WriteLine("----------------------------------------- \r\n"); | ||
_testContext.WriteLine($"Feature: {featureContext.FeatureInfo.Title}"); | ||
_testContext.WriteLine($" Scenario: {scenarioContext.ScenarioInfo.Title} \r\n"); | ||
|
||
_stepCounter = 1; | ||
var tags = GetTags(featureContext, scenarioContext); | ||
_lifeCycle.BeginTestCase(name, tags); | ||
} | ||
|
||
[AfterScenario] | ||
public void AfterScenario() | ||
{ | ||
_testReport.SetTestcaseOutcome(_testContext.CurrentTestOutcome); | ||
_lifeCycle.EndTestCase(); | ||
} | ||
|
||
[BeforeTestRun] | ||
public static void BeforeTestRun() | ||
{ | ||
_lifeCycle.BeginTestExecution(); | ||
_testReport = new ExtentReport(_lifeCycle.GetCurrentResultsDirectory()); | ||
} | ||
|
||
[AfterTestRun] | ||
public static void AfterTestRun() | ||
{ | ||
_lifeCycle.EndTestExecution(); | ||
_testReport.CreateTestReportFile(); | ||
} | ||
|
||
[BeforeStep] | ||
public void BeforeStep(ScenarioContext scenarioContext) | ||
{ | ||
var name = scenarioContext.CurrentScenarioBlock.ToString(); | ||
var description = scenarioContext.StepContext.StepInfo.Text; | ||
_testReport.CreateStep(name, description); | ||
|
||
var stepId = $"{_stepCounter:00} {description}"; | ||
_stepCounter++; | ||
_lifeCycle.BeginTestStep(stepId); | ||
} | ||
|
||
[AfterStep] | ||
public void AfterStep(ScenarioContext scenarioContext) | ||
{ | ||
_lifeCycle.EndTestStep(); | ||
var evidencesPath = _lifeCycle.GetStepEvidences(); | ||
|
||
foreach (var evidence in evidencesPath) | ||
{ | ||
_testReport.AddScreenshotToStep(evidence); | ||
_testContext.AddResultFile(evidence); | ||
} | ||
} | ||
|
||
private static List<string> GetTags(FeatureContext featureContext, ScenarioContext scenarioContext) | ||
{ | ||
var tags = featureContext.FeatureInfo.Tags.ToList(); | ||
tags.AddRange(scenarioContext.ScenarioInfo.Tags.ToList()); | ||
return tags; | ||
} | ||
} |
Oops, something went wrong.