Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
194 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using OpenQA.Selenium; | ||
|
||
namespace Royale.Pages | ||
{ | ||
public class CardDetailsPage : PageBase | ||
{ | ||
public readonly CardDetailsPageMap Map; | ||
|
||
public CardDetailsPage(IWebDriver driver) : base(driver) | ||
{ | ||
Map = new CardDetailsPageMap(driver); | ||
} | ||
|
||
public (string Category, string Arena) GetCardCategory() | ||
{ | ||
var categories = Map.CardCategory.Text.Split(','); | ||
return (categories[0].Trim(), categories[1].Trim()); | ||
} | ||
} | ||
|
||
public class CardDetailsPageMap | ||
{ | ||
IWebDriver _driver; | ||
|
||
public CardDetailsPageMap(IWebDriver driver) | ||
{ | ||
_driver = driver; | ||
} | ||
|
||
public IWebElement CardName => _driver.FindElement(By.CssSelector("div[class*='cardName']")); | ||
|
||
public IWebElement CardCategory => _driver.FindElement(By.CssSelector("div[class*='card__rarity']")); | ||
|
||
public IWebElement CardRarity => _driver.FindElement(By.CssSelector("div[class*='rarityCaption']")); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using OpenQA.Selenium; | ||
|
||
namespace Royale.Pages | ||
{ | ||
public class CardsPage : PageBase | ||
{ | ||
public readonly CardsPageMap Map; | ||
|
||
public CardsPage(IWebDriver driver) : base(driver) | ||
{ | ||
Map = new CardsPageMap(driver); | ||
} | ||
|
||
public CardsPage Goto() | ||
{ | ||
HeaderNav.GotoCardsPage(); | ||
return this; | ||
} | ||
|
||
public IWebElement GetCardByName(string cardName) | ||
{ | ||
// Given the cardName "Ice Spirit" => should turn into "Ice+Spirit" to work with our locator. | ||
if (cardName.Contains(" ")) | ||
{ | ||
cardName = cardName.Replace(" ", "+"); | ||
} | ||
|
||
return Map.Card(cardName); | ||
} | ||
} | ||
|
||
public class CardsPageMap | ||
{ | ||
IWebDriver _driver; | ||
|
||
public CardsPageMap(IWebDriver driver) | ||
{ | ||
_driver = driver; | ||
} | ||
|
||
public IWebElement Card(string name) => _driver.FindElement(By.CssSelector($"a[href*='{name}']")); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using OpenQA.Selenium; | ||
|
||
namespace Royale.Pages | ||
{ | ||
public class HeaderNav | ||
{ | ||
public readonly HeaderNavMap Map; | ||
|
||
public HeaderNav(IWebDriver driver) | ||
{ | ||
Map = new HeaderNavMap(driver); | ||
} | ||
|
||
public void GotoCardsPage() | ||
{ | ||
Map.CardsTabLink.Click(); | ||
} | ||
} | ||
|
||
public class HeaderNavMap | ||
{ | ||
IWebDriver _driver; | ||
|
||
public HeaderNavMap(IWebDriver driver) | ||
{ | ||
_driver = driver; | ||
} | ||
|
||
public IWebElement CardsTabLink => _driver.FindElement(By.CssSelector("a[href='/cards']")); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using OpenQA.Selenium; | ||
|
||
namespace Royale.Pages | ||
{ | ||
public abstract class PageBase | ||
{ | ||
public readonly HeaderNav HeaderNav; | ||
|
||
public PageBase(IWebDriver driver) | ||
{ | ||
HeaderNav = new HeaderNav(driver); | ||
} | ||
} | ||
} |
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