Skip to content

Commit b29951b

Browse files
committed
Add project files.
1 parent 599b51d commit b29951b

File tree

7 files changed

+204
-0
lines changed

7 files changed

+204
-0
lines changed

DemoBlazeHomePage.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using OpenQA.Selenium;
3+
4+
namespace demoblaze_selenium_csharp
5+
{
6+
internal class DemoBlazeHomePage
7+
{
8+
private readonly IWebDriver _driver;
9+
10+
public DemoBlazeHomePage(IWebDriver driver)
11+
{
12+
_driver = driver;
13+
}
14+
15+
public string HomePageUrl => "https://www.demoblaze.com/index.html";
16+
17+
public By NavbarLocator => By.Id("navbarExample");
18+
19+
internal void GoTo()
20+
{
21+
_driver.Navigate().GoToUrl(HomePageUrl);
22+
}
23+
24+
internal bool PageIsOpened() => _driver.FindElement(NavbarLocator).Displayed;
25+
26+
}
27+
}

HomepageTests.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using NUnit.Framework;
2+
using OpenQA.Selenium;
3+
using OpenQA.Selenium.Chrome;
4+
5+
namespace demoblaze_selenium_csharp
6+
{
7+
[TestFixture]
8+
public class HomepageTests
9+
{
10+
public IWebDriver Driver { get; private set; }
11+
12+
[SetUp]
13+
public void SetupBeforeEverySingleTest()
14+
{
15+
Driver = new ChromeDriver();
16+
Driver.Manage().Window.Maximize();
17+
}
18+
19+
[TearDown]
20+
public void CleanUpAfterEverySingleTest()
21+
{
22+
Driver.Close();
23+
Driver.Quit();
24+
}
25+
26+
[Test]
27+
public void GivenUrlAddress_WhenUserOpenHomepage_ThenHomePageIsOpened()
28+
{
29+
DemoBlazeHomePage demoBlazeHomePage = new DemoBlazeHomePage(Driver);
30+
demoBlazeHomePage.GoTo();
31+
32+
Assert.That(demoBlazeHomePage.PageIsOpened(), Is.True);
33+
}
34+
}
35+
}

Properties/AssemblyInfo.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
[assembly: AssemblyTitle("demoblaze-selenium-csharp")]
6+
[assembly: AssemblyDescription("")]
7+
[assembly: AssemblyConfiguration("")]
8+
[assembly: AssemblyCompany("")]
9+
[assembly: AssemblyProduct("demoblaze-selenium-csharp")]
10+
[assembly: AssemblyCopyright("Copyright © 2020")]
11+
[assembly: AssemblyTrademark("")]
12+
[assembly: AssemblyCulture("")]
13+
14+
[assembly: ComVisible(false)]
15+
16+
[assembly: Guid("d06c3176-e7bd-48ef-8b57-7ce25dbe1d22")]
17+
18+
// [assembly: AssemblyVersion("1.0.*")]
19+
[assembly: AssemblyVersion("1.0.0.0")]
20+
[assembly: AssemblyFileVersion("1.0.0.0")]

chromedriver.exe

7.7 MB
Binary file not shown.

demoblaze-selenium-csharp.csproj

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="packages\NUnit3TestAdapter.3.16.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('packages\NUnit3TestAdapter.3.16.1\build\net35\NUnit3TestAdapter.props')" />
4+
<Import Project="packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('packages\NUnit.3.12.0\build\NUnit.props')" />
5+
<Import Project="packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
6+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
7+
<PropertyGroup>
8+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
9+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
10+
<ProjectGuid>{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}</ProjectGuid>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace>demoblaze_selenium_csharp</RootNamespace>
14+
<AssemblyName>demoblaze-selenium-csharp</AssemblyName>
15+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
16+
<FileAlignment>512</FileAlignment>
17+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
18+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
19+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
20+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
21+
<IsCodedUITest>False</IsCodedUITest>
22+
<TestProjectType>UnitTest</TestProjectType>
23+
<NuGetPackageImportStamp>
24+
</NuGetPackageImportStamp>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
<DebugType>full</DebugType>
29+
<Optimize>false</Optimize>
30+
<OutputPath>bin\Debug\</OutputPath>
31+
<DefineConstants>DEBUG;TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
36+
<DebugType>pdbonly</DebugType>
37+
<Optimize>true</Optimize>
38+
<OutputPath>bin\Release\</OutputPath>
39+
<DefineConstants>TRACE</DefineConstants>
40+
<ErrorReport>prompt</ErrorReport>
41+
<WarningLevel>4</WarningLevel>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
45+
<HintPath>packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
46+
</Reference>
47+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
48+
<HintPath>packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
49+
</Reference>
50+
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
51+
<HintPath>packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
52+
</Reference>
53+
<Reference Include="System" />
54+
<Reference Include="System.Core" />
55+
<Reference Include="System.Drawing" />
56+
<Reference Include="WebDriver, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL">
57+
<HintPath>packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll</HintPath>
58+
</Reference>
59+
<Reference Include="WebDriver.Support, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL">
60+
<HintPath>packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll</HintPath>
61+
</Reference>
62+
</ItemGroup>
63+
<ItemGroup>
64+
<Compile Include="DemoBlazeHomePage.cs" />
65+
<Compile Include="HomepageTests.cs" />
66+
<Compile Include="Properties\AssemblyInfo.cs" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<None Include="packages.config" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<Content Include="chromedriver.exe">
73+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
74+
</Content>
75+
</ItemGroup>
76+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
77+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
78+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
79+
<PropertyGroup>
80+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
81+
</PropertyGroup>
82+
<Error Condition="!Exists('packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
83+
<Error Condition="!Exists('packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
84+
<Error Condition="!Exists('packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\NUnit.3.12.0\build\NUnit.props'))" />
85+
<Error Condition="!Exists('packages\NUnit3TestAdapter.3.16.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\NUnit3TestAdapter.3.16.1\build\net35\NUnit3TestAdapter.props'))" />
86+
</Target>
87+
<Import Project="packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
88+
</Project>

demoblaze-selenium-csharp.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.29806.167
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demoblaze-selenium-csharp", "demoblaze-selenium-csharp.csproj", "{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}"
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+
{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D06C3176-E7BD-48EF-8B57-7CE25DBE1D22}.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 = {A39974F3-E6F9-45C5-BB54-DD542C7D5007}
24+
EndGlobalSection
25+
EndGlobal

packages.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
4+
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
5+
<package id="NUnit" version="3.12.0" targetFramework="net472" />
6+
<package id="NUnit3TestAdapter" version="3.16.1" targetFramework="net472" developmentDependency="true" />
7+
<package id="Selenium.Support" version="3.141.0" targetFramework="net472" />
8+
<package id="Selenium.WebDriver" version="3.141.0" targetFramework="net472" />
9+
</packages>

0 commit comments

Comments
 (0)