Skip to content

Commit 96af8b5

Browse files
committed
first commit
0 parents  commit 96af8b5

7 files changed

Lines changed: 267 additions & 0 deletions

File tree

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Autosave files
2+
*~
3+
4+
# build
5+
[Oo]bj/
6+
[Bb]in/
7+
packages/
8+
TestResults/
9+
10+
# globs
11+
Makefile.in
12+
*.DS_Store
13+
*.sln.cache
14+
*.suo
15+
*.cache
16+
*.pidb
17+
*.userprefs
18+
*.usertasks
19+
config.log
20+
config.make
21+
config.status
22+
aclocal.m4
23+
install-sh
24+
autom4te.cache/
25+
*.user
26+
*.tar.gz
27+
tarballs/
28+
test-results/
29+
Thumbs.db
30+
.vs/
31+
32+
# Mac bundle stuff
33+
*.dmg
34+
*.app
35+
36+
# resharper
37+
*_Resharper.*
38+
*.Resharper
39+
40+
# dotCover
41+
*.dotCover

ApplitoolsTutorial.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplitoolsTutorial", "ApplitoolsTutorial\ApplitoolsTutorial.csproj", "{E2A51DD0-EB96-4E33-90B3-679B912B0337}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|x86 = Debug|x86
9+
Release|x86 = Release|x86
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{E2A51DD0-EB96-4E33-90B3-679B912B0337}.Debug|x86.ActiveCfg = Debug|x86
13+
{E2A51DD0-EB96-4E33-90B3-679B912B0337}.Debug|x86.Build.0 = Debug|x86
14+
{E2A51DD0-EB96-4E33-90B3-679B912B0337}.Release|x86.ActiveCfg = Release|x86
15+
{E2A51DD0-EB96-4E33-90B3-679B912B0337}.Release|x86.Build.0 = Release|x86
16+
EndGlobalSection
17+
EndGlobal
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
7+
<ProjectGuid>{E2A51DD0-EB96-4E33-90B3-679B912B0337}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>ApplitoolsTutorial</RootNamespace>
10+
<AssemblyName>ApplitoolsTutorial</AssemblyName>
11+
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\Debug</OutputPath>
18+
<DefineConstants>DEBUG;</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
<ExternalConsole>true</ExternalConsole>
22+
<PlatformTarget>x86</PlatformTarget>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
25+
<Optimize>true</Optimize>
26+
<OutputPath>bin\Release</OutputPath>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<ExternalConsole>true</ExternalConsole>
30+
<PlatformTarget>x86</PlatformTarget>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
<Reference Include="Ionic.Zip.Reduced">
35+
<HintPath>..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll</HintPath>
36+
</Reference>
37+
<Reference Include="Newtonsoft.Json">
38+
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Eyes.Sdk.DotNet">
41+
<HintPath>..\packages\Eyes.Sdk.2.21.12-beta\lib\net45\Eyes.Sdk.DotNet.dll</HintPath>
42+
</Reference>
43+
<Reference Include="System.Management" />
44+
<Reference Include="System.Web" />
45+
<Reference Include="System.Windows.Forms" />
46+
<Reference Include="WebDriver">
47+
<HintPath>..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll</HintPath>
48+
</Reference>
49+
<Reference Include="System.Drawing" />
50+
<Reference Include="System.Runtime">
51+
<HintPath>..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll</HintPath>
52+
</Reference>
53+
<Reference Include="mscorlib" />
54+
<Reference Include="System.ComponentModel.Composition" />
55+
<Reference Include="System.Core" />
56+
<Reference Include="CssParser">
57+
<HintPath>..\packages\Eyes.Sdk.2.21.12-beta\lib\net45\CssParser.dll</HintPath>
58+
</Reference>
59+
<Reference Include="Eyes.Selenium.DotNet">
60+
<HintPath>..\packages\Eyes.Selenium.2.21.12-beta\lib\net45\Eyes.Selenium.DotNet.dll</HintPath>
61+
</Reference>
62+
</ItemGroup>
63+
<ItemGroup>
64+
<Compile Include="Program.cs" />
65+
<Compile Include="Properties\AssemblyInfo.cs" />
66+
</ItemGroup>
67+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
68+
</Project>

ApplitoolsTutorial/Program.cs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using Applitools;
2+
using Applitools.Selenium;
3+
using Applitools.VisualGrid;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Chrome;
6+
using Configuration = Applitools.Selenium.Configuration;
7+
8+
9+
namespace ApplitoolsTutorial
10+
{
11+
12+
class Program
13+
{
14+
public static void Main()
15+
{
16+
Program program = new Program();
17+
program.Run();
18+
}
19+
20+
private void Run()
21+
{
22+
// Create a new webdriver
23+
IWebDriver webDriver = new ChromeDriver();
24+
25+
// Navigate to the url we want to test
26+
webDriver.Url = "https:/demo.applitools.com";
27+
28+
// ⭐️ Note to see visual bugs, run the test using the above URL for the 1st run.
29+
//but then change the above URL to https://demo.applitools.com/index_v2.html (for the 2nd run)
30+
31+
// Create a runner with concurrency of 10
32+
VisualGridRunner runner = new VisualGridRunner(10);
33+
34+
// Create Eyes object with the runner, meaning it'll be a Visual Grid eyes.
35+
Eyes eyes = new Eyes(runner);
36+
37+
//Set the Applitools API KEY here or as an environment variable "APPLITOOLS_API_KEY"
38+
eyes.ApiKey = "APPLITOOLS_API_KEY";
39+
40+
41+
// Create configuration object
42+
Configuration conf = new Configuration();
43+
44+
45+
// Set test name
46+
conf.TestName = "C# VisualGrid demo";
47+
48+
// Set app name
49+
conf.AppName = "Demo app";
50+
51+
// Add browsers with different viewports
52+
conf.AddBrowser(800, 600, Configuration.BrowserType.CHROME);
53+
conf.AddBrowser(700, 500, Configuration.BrowserType.CHROME);
54+
conf.AddBrowser(1200, 800, Configuration.BrowserType.FIREFOX);
55+
conf.AddBrowser(1600, 1200, Configuration.BrowserType.FIREFOX);
56+
57+
// Add iPhone 4 device emulation in Portraig mode
58+
EmulationInfo iphone4 = new EmulationInfo(EmulationInfo.DeviceNameEnum.iPhone_4, Applitools.VisualGrid.ScreenOrientation.Portrait);
59+
conf.AddDeviceEmulation(iphone4);
60+
61+
62+
63+
// Set the configuration object to eyes
64+
eyes.Configuration = conf;
65+
66+
// Call Open on eyes to initialize a test session
67+
eyes.Open(webDriver);
68+
69+
// check the login page
70+
eyes.Check(Target.Window().Fully().WithName("Login page"));
71+
webDriver.FindElement(By.Id("log-in")).Click();
72+
73+
// Check the app page
74+
eyes.Check(Target.Window().Fully().WithName("App page"));
75+
76+
// Close the browser
77+
webDriver.Quit();
78+
79+
//Wait and collect all test results
80+
TestResultSummary allTestResults = runner.GetAllTestResults();
81+
System.Console.WriteLine(allTestResults);
82+
}
83+
84+
}
85+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("ApplitoolsTutorial")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("")]
12+
[assembly: AssemblyCopyright("${AuthorCopyright}")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]

ApplitoolsTutorial/packages.config

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Castle.Core" version="4.3.1" targetFramework="net461" />
4+
<package id="DotNetZip.Reduced" version="1.9.1.8" targetFramework="net461" />
5+
<package id="Eyes.Sdk" version="2.21.12-beta" targetFramework="net47" />
6+
<package id="Eyes.Selenium" version="2.21.12-beta" targetFramework="net47" />
7+
<package id="log4net" version="2.0.8" targetFramework="net461" />
8+
<package id="Microsoft.CodedUI.Framework" version="2.0.0" targetFramework="net461" />
9+
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net47" />
10+
<package id="Selenium.Support" version="3.141.0" targetFramework="net461" />
11+
<package id="Selenium.WebDriver" version="3.141.0" targetFramework="net461" />
12+
<package id="System.Runtime" version="4.3.1" targetFramework="net461" />
13+
</packages>

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pre-requisites:
2+
3+
1. Visual Studio installed on your machine.
4+
* [Install it from here](https://visualstudio.microsoft.com/downloads/)
5+
2. Chrome Webdriver is on your machine and is in the PATH. Here are some resources from the internet that'll help you.
6+
* https://splinter.readthedocs.io/en/0.1/setup-chrome.html
7+
* https://stackoverflow.com/questions/38081021/using-selenium-on-mac-chrome
8+
* https://www.youtube.com/watch?time_continue=182&v=dz59GsdvUF8
9+
10+
# Steps to run this example
11+
12+
1. Git clone this repo
13+
2. Open the folder
14+
3. Double click the `ApplitoolsTutorial.sln`. This will open the project in Visual Studio
15+
3. Change the APPLITOOLS_API_KEY with your own.
16+
* Login to Applitools > Click on the Person icon > My API Key
17+
4. Hit Run

0 commit comments

Comments
 (0)