|
3 | 3 | using Applitools.VisualGrid; |
4 | 4 | using OpenQA.Selenium; |
5 | 5 | using OpenQA.Selenium.Chrome; |
| 6 | +using static Applitools.Configuration; |
| 7 | +using static Applitools.VisualGrid.ChromeEmulationInfo; |
6 | 8 | using Configuration = Applitools.Selenium.Configuration; |
7 | | - |
| 9 | +using ScreenOrientation = Applitools.VisualGrid.ScreenOrientation; |
8 | 10 |
|
9 | 11 | namespace ApplitoolsTutorial |
10 | 12 | { |
@@ -34,34 +36,30 @@ private void Run() |
34 | 36 | // Create Eyes object with the runner, meaning it'll be a Visual Grid eyes. |
35 | 37 | Eyes eyes = new Eyes(runner); |
36 | 38 |
|
37 | | - //Set the Applitools API KEY here or as an environment variable "APPLITOOLS_API_KEY" |
38 | | - eyes.ApiKey = "APPLITOOLS_API_KEY"; |
39 | | - |
40 | | - |
41 | 39 | // Create configuration object |
42 | 40 | Configuration conf = new Configuration(); |
43 | | - |
44 | 41 |
|
45 | | - // Set test name |
46 | | - conf.TestName = "C# VisualGrid demo"; |
47 | 42 |
|
48 | | - // Set app name |
49 | | - conf.AppName = "Demo app"; |
50 | 43 |
|
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); |
| 44 | + // Set the Applitools API KEY here or as an environment variable "APPLITOOLS_API_KEY" |
| 45 | + conf.SetApiKey("APPLITOOLS_API_KEY") |
| 46 | + .SetTestName("C# VisualGrid demo") // Set test name |
| 47 | + .SetAppName("Demo app"); // Set app name |
| 48 | + |
| 49 | + // Add different browsers with different viewports |
| 50 | + conf.AddBrowser(800, 600, BrowserType.CHROME); |
| 51 | + conf.AddBrowser(700, 500, BrowserType.CHROME); |
| 52 | + conf.AddBrowser(1200, 800, BrowserType.FIREFOX); |
| 53 | + conf.AddBrowser(1600, 1200, BrowserType.FIREFOX); |
56 | 54 |
|
57 | 55 | // Add iPhone 4 device emulation in Portraig mode |
58 | | - EmulationInfo iphone4 = new EmulationInfo(EmulationInfo.DeviceNameEnum.iPhone_4, Applitools.VisualGrid.ScreenOrientation.Portrait); |
| 56 | + ChromeEmulationInfo iphone4 = new ChromeEmulationInfo(DeviceNameEnum.iPhone_4, ScreenOrientation.Portrait); |
59 | 57 | conf.AddDeviceEmulation(iphone4); |
60 | 58 |
|
61 | 59 |
|
62 | 60 |
|
63 | 61 | // Set the configuration object to eyes |
64 | | - eyes.Configuration = conf; |
| 62 | + eyes.SetConfiguration(conf); |
65 | 63 |
|
66 | 64 | // Call Open on eyes to initialize a test session |
67 | 65 | eyes.Open(webDriver); |
|
0 commit comments