forked from appium/dotnet-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IosOrientationTest.cs
59 lines (54 loc) · 1.69 KB
/
IosOrientationTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Appium.Samples.Helpers;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Appium.Samples
{
[TestFixture ()]
public class IosOrientationTest
{
private IWebDriver driver;
private bool allPassed = true;
[TestFixtureSetUp]
public void beforeAll(){
DesiredCapabilities capabilities = Caps.getIos71Caps (Apps.get("iosUICatalogApp"));
if (Env.isSauce ()) {
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("name", "ios - complex");
capabilities.SetCapability("tags", new string[]{"sample"});
}
Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.localURI;
driver = new IOSDriver(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
}
[TestFixtureTearDown]
public void afterAll(){
try
{
if(Env.isSauce())
((IJavaScriptExecutor)driver).ExecuteScript("sauce:job-result=" + (allPassed ? "passed" : "failed"));
}
finally
{
driver.Quit();
}
}
[TearDown]
public void AfterEach(){
allPassed = allPassed && (TestContext.CurrentContext.Result.State == TestState.Success);
}
[Test]
public void OrientationTest()
{
IRotatable rotatable = ((IRotatable) driver);
rotatable.Orientation = ScreenOrientation.Landscape;
Assert.AreEqual(ScreenOrientation.Landscape, rotatable.Orientation);
}
}
}