"Fossies" - the Fresh Open Source Software Archive 
Member "selenium-selenium-4.8.1/dotnet/test/common/I18Test.cs" (17 Feb 2023, 2754 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C# source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 using NUnit.Framework;
2 using OpenQA.Selenium.Environment;
3
4 namespace OpenQA.Selenium
5 {
6 [TestFixture]
7 public class I18Test : DriverTestFixture
8 {
9 // The Hebrew word shalom (peace) encoded in order Shin (sh) Lamed (L) Vav (O) final-Mem (M).
10 private string shalom = "\u05E9\u05DC\u05D5\u05DD";
11
12 // The Hebrew word tmunot (images) encoded in order Taf (t) Mem (m) Vav (u) Nun (n) Vav (o) Taf (t).
13 private string tmunot = "\u05EA\u05DE\u05D5\u05E0\u05D5\u05EA";
14
15 // This is the Chinese link text
16 private string linkText = "\u4E2D\u56FD\u4E4B\u58F0";
17
18 [Test]
19 public void ShouldBeAbleToReadChinese()
20 {
21 driver.Url = chinesePage;
22 driver.FindElement(By.LinkText(linkText)).Click();
23 }
24
25 [Test]
26 public void ShouldBeAbleToEnterHebrewTextFromLeftToRight()
27 {
28 driver.Url = chinesePage;
29 IWebElement input = driver.FindElement(By.Name("i18n"));
30
31 input.SendKeys(shalom);
32
33 Assert.AreEqual(shalom, input.GetAttribute("value"));
34 }
35
36 [Test]
37 public void ShouldBeAbleToEnterHebrewTextFromRightToLeft()
38 {
39 driver.Url = chinesePage;
40 IWebElement input = driver.FindElement(By.Name("i18n"));
41
42 input.SendKeys(tmunot);
43
44 Assert.AreEqual(tmunot, input.GetAttribute("value"));
45 }
46
47 [Test]
48 [IgnoreBrowser(Browser.Chrome, "ChromeDriver only supports characters in the BMP")]
49 [IgnoreBrowser(Browser.Edge, "EdgeDriver only supports characters in the BMP")]
50 public void ShouldBeAbleToEnterSupplementaryCharacters()
51 {
52 if (TestUtilities.IsOldIE(driver))
53 {
54 // IE: versions less thank 10 have issue 5069
55 return;
56 }
57
58 driver.Url = chinesePage;
59
60 string input = string.Empty;
61 input += char.ConvertFromUtf32(0x20000);
62 input += char.ConvertFromUtf32(0x2070E);
63 input += char.ConvertFromUtf32(0x2000B);
64 input += char.ConvertFromUtf32(0x2A190);
65 input += char.ConvertFromUtf32(0x2A6B2);
66
67 IWebElement el = driver.FindElement(By.Name("i18n"));
68 el.SendKeys(input);
69
70 Assert.AreEqual(input, el.GetAttribute("value"));
71 }
72
73 [Test]
74 [NeedsFreshDriver(IsCreatedBeforeTest = true)]
75 public void ShouldBeAbleToReturnTheTextInAPage()
76 {
77 string url = EnvironmentManager.Instance.UrlBuilder.WhereIs("encoding");
78 driver.Url = url;
79
80 string text = driver.FindElement(By.TagName("body")).Text;
81
82 Assert.AreEqual(shalom, text);
83 }
84 }
85 }