Skip to content

Commit

Permalink
chroe: Identifiers should not contain underscores (#723)
Browse files Browse the repository at this point in the history
chore: replace deprecated App managments methods
chore: add SupportedOSPlatform attribute
  • Loading branch information
Dor-bl authored Jan 19, 2024
1 parent 3af6c1a commit 0b58d13
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions test/integration/Android/ClipboardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Enums;
using System;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;

namespace Appium.Net.Integration.Tests.Android
Expand All @@ -13,6 +14,7 @@ public class ClipboardTest
private AndroidDriver _driver;
private const string ClipboardTestString = "Hello Clipboard";
private const string Base64RegexPattern = @"^[a-zA-Z0-9\+/]*={0,2}$";
private readonly string _appId = Apps.GetId(Apps.androidApiDemos);

[OneTimeSetUp]
public void BeforeAll()
Expand All @@ -27,89 +29,90 @@ public void BeforeAll()
[SetUp]
public void SetUp()
{
_driver?.LaunchApp();
_driver?.ActivateApp(_appId);
}

[OneTimeTearDown]
public void OneTimeTearDown()
{
_driver?.CloseApp();
_driver?.TerminateApp(_appId);
_driver?.Quit();
}

[Test]
public void WhenSetClipboardContentTypeIsPlainText_GetClipboardShouldReturnEncodedBase64String()
public void WhenSetClipboardContentTypeIsPlainTextGetClipboardShouldReturnEncodedBase64String()
{
_driver.SetClipboard(ClipboardContentType.PlainText, ClipboardTestString);
Assert.That(() => Regex.IsMatch(_driver.GetClipboard(ClipboardContentType.PlainText), Base64RegexPattern, RegexOptions.Multiline),
Is.True);
}

[Test]
public void WhenClipboardContentTypeIsPlainTextWithLabel_GetClipboardTextShouldReturnActualText()
public void WhenClipboardContentTypeIsPlainTextWithLabelGetClipboardTextShouldReturnActualText()
{
_driver.SetClipboardText(ClipboardTestString, label:"testing");
Assert.That(() => _driver.GetClipboardText(), Does.Match(ClipboardTestString));
}

[Test]
public void WhenClipboardContentTypeIsPlainTextWithOutLabel_GetClipboardTextShouldReturnActualText()
public void WhenClipboardContentTypeIsPlainTextWithOutLabelGetClipboardTextShouldReturnActualText()
{
_driver.SetClipboardText(ClipboardTestString, null);
Assert.That(() => _driver.GetClipboardText(), Does.Match(ClipboardTestString));
}

[Test]
public void WhenClipboardIsEmpty_GetClipboardShouldReturnEmptyString()
public void WhenClipboardIsEmptyGetClipboardShouldReturnEmptyString()
{
_driver.SetClipboardText(string.Empty, null);
Assert.That(() => _driver.GetClipboard(ClipboardContentType.PlainText), Is.Empty);
}

[Test]
public void WhenClipboardIsEmpty_GetClipboardTextShouldReturnEmptyString()
public void WhenClipboardIsEmptyGetClipboardTextShouldReturnEmptyString()
{
_driver.SetClipboardText(string.Empty, null);
Assert.That(() => _driver.GetClipboardText(), Is.Empty);
}

[Test]
public void WhenSetClipboardContentTypeIsImage_SetClipboardShouldReturnNotImplementedException()
public void WhenSetClipboardContentTypeIsImageSetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.SetClipboard(ClipboardContentType.Image, ClipboardTestString),
Throws.TypeOf<NotImplementedException>());
}

[Test]
public void WhenGetClipboardImage_GetClipboardShouldReturnNotImplementedException()
[SupportedOSPlatform("windows")]
public void WhenGetClipboardImageGetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.GetClipboardImage(),
Throws.TypeOf<NotImplementedException>());
}

[Test]
public void WhenGetClipboardUrl_GetClipboardShouldReturnNotImplementedException()
public void WhenGetClipboardUrlGetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.GetClipboardUrl(),
Throws.TypeOf<NotImplementedException>());
}

[Test]
public void WhenSetClipboardContentTypeIsUrl_SetClipboardShouldReturnNotImplementedException()
public void WhenSetClipboardContentTypeIsUrlSetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.SetClipboard(ClipboardContentType.Url, string.Empty),
Throws.TypeOf<NotImplementedException>());
}

[Test]
public void WhenClipboardContentTypeIsUrl_GetClipboardShouldReturnNotImplementedException()
public void WhenClipboardContentTypeIsUrlGetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.GetClipboard(ClipboardContentType.Url),
Throws.TypeOf<NotImplementedException>());
}

[Test]
public void WhenClipboardContentTypeIsImage_GetClipboardShouldReturnNotImplementedException()
public void WhenClipboardContentTypeIsImageGetClipboardShouldReturnNotImplementedException()
{
Assert.That(() => _driver.GetClipboard(ClipboardContentType.Image),
Throws.TypeOf<NotImplementedException>());
Expand Down

0 comments on commit 0b58d13

Please sign in to comment.