Skip to content

Instantly share code, notes, and snippets.

@hatelove
Created August 27, 2017 04:46
Show Gist options
  • Save hatelove/f4b1c956fc267171590a9be1a11d5e93 to your computer and use it in GitHub Desktop.
Save hatelove/f4b1c956fc267171590a9be1a11d5e93 to your computer and use it in GitHub Desktop.
learning from teaching, web testing with page objects in the better way
[TestMethod]
public void Test_輸入關鍵字_skilltree_進行搜尋_搜尋結果第一頁應出現skilltree官網的連結()
{
//arrange
//到google search首頁
var googleSearchPage = new GoogleSearchPage(this);
googleSearchPage.Go();
//act
//搜尋skilltree
var keywords = "skilltree";
googleSearchPage.Search(keywords);
//assert
//搜尋結果第一頁應存在"https://skilltree.my/"的連結
var googleSearchResultsPage = new GoogleSearchResultsPage(this);
var expectedLink = "https://skilltree.my/";
googleSearchResultsPage.FindResults(expectedLink);
}
[TestMethod]
public void Test_輸入關鍵字_skilltree_進行搜尋_搜尋結果第一頁應出現skilltree官網的連結()
{
//到google search首頁
//搜尋skilltree
//搜尋結果第一頁應存在"https://skilltree.my/"的連結
new GoogleSearchPage(this)
.Go()
.Search("skilltree")
.Switch<GoogleSearchResultPage>()
.ShouldExistedLink("https://skilltree.my/");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment