Commit aaa54ba4603a85cb19adf03380b93a82f8057d08
1 parent
687cafe9
通知装柜提交
Showing
3 changed files
with
196 additions
and
0 deletions
Show diff stats
src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java
0 → 100644
... | ... | @@ -0,0 +1,84 @@ |
1 | +package com.essa.pageObject.PODocumentary; | |
2 | + | |
3 | +import org.openqa.selenium.By; | |
4 | +import org.openqa.selenium.WebDriver; | |
5 | +import com.essa.framework.BasePage; | |
6 | +import org.openqa.selenium.WebElement; | |
7 | +import org.openqa.selenium.support.FindBy; | |
8 | + | |
9 | +import java.util.Date; | |
10 | + | |
11 | +/** | |
12 | + * @author Administrator | |
13 | + *PO详情页 | |
14 | + */ | |
15 | +public class POBoardPage extends BasePage { | |
16 | + | |
17 | + public POBoardPage(WebDriver driver) { super(driver); } | |
18 | + | |
19 | + /* | |
20 | + * 元素定位 | |
21 | + */ | |
22 | + @FindBy (xpath = "//*[contains(text(),'通知收货')]") | |
23 | + WebElement NoticeReceipt;//通知收货 | |
24 | + | |
25 | + @FindBy (xpath = "//div[@class='col-sm-16']//input[@type='text']") | |
26 | + WebElement receiptDate;//选择收货日期 | |
27 | + | |
28 | + @FindBy (xpath = "//input[@name='newDate']") | |
29 | + WebElement loadingDate;//选择装柜日期 | |
30 | + | |
31 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | |
32 | + WebElement submit;//提交 | |
33 | + | |
34 | + @FindBy (xpath = "//div[@class='bootbox modal fade in']") | |
35 | + WebElement BlankPlace;//点击空白处 | |
36 | + | |
37 | + @FindBy (xpath = "//*[contains(text(),'通知装柜')]") | |
38 | + WebElement NotificationLoading;//通知装柜 | |
39 | + | |
40 | + //通知收货 | |
41 | + public POBoardPage toNoticeReceipt() { | |
42 | + click(NoticeReceipt); | |
43 | + jsExecutorRemoveAttribute(receiptDate,"readonly"); | |
44 | + String Receiptdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); | |
45 | + sendKeys(receiptDate,Receiptdate); | |
46 | + click(BlankPlace); | |
47 | + click(submit); | |
48 | + forceWait(4000); | |
49 | + | |
50 | + return new POBoardPage(driver); | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * 判断通知收货是否成功 | |
55 | + * @return boolean | |
56 | + */ | |
57 | + public boolean isNoticeReceipt (){ | |
58 | + forceWait(2000); | |
59 | + return isVisibility(By.xpath("//*[contains(text(),'收货中')]")); | |
60 | + } | |
61 | + | |
62 | + | |
63 | + //通知装柜 | |
64 | + public POBoardPage toNotificationLoading(){ | |
65 | + click(NotificationLoading); | |
66 | + jsExecutorRemoveAttribute(loadingDate,"readonly"); | |
67 | + String Loadingdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); | |
68 | + sendKeys(loadingDate,Loadingdate); | |
69 | + click(BlankPlace); | |
70 | + click(submit); | |
71 | + forceWait(4000); | |
72 | + | |
73 | + return new POBoardPage(driver); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * 判断通知装柜是否成功 | |
78 | + * @return boolean | |
79 | + */ | |
80 | + public boolean isNotificationLoading(){ | |
81 | + forceWait(2000); | |
82 | + return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); | |
83 | + } | |
84 | +} | |
0 | 85 | \ No newline at end of file | ... | ... |
src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java
0 → 100644
... | ... | @@ -0,0 +1,53 @@ |
1 | +package com.essa.pageObject.PODocumentary; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import org.openqa.selenium.WebDriver; | |
5 | +import org.openqa.selenium.WebElement; | |
6 | +import org.openqa.selenium.support.FindBy; | |
7 | + | |
8 | +import com.essa.framework.BasePage; | |
9 | + | |
10 | +/** | |
11 | + * @author Administrator | |
12 | + *PO跟单任务列表页面 | |
13 | + */ | |
14 | +public class PODocumentaryListPage extends BasePage { | |
15 | + | |
16 | + public PODocumentaryListPage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | + | |
20 | + /* | |
21 | + * 元素定位 | |
22 | + */ | |
23 | + @FindBy (xpath = "//*[text()='跟单管理']") | |
24 | + WebElement DocumentaryManage;//跟单管理 | |
25 | + | |
26 | + @FindBy (xpath ="//*[text()='PO跟单']") | |
27 | + WebElement PODocumentary;//PO跟单 | |
28 | + | |
29 | + @FindBy (xpath = "//*[@placeholder='请输入PO单号、客户编号等关键字查询']") | |
30 | + WebElement OrderNo;//输入PO单号 | |
31 | + | |
32 | + @FindBy (xpath = "//*[@ng-click='search()']") | |
33 | + WebElement searchPO;//搜索 | |
34 | + | |
35 | + @FindBy (xpath = "//*[contains(text(),'查看详情')]") | |
36 | + WebElement detail;//查看详情 | |
37 | + | |
38 | + /** | |
39 | + * 搜索PO单查看详情 | |
40 | + */ | |
41 | + | |
42 | + public PODocumentaryListPage toPoDocumentaryListPage(){ | |
43 | + click(DocumentaryManage); | |
44 | + click(PODocumentary); | |
45 | + sendKeys(OrderNo,Model.getPoNum()); | |
46 | + forceWait(2000); | |
47 | + click(searchPO); | |
48 | + forceWait(2000); | |
49 | + click(detail); | |
50 | + forceWait(7000); | |
51 | + return new PODocumentaryListPage(driver); | |
52 | + } | |
53 | +} | ... | ... |
src/main/java/com/essa/testSuite/TsetNoticeReceipt.java
0 → 100644
... | ... | @@ -0,0 +1,59 @@ |
1 | +package com.essa.testSuite; | |
2 | + | |
3 | +import com.essa.pageObject.BaseTest; | |
4 | +import com.essa.pageObject.PODocumentary.POBoardPage; | |
5 | +import com.essa.pageObject.PODocumentary.PODocumentaryListPage; | |
6 | +import org.openqa.selenium.WebDriver; | |
7 | +import org.openqa.selenium.support.PageFactory; | |
8 | +import org.testng.annotations.AfterClass; | |
9 | +import org.testng.annotations.BeforeClass; | |
10 | +import org.testng.annotations.Test; | |
11 | +import org.testng.asserts.SoftAssert; | |
12 | + | |
13 | +import java.io.IOException; | |
14 | + | |
15 | + | |
16 | +/** | |
17 | + * @author Administrator | |
18 | + *测试用例:通知收货 | |
19 | + */ | |
20 | +public class TsetNoticeReceipt extends BaseTest { | |
21 | + | |
22 | + WebDriver driver; | |
23 | + | |
24 | + @BeforeClass | |
25 | + public void setUp() throws IOException{ | |
26 | + initsetUp(); | |
27 | + loginValid("chenyijie"); | |
28 | + } | |
29 | + | |
30 | + @AfterClass | |
31 | + public void tearDown() { driver.quit(); } | |
32 | + | |
33 | + | |
34 | + /** | |
35 | + * 操作 | |
36 | + * | |
37 | + * @throws InterruptedException | |
38 | + */ | |
39 | + @Test(description="查找PO单") | |
40 | + public void TsetNoticeReceipt(){ | |
41 | + this.driver = getDriver(); | |
42 | + PODocumentaryListPage poDocumentaryListPage = PageFactory.initElements(driver,PODocumentaryListPage.class); | |
43 | + POBoardPage poBoardPage = PageFactory.initElements(driver,POBoardPage.class); | |
44 | + poDocumentaryListPage.toPoDocumentaryListPage(); | |
45 | + poBoardPage.toNoticeReceipt(); | |
46 | + //通知收货是否成功 | |
47 | + boolean actualReceipt = poBoardPage.isNoticeReceipt(); | |
48 | + SoftAssert ftAssert =new SoftAssert(); | |
49 | + ftAssert.assertEquals(actualReceipt,true,"通知收货失败"); | |
50 | + | |
51 | + | |
52 | + poBoardPage.toNotificationLoading(); | |
53 | + //通知装柜是否成功 | |
54 | + boolean actualLoading = poBoardPage.isNotificationLoading(); | |
55 | + SoftAssert softAssert =new SoftAssert(); | |
56 | + softAssert.assertEquals(actualLoading,true,"通知装柜失败"); | |
57 | + } | |
58 | + | |
59 | +} | ... | ... |