Last active
October 25, 2019 09:55
-
-
Save Delaire/779dbd9353cb643e0b6be5016abf62c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace DailymotionUITest.v2 | |
{ | |
[TestClass] | |
public class Login_scenario : DailymotionSession | |
{ | |
[ClassInitialize] | |
public static void ClassInitialize(TestContext context) | |
{ | |
// Create session to launch a Calculator window | |
Setup(context); | |
} | |
[ClassCleanup] | |
public static void ClassCleanup() | |
{ | |
TearDown(); | |
} | |
[TestMethod] | |
public void AccessLoginView_UsingRecordedUI() | |
{ | |
//click on Home | |
// LeftClick on Text "DmExploreView" at (15,8) | |
Console.WriteLine("LeftClick on Text \"DmExploreView\" at (15,8)"); | |
string xpath_LeftClickTextDmExploreV_15_8 = "/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@ClassName=\"ApplicationFrameWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/Window[@ClassName=\"Windows.UI.Core.CoreWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/List[@Name=\"Menu items\"][@AutomationId=\"ButtonsListView\"]/ListItem[@ClassName=\"ListViewItem\"][@Name=\"Home\"]/Text[@ClassName=\"TextBlock\"][@Name=\"DmExploreView\"]"; | |
var winElem_LeftClickTextDmExploreV_15_8 = session.FindElementByXPath(xpath_LeftClickTextDmExploreV_15_8); | |
if (winElem_LeftClickTextDmExploreV_15_8 != null) | |
{ | |
winElem_LeftClickTextDmExploreV_15_8.Click(); | |
} | |
else | |
{ | |
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickTextDmExploreV_15_8}"); | |
return; | |
} | |
//check to see if we have found the home btn | |
Assert.IsNotNull(winElem_LeftClickTextDmExploreV_15_8); | |
//click on library | |
// LeftClick on ListItem "Library" at (43,41) | |
Console.WriteLine("LeftClick on ListItem \"Library\" at (43,41)"); | |
string xpath_LeftClickListItemLibrary_43_41 = "/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@ClassName=\"ApplicationFrameWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/Window[@ClassName=\"Windows.UI.Core.CoreWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/List[@Name=\"Menu items\"][@AutomationId=\"ButtonsListView\"]/ListItem[@ClassName=\"ListViewItem\"][@Name=\"Library\"]"; | |
var winElem_LeftClickListItemLibrary_43_41 = session.FindElementByXPath(xpath_LeftClickListItemLibrary_43_41); | |
if (winElem_LeftClickListItemLibrary_43_41 != null) | |
{ | |
winElem_LeftClickListItemLibrary_43_41.Click(); | |
} | |
else | |
{ | |
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickListItemLibrary_43_41}"); | |
return; | |
} | |
//check to see if we have found the library btn | |
Assert.IsNotNull(winElem_LeftClickListItemLibrary_43_41); | |
//click on login | |
// LeftClick on Button "Dailymotion - all the videos that matter - 1 running window" at (34,7) | |
Console.WriteLine("LeftClick on Button \"Dailymotion - all the videos that matter - 1 running window\" at (34,7)"); | |
string xpath_LeftClickButtonDailymotio_34_7 = "/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Pane[@ClassName=\"Shell_TrayWnd\"][@Name=\"Taskbar\"]/ToolBar[@ClassName=\"MSTaskListWClass\"][@Name=\"Running applications\"]/Button[@Name=\"Dailymotion - all the videos that matter - 1 running window\"][@AutomationId=\"DailymotionSA.Dailymotion_6dqnvyezrysvy!App\"]"; | |
var winElem_LeftClickButtonDailymotio_34_7 = session.FindElementByXPath(xpath_LeftClickButtonDailymotio_34_7); | |
if (winElem_LeftClickButtonDailymotio_34_7 != null) | |
{ | |
winElem_LeftClickButtonDailymotio_34_7.Click(); | |
} | |
else | |
{ | |
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonDailymotio_34_7}"); | |
return; | |
} | |
//check to see if we have found the login btn | |
Assert.IsNotNull(winElem_LeftClickButtonDailymotio_34_7); | |
// LeftClick on Button "Sign up / Sign in" at (32,14) | |
Console.WriteLine("LeftClick on Button \"Sign up / Sign in\" at (32,14)"); | |
string xpath_LeftClickButtonSignupSign_32_14 = "/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@ClassName=\"ApplicationFrameWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/Window[@ClassName=\"Windows.UI.Core.CoreWindow\"][@Name=\"Dailymotion - all the videos that matter\"]/Button[@Name=\"Sign up / Sign in\"][@AutomationId=\"LoginBtn\"]"; | |
var winElem_LeftClickButtonSignupSign_32_14 = session.FindElementByXPath(xpath_LeftClickButtonSignupSign_32_14); | |
if (winElem_LeftClickButtonSignupSign_32_14 != null) | |
{ | |
winElem_LeftClickButtonSignupSign_32_14.Click(); | |
} | |
else | |
{ | |
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonSignupSign_32_14}"); | |
return; | |
} | |
//check to see if we have found the sign up btn | |
Assert.IsNotNull(winElem_LeftClickButtonSignupSign_32_14); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment