-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update lesson 21 Thuc hanh POM part 2
- Loading branch information
Showing
6 changed files
with
80 additions
and
16 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
36 changes: 36 additions & 0 deletions
36
src/test/java/anhtester/com/pages/customers/CustomerDetailPage.java
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 @@ | ||
package anhtester.com.pages.customers; | ||
|
||
import anhtester.com.keywords.WebUI; | ||
import org.openqa.selenium.WebDriver; | ||
import org.testng.Assert; | ||
|
||
public class CustomerDetailPage extends AddNewCustomerPage { | ||
|
||
//Object in Customer Detail page | ||
//Không phải khai báo lại Object vì đã kế thừa từ AddNewCustomerPage | ||
//Không bị duplicated | ||
//Tiết kiệm thời gian | ||
//Lỡ có thay đổi thì chỉ cần sửa ở 1 nơi => AddNewCustomerPage | ||
|
||
private WebDriver driver; | ||
|
||
public CustomerDetailPage(WebDriver _driver) { | ||
super(_driver); | ||
driver = _driver; | ||
} | ||
|
||
public void checkCustomerDetail(String customerName) { | ||
WebUI.waitForPageLoaded(driver); | ||
System.out.println(driver.findElement(company).getAttribute("value")); | ||
System.out.println(driver.findElement(vat).getAttribute("value")); | ||
System.out.println(driver.findElement(phoneNumber).getAttribute("value")); | ||
|
||
//Kiểm tra thì phải dùng Assert | ||
//Phải dùng Equals chứ không nên dùng Contains vì giá trị phải đúng chính xác | ||
Assert.assertEquals(driver.findElement(company).getAttribute("value"), customerName, "Company Name not match."); | ||
Assert.assertEquals(driver.findElement(vat).getAttribute("value"), "10", "VAT not match."); | ||
Assert.assertEquals(driver.findElement(phoneNumber).getAttribute("value"), "0123456789", "Phone Number not match."); | ||
|
||
} | ||
|
||
} |
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