Commit 9e8e2bb11eafd2ab3d19f322227b9851ae0c4637
Merge remote-tracking branch 'origin/dev_test' into dev_test
Showing
8 changed files
with
106 additions
and
7 deletions
Show diff stats
src/main/java/com/essa/framework/BrowserEngine.java
... | ... | @@ -18,6 +18,7 @@ public class BrowserEngine { |
18 | 18 | private ConfigProperties configProperties; |
19 | 19 | |
20 | 20 | public void initConfigData() { |
21 | + //有些地方是没有设置初始化环境直接调用这个方法的,所以默认是sit | |
21 | 22 | env1 = null == env1 ? EnvEnum.SIT : env1; |
22 | 23 | configProperties = ConfigProperties.getConfig(env1); |
23 | 24 | browserEnum = BrowserEnum.fromCode(configProperties.getBrowserName()); |
... | ... | @@ -39,6 +40,7 @@ public class BrowserEngine { |
39 | 40 | */ |
40 | 41 | private WebDriver getBrowser(BrowserEnum browser,String url,int waitTime){ |
41 | 42 | System.setProperty(browser.getExeName(), SystemConstant.RESOURCE_PATH + browser.getDriver()); |
43 | + //根据浏览器类型,初始化对应的驱动 | |
42 | 44 | switch(browser) { |
43 | 45 | case Firefox:{ |
44 | 46 | driver = new FirefoxDriver(); | ... | ... |
src/main/java/com/essa/framework/BrowserEnum.java
src/main/java/com/essa/framework/ConfigProperties.java
... | ... | @@ -11,8 +11,11 @@ import java.util.Properties; |
11 | 11 | */ |
12 | 12 | public class ConfigProperties { |
13 | 13 | |
14 | + //浏览器名称 | |
14 | 15 | private String browserName; |
16 | + //bpms首页url | |
15 | 17 | private String serverURL; |
18 | + //buyer首页url | |
16 | 19 | private String buyerURL; |
17 | 20 | |
18 | 21 | // 数据库驱动名字 |
... | ... | @@ -31,6 +34,7 @@ public class ConfigProperties { |
31 | 34 | private static Map<String,ConfigProperties> configPropertiesMap = new HashMap<String,ConfigProperties>(); |
32 | 35 | |
33 | 36 | static { |
37 | + //读取各个环境的配置项 | |
34 | 38 | EnvEnum[] env = EnvEnum.values(); |
35 | 39 | for (EnvEnum envEnum : env) { |
36 | 40 | try { | ... | ... |
src/main/java/com/essa/framework/DButil.java
... | ... | @@ -23,6 +23,7 @@ public class DButil { |
23 | 23 | |
24 | 24 | Connection conn = null; |
25 | 25 | try { |
26 | + //通过环境找寻相应的配置,然后初始化数据库连接 | |
26 | 27 | EnvEnum envEnum = EnvEnum.fromCode(Model.getEnv()); |
27 | 28 | ConfigProperties dbConfig = ConfigProperties.getConfig(envEnum); |
28 | 29 | Class.forName(dbConfig.getJdbcName()); | ... | ... |
src/main/java/com/essa/framework/SuitesEnum.java
... | ... | @@ -8,6 +8,7 @@ import java.util.concurrent.ConcurrentHashMap; |
8 | 8 | import java.util.concurrent.atomic.AtomicReference; |
9 | 9 | |
10 | 10 | public enum SuitesEnum { |
11 | + //suite 第一个是唯一标志,第二个表示需要使用哪个xml(需要换的时候只要改这个即可),第三个描述这个干吗的 | |
11 | 12 | ADD_ORIGINAL_GOODS("ADD_ORIGIN_SKU","addOriginalGoods.xml","新增原厂商品"), |
12 | 13 | ADD_MARKET_GOODS("ADD_MARKET_GOODS","addMarketGoods.xml","新增市场商品"), |
13 | 14 | PUBLISH_GROUP_PURCHASE("PUBLISH_GROUP_PURCHASE","publishGroupPurchase.xml","发布团购"), | ... | ... |
src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java
... | ... | @@ -8,6 +8,8 @@ import com.essa.framework.BasePage; |
8 | 8 | import org.openqa.selenium.WebElement; |
9 | 9 | import org.openqa.selenium.support.FindBy; |
10 | 10 | |
11 | +import java.util.Date; | |
12 | + | |
11 | 13 | public class POBoardPage extends BasePage { |
12 | 14 | |
13 | 15 | public POBoardPage(WebDriver driver) { |
... | ... | @@ -31,11 +33,34 @@ public class POBoardPage extends BasePage { |
31 | 33 | @FindBy (xpath ="//button[contains(text(),'转在途尾货')]") |
32 | 34 | WebElement toTail;//转在途尾货按钮 |
33 | 35 | |
36 | + // 通知收货 | |
34 | 37 | @FindBy (xpath = "//button[contains(text(),'通知收货')]") |
35 | - WebElement noticeReceive;//通知收货按钮 | |
38 | + WebElement noticeReceive; | |
39 | + | |
40 | + //收货日期 | |
41 | + @FindBy (xpath = "//*[contains(text(),'收货日期')]") ///label[@class='control-label col-sm-8'] | |
42 | + WebElement reveiveDate; | |
43 | + | |
44 | + // 收货日期输入框 | |
45 | + @FindBy (xpath = " //div[@class='col-sm-16']//input[@type='text']") | |
46 | + WebElement inputReceiveDate; | |
47 | + | |
48 | + // 确定 | |
49 | + @FindBy (xpath = "//button[contains(text(),'确定')]") | |
50 | + WebElement submit; | |
51 | + | |
52 | + // 通知装柜 | |
53 | + @FindBy(xpath = "//button[contains(text(),'通知装柜')]") | |
54 | + WebElement noticeLoad; | |
55 | + | |
56 | + // 装柜日期空白处 | |
57 | + @FindBy(xpath = " //label[@class='control-label col-md-8']") | |
58 | + WebElement loadDate; | |
59 | + | |
60 | + // 装柜日期输入框 | |
61 | + @FindBy (xpath = "//input[@name='newDate']") | |
62 | + WebElement inutLoadDate; | |
36 | 63 | |
37 | - @FindBy(xpath ="//button[contains(text(),'通知装柜')]") | |
38 | - WebElement noticeLoad;//通知装柜按钮 | |
39 | 64 | |
40 | 65 | /* |
41 | 66 | * 页面方法 |
... | ... | @@ -55,4 +80,32 @@ public class POBoardPage extends BasePage { |
55 | 80 | click(toTail); |
56 | 81 | return new ConvertTailPage(driver); |
57 | 82 | } |
83 | + | |
84 | + /** | |
85 | + * PO通知收货和通知装柜 | |
86 | + */ | |
87 | + // 通知收货 | |
88 | + public POBoardPage noticeReceive(){ | |
89 | + click(noticeReceive); | |
90 | + jsExecutorRemoveAttribute(inputReceiveDate,"readonly"); | |
91 | + String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy"); | |
92 | + sendKeys(inputReceiveDate,date); | |
93 | + click(reveiveDate); | |
94 | + click(submit); | |
95 | + forceWait(3000); | |
96 | + return new POBoardPage(driver); | |
97 | + } | |
98 | + | |
99 | + //通知装柜 | |
100 | + public POBoardPage noticeLoad(){ | |
101 | + click(noticeLoad); | |
102 | + jsExecutorRemoveAttribute(inutLoadDate,"readonly"); | |
103 | + String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy"); | |
104 | + sendKeys(inutLoadDate,date); | |
105 | + click(loadDate); | |
106 | + forceWait(3000); | |
107 | + click(submit); | |
108 | + forceWait(2000); | |
109 | + return new POBoardPage(driver); | |
110 | + } | |
58 | 111 | } | ... | ... |
src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java
... | ... | @@ -33,6 +33,18 @@ public class PODocumentaryListPage extends BasePage { |
33 | 33 | @FindBy (xpath = "//*[@id='listView']/div/table/tbody/tr[1]/td/div/div[1]/div/ul/li[1]/a") |
34 | 34 | WebElement detail;//搜索结果中的一个查看详情 |
35 | 35 | |
36 | + // 关键字查询 | |
37 | + @FindBy (xpath = "//*[contains(@placeholder,'请输入PO单号、客户编号等关键字查询')]") | |
38 | + WebElement keySearch; | |
39 | + | |
40 | + // 放大镜查询按钮 | |
41 | + @FindBy (xpath = "//*[contains(@ng-click,'search()')]") | |
42 | + WebElement magnifierSearch; | |
43 | + | |
44 | + // 查看详情 | |
45 | + @FindBy (xpath = "//*[contains(text(),'查看详情')]") | |
46 | + WebElement followDetail; | |
47 | + | |
36 | 48 | /* |
37 | 49 | * 页面方法 |
38 | 50 | */ |
... | ... | @@ -45,4 +57,19 @@ public class PODocumentaryListPage extends BasePage { |
45 | 57 | click(detail); |
46 | 58 | return new POBoardPage(driver); |
47 | 59 | } |
60 | + | |
61 | + /** | |
62 | + * 进入PO跟单详情 | |
63 | + * @return | |
64 | + */ | |
65 | + public PODocumentaryListPage toPoFollowDetail(){ | |
66 | + sendKeys(keySearch, Model.getPoNum()); | |
67 | + click(magnifierSearch); | |
68 | + forceWait(5000); | |
69 | + dynamicWait(By.xpath("//div[@class='row xxrow-header-bg row-border-bottom no-margin padding-horizontal-5']")); | |
70 | + click(followDetail); | |
71 | + forceWait(5000); | |
72 | + dynamicWait(By.xpath("//div[@class='panel-body']")); | |
73 | + return new PODocumentaryListPage(driver); | |
74 | + } | |
48 | 75 | } | ... | ... |
src/main/java/com/essa/testSuite/TestNoticeReceiveAndLoad.java
1 | 1 | package com.essa.testSuite; |
2 | 2 | |
3 | 3 | import com.essa.pageObject.BaseTest; |
4 | +import com.essa.pageObject.HomePage; | |
5 | +import com.essa.pageObject.PODocumentary.POBoardPage; | |
6 | +import com.essa.pageObject.PODocumentary.PODocumentaryListPage; | |
4 | 7 | import org.openqa.selenium.WebDriver; |
8 | +import org.openqa.selenium.support.PageFactory; | |
5 | 9 | import org.testng.annotations.AfterClass; |
6 | 10 | import org.testng.annotations.BeforeClass; |
7 | 11 | import org.testng.annotations.Test; |
... | ... | @@ -22,11 +26,18 @@ public class TestNoticeReceiveAndLoad extends BaseTest{ |
22 | 26 | } |
23 | 27 | |
24 | 28 | /** |
25 | - * 通知收货和通知装柜 | |
29 | + * 通知收货、装柜 | |
26 | 30 | */ |
27 | - @Test(description = "通知收货和通知装柜") | |
31 | + @Test(description = "通知收货、装柜") | |
28 | 32 | public void NoticeReceiveAndLoad(){ |
29 | 33 | this.driver = getDriver(); |
30 | - | |
34 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | |
35 | + homePage.toPoDocumentaryListPage(); | |
36 | + PODocumentaryListPage poDocumentaryListPage = PageFactory.initElements(driver,PODocumentaryListPage.class); | |
37 | + POBoardPage poBoardPage = PageFactory.initElements(driver,POBoardPage.class); | |
38 | + poDocumentaryListPage.toPoFollowDetail(); | |
39 | + poBoardPage.noticeReceive(); | |
40 | + poBoardPage.noticeLoad(); | |
31 | 41 | } |
42 | + | |
32 | 43 | } | ... | ... |