Skip to content

Commit

Permalink
Adding BaseLine code
Browse files Browse the repository at this point in the history
Adding BaseLine code
  • Loading branch information
esosam committed Aug 12, 2020
1 parent a6c49c5 commit 026501d
Show file tree
Hide file tree
Showing 153 changed files with 8,631 additions and 0 deletions.
25 changes: 25 additions & 0 deletions TestCodeChallenge.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCodeChallenge", "TestCodeChallenge\TestCodeChallenge.csproj", "{30320792-AEDC-4D4E-A4B3-BEF2273D936A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3D968A08-79E2-4191-A779-C64F89BE59F2}
EndGlobalSection
EndGlobal
27 changes: 27 additions & 0 deletions TestCodeChallenge/TestCodeChallenge.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotNetSeleniumExtras.PageObjects.Core" Version="3.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="84.0.4147.3001" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<None Update="config\config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
75 changes: 75 additions & 0 deletions TestCodeChallenge/TestFocus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using NUnit.Framework;
using OpenQA.Selenium;
using SeleniumExtras.PageObjects;
using TestCodeChallange.pom;

namespace TestCodeChallange
{
[TestFixture]
public class TestFocus
{
protected IWebDriver web_driver;
HomePage p_home;
WindowsPage p_windows;
SearchPage p_search;
DetailsPage p_details;
CartPage p_cart;

[OneTimeSetUp]
public void OneTimeSetUp()
{
p_home = new HomePage(web_driver);
web_driver = p_home.DriverConn();

p_windows = new WindowsPage(web_driver);
p_search = new SearchPage(web_driver);
p_details = new DetailsPage(web_driver);
p_cart = new CartPage(web_driver);
}

[Test, Order(1)]
public void TestHomePageMenu()
{
p_home.LoadHomePage();
Assert.IsTrue(p_home.ValidateMenu(), "Menu is not valid, Missing Items", null);
}

[Test, Order(2)]
public void TestWindowsPageDD()
{
p_windows.LoadWindowsPage();
p_windows.ClickWindow();
Assert.IsTrue(p_windows.ValidateHasDDValues(), "DD is not valid, has no DD values to print", null);
}

[Test, Order(3)]
public void TestDetailsPrice()
{
p_search.LoadSearchPage();
p_search.SendSearchInput();
p_search.LoadSoftwareListItems();
p_details.LoadDetailsPage();
Assert.IsTrue(p_details.ValidateDetailsPrice(p_search.ItemPriceSearch), "Prices on Search Page and Detail Page for First Item are not the same Price Value", null);
}

[Test, Order(4)]
public void TestCartPrice()
{
p_cart.LoadCartPage();
Assert.IsTrue(p_cart.ValidateCartPrice(p_search.ItemPriceSearch), "Prices on Cart are not a match, 3 prices on screen are not the same", null);
}

[Test, Order(5)]
public void TestCart20ItemsPrice()
{
p_cart.LoadCar20Items();
Assert.IsTrue(p_cart.ValidateCart20ItemsPrice(), "Total Price of 20 Items base on Unit Price is not correct, the price don't match", null);
}

[OneTimeTearDown]
public void OneTimeTearDown()
{
p_home.DriverDown();
}
}
}
40 changes: 40 additions & 0 deletions TestCodeChallenge/base/APage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using OpenQA.Selenium;
using SeleniumExtras.PageObjects;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace TestCodeChallange.pom
{
public abstract class APage : IPage
{
public APage() { }

public abstract IWebDriver DriverConn();

public abstract void DriverDown();

public abstract IWebElement FindElement(By locator);

public abstract List<IWebElement> FindElements(By locator);

public abstract string GetText(IWebElement element);

public abstract string GetTextBy(By locator);

public abstract void ClickByLocator(By locator);

public abstract void TypeText(string inputText, By locator);

public abstract bool IsDisplayed(By locator);

public abstract void Visit(string node);

public abstract void ExecJavaScript(string javaCode);

public abstract void ClickByElement(IWebElement element);

public abstract void MoveToByElement(IWebElement element);
}
}
36 changes: 36 additions & 0 deletions TestCodeChallenge/base/IPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;

namespace TestCodeChallange.pom
{
interface IPage
{
public IWebDriver DriverConn();

public void DriverDown();

public IWebElement FindElement(By locator);

public List<IWebElement> FindElements(By locator);

public string GetText(IWebElement element);

public string GetTextBy(By locator);

public void ClickByLocator(By locator);

public void TypeText(string inputText, By locator);

public bool IsDisplayed(By locator);

public void Visit(string node);

public void ExecJavaScript(string javaCode);

public void ClickByElement(IWebElement element);

public void MoveToByElement(IWebElement element);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 026501d

Please sign in to comment.