I've created a basic test for checking if some article is displayed and I have a question regarding Page object model. In my solution, I've testing page, base page, map page with element id's, and method page with main logic. Test is something like - open site, navigate to articles, search for 'ArticleX', click on it, add it to the basket, edit the basket. For those operations, I've created 5 tests in my testing page, but now wondering is correct, or I should reduce them? All of them have repeated methods, which I test, for example the last test, called 'Edit basket'. I performing the following operations:
[Test]
public void TestEditBasket() {
logicPage = new LogicPage();
logicPage.NavigateTo();
logicPage.ClickArticles();
logicPage.SearchArticleX();
logicPage.PressArticleX();
logicPage.AddArticleXToBasket();
logicPage.EditBasket();
//this test only checks name, quantity, price when you're editing basket
Assert.IsTrue(logicPage.ArticleNameInBasket.Text.Contains("ArticleXHeading"));
Assert.IsTrue(logicPage.ArticleQuantityInBasket.Text.Contains("1"));
Assert.IsTrue(logicPage.ArticlePriceInBasket.Text.Contains("$10"));
NavigateTo
, ClickArticles
, SearchArticleX
, PressArticleX
, AddArticleXToBasket
are already tested in the previous tests, but I cannot go directly to the last step - EditBasket
, that's why I'm using them in this test.
I can delete the other tests and left only this one. But will add around of 10 more asserts. Any advice?