Skip to content

Commit 026501d

Browse files
committed
Adding BaseLine code
Adding BaseLine code
1 parent a6c49c5 commit 026501d

File tree

153 files changed

+8631
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+8631
-0
lines changed

TestCodeChallenge.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30330.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCodeChallenge", "TestCodeChallenge\TestCodeChallenge.csproj", "{30320792-AEDC-4D4E-A4B3-BEF2273D936A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{30320792-AEDC-4D4E-A4B3-BEF2273D936A}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3D968A08-79E2-4191-A779-C64F89BE59F2}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="DotNetSeleniumExtras.PageObjects.Core" Version="3.12.0" />
11+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
12+
<PackageReference Include="nunit" Version="3.12.0" />
13+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
15+
<PackageReference Include="Selenium.Support" Version="3.141.0" />
16+
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
17+
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="84.0.4147.3001" />
18+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<None Update="config\config.json">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
</None>
25+
</ItemGroup>
26+
27+
</Project>

TestCodeChallenge/TestFocus.cs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using NUnit.Framework;
2+
using OpenQA.Selenium;
3+
using SeleniumExtras.PageObjects;
4+
using TestCodeChallange.pom;
5+
6+
namespace TestCodeChallange
7+
{
8+
[TestFixture]
9+
public class TestFocus
10+
{
11+
protected IWebDriver web_driver;
12+
HomePage p_home;
13+
WindowsPage p_windows;
14+
SearchPage p_search;
15+
DetailsPage p_details;
16+
CartPage p_cart;
17+
18+
[OneTimeSetUp]
19+
public void OneTimeSetUp()
20+
{
21+
p_home = new HomePage(web_driver);
22+
web_driver = p_home.DriverConn();
23+
24+
p_windows = new WindowsPage(web_driver);
25+
p_search = new SearchPage(web_driver);
26+
p_details = new DetailsPage(web_driver);
27+
p_cart = new CartPage(web_driver);
28+
}
29+
30+
[Test, Order(1)]
31+
public void TestHomePageMenu()
32+
{
33+
p_home.LoadHomePage();
34+
Assert.IsTrue(p_home.ValidateMenu(), "Menu is not valid, Missing Items", null);
35+
}
36+
37+
[Test, Order(2)]
38+
public void TestWindowsPageDD()
39+
{
40+
p_windows.LoadWindowsPage();
41+
p_windows.ClickWindow();
42+
Assert.IsTrue(p_windows.ValidateHasDDValues(), "DD is not valid, has no DD values to print", null);
43+
}
44+
45+
[Test, Order(3)]
46+
public void TestDetailsPrice()
47+
{
48+
p_search.LoadSearchPage();
49+
p_search.SendSearchInput();
50+
p_search.LoadSoftwareListItems();
51+
p_details.LoadDetailsPage();
52+
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);
53+
}
54+
55+
[Test, Order(4)]
56+
public void TestCartPrice()
57+
{
58+
p_cart.LoadCartPage();
59+
Assert.IsTrue(p_cart.ValidateCartPrice(p_search.ItemPriceSearch), "Prices on Cart are not a match, 3 prices on screen are not the same", null);
60+
}
61+
62+
[Test, Order(5)]
63+
public void TestCart20ItemsPrice()
64+
{
65+
p_cart.LoadCar20Items();
66+
Assert.IsTrue(p_cart.ValidateCart20ItemsPrice(), "Total Price of 20 Items base on Unit Price is not correct, the price don't match", null);
67+
}
68+
69+
[OneTimeTearDown]
70+
public void OneTimeTearDown()
71+
{
72+
p_home.DriverDown();
73+
}
74+
}
75+
}

TestCodeChallenge/base/APage.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using OpenQA.Selenium;
2+
using SeleniumExtras.PageObjects;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.ComponentModel.DataAnnotations;
6+
using System.Text;
7+
8+
namespace TestCodeChallange.pom
9+
{
10+
public abstract class APage : IPage
11+
{
12+
public APage() { }
13+
14+
public abstract IWebDriver DriverConn();
15+
16+
public abstract void DriverDown();
17+
18+
public abstract IWebElement FindElement(By locator);
19+
20+
public abstract List<IWebElement> FindElements(By locator);
21+
22+
public abstract string GetText(IWebElement element);
23+
24+
public abstract string GetTextBy(By locator);
25+
26+
public abstract void ClickByLocator(By locator);
27+
28+
public abstract void TypeText(string inputText, By locator);
29+
30+
public abstract bool IsDisplayed(By locator);
31+
32+
public abstract void Visit(string node);
33+
34+
public abstract void ExecJavaScript(string javaCode);
35+
36+
public abstract void ClickByElement(IWebElement element);
37+
38+
public abstract void MoveToByElement(IWebElement element);
39+
}
40+
}

TestCodeChallenge/base/IPage.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using OpenQA.Selenium;
5+
6+
namespace TestCodeChallange.pom
7+
{
8+
interface IPage
9+
{
10+
public IWebDriver DriverConn();
11+
12+
public void DriverDown();
13+
14+
public IWebElement FindElement(By locator);
15+
16+
public List<IWebElement> FindElements(By locator);
17+
18+
public string GetText(IWebElement element);
19+
20+
public string GetTextBy(By locator);
21+
22+
public void ClickByLocator(By locator);
23+
24+
public void TypeText(string inputText, By locator);
25+
26+
public bool IsDisplayed(By locator);
27+
28+
public void Visit(string node);
29+
30+
public void ExecJavaScript(string javaCode);
31+
32+
public void ClickByElement(IWebElement element);
33+
34+
public void MoveToByElement(IWebElement element);
35+
}
36+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)