Commit 27d9a429f0f44da155aba3d64e49592cef910ee6
1 parent
84b19956
开发梳理;
Showing
88 changed files
with
8592 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,136 @@ | @@ -0,0 +1,136 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + | ||
7 | + <groupId>com.essatest</groupId> | ||
8 | + <artifactId>essa</artifactId> | ||
9 | + <version>1.0-SNAPSHOT</version> | ||
10 | + <packaging>jar</packaging> | ||
11 | + | ||
12 | + <name>essa</name> | ||
13 | + <url>http://maven.apache.org</url> | ||
14 | + | ||
15 | + <properties> | ||
16 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
17 | + </properties> | ||
18 | + | ||
19 | + <dependencies> | ||
20 | + | ||
21 | + <dependency> | ||
22 | + <groupId>org.testng</groupId> | ||
23 | + <artifactId>testng</artifactId> | ||
24 | + <version>6.14.3</version> | ||
25 | + <!-- <scope>test</scope> --> | ||
26 | + </dependency> | ||
27 | + | ||
28 | + <dependency> | ||
29 | + <groupId>org.seleniumhq.selenium</groupId> | ||
30 | + <artifactId>selenium-java</artifactId> | ||
31 | + <version>3.11.0</version> | ||
32 | + </dependency> | ||
33 | + | ||
34 | + | ||
35 | + <dependency> | ||
36 | + <groupId>org.seleniumhq.selenium</groupId> | ||
37 | + <artifactId>selenium-firefox-driver</artifactId> | ||
38 | + <version>3.11.0</version> | ||
39 | + </dependency> | ||
40 | + | ||
41 | + <dependency> | ||
42 | + <groupId>org.seleniumhq.selenium</groupId> | ||
43 | + <artifactId>selenium-chrome-driver</artifactId> | ||
44 | + <version>3.11.0</version> | ||
45 | + </dependency> | ||
46 | + | ||
47 | + <dependency> | ||
48 | + <groupId>org.seleniumhq.selenium</groupId> | ||
49 | + <artifactId>selenium-safari-driver</artifactId> | ||
50 | + <version>3.11.0</version> | ||
51 | + </dependency> | ||
52 | + | ||
53 | + <dependency> | ||
54 | + <groupId>org.seleniumhq.selenium</groupId> | ||
55 | + <artifactId>selenium-ie-driver</artifactId> | ||
56 | + <version>3.11.0</version> | ||
57 | + </dependency> | ||
58 | + | ||
59 | + | ||
60 | + <dependency> | ||
61 | + <groupId>org.seleniumhq.selenium</groupId> | ||
62 | + <artifactId>selenium-support</artifactId> | ||
63 | + <version>2.46.0</version> | ||
64 | + </dependency> | ||
65 | + | ||
66 | + <dependency> | ||
67 | + <groupId>javax.mail</groupId> | ||
68 | + <artifactId>mail</artifactId> | ||
69 | + <version>1.4</version> | ||
70 | + </dependency> | ||
71 | + | ||
72 | + <dependency> | ||
73 | + <groupId>org.apache.commons</groupId> | ||
74 | + <artifactId>commons-collections4</artifactId> | ||
75 | + <version>4.1</version> | ||
76 | + </dependency> | ||
77 | + | ||
78 | + <dependency> | ||
79 | + <groupId>org.apache.poi</groupId> | ||
80 | + <artifactId>poi</artifactId> | ||
81 | + <version>3.14</version> | ||
82 | + </dependency> | ||
83 | + | ||
84 | + <dependency> | ||
85 | + <groupId>org.apache.poi</groupId> | ||
86 | + <artifactId>poi-ooxml</artifactId> | ||
87 | + <version>3.14</version> | ||
88 | + </dependency> | ||
89 | + | ||
90 | + <dependency> | ||
91 | + <groupId>org.apache.poi</groupId> | ||
92 | + <artifactId>poi-ooxml-schemas</artifactId> | ||
93 | + <version>3.14</version> | ||
94 | + </dependency> | ||
95 | + | ||
96 | + <dependency> | ||
97 | + <groupId>org.apache.commons</groupId> | ||
98 | + <artifactId>commons-io</artifactId> | ||
99 | + <version>1.3.2</version> | ||
100 | + </dependency> | ||
101 | + | ||
102 | + <dependency> | ||
103 | + <groupId>mysql</groupId> | ||
104 | + <artifactId>mysql-connector-java</artifactId> | ||
105 | + <version>6.0.6</version> | ||
106 | + </dependency> | ||
107 | + <dependency> | ||
108 | + <groupId>org.dbunit</groupId> | ||
109 | + <artifactId>dbunit</artifactId> | ||
110 | + <version>2.5.4</version> | ||
111 | + </dependency> | ||
112 | + <dependency> | ||
113 | + <groupId>jdom</groupId> | ||
114 | + <artifactId>jdom</artifactId> | ||
115 | + <version>1.0</version> | ||
116 | + </dependency> | ||
117 | + </dependencies> | ||
118 | + | ||
119 | + <build> | ||
120 | + <plugins> | ||
121 | + <plugin> | ||
122 | + <groupId>org.apache.maven.plugins</groupId> | ||
123 | + <artifactId>maven-surefire-plugin</artifactId> | ||
124 | + <version>2.7.1</version> | ||
125 | + <configuration> | ||
126 | + <!--<testFailureIgnore>true</testFailureIgnore> --> | ||
127 | + <suiteXmlFiles> | ||
128 | + <suiteXmlFile>resources/suites/testng.xml</suiteXmlFile> | ||
129 | + <!--此处testng.xml即为要运行的testng.xml文件 --> | ||
130 | + </suiteXmlFiles> | ||
131 | + </configuration> | ||
132 | + </plugin> | ||
133 | + </plugins> | ||
134 | + </build> | ||
135 | + | ||
136 | +</project> | ||
0 | \ No newline at end of file | 137 | \ No newline at end of file |
src/main/java/com/buyer/pageObject/AssetManagementPage.java
0 → 100644
src/main/java/com/buyer/pageObject/BuyerLoginPage.java
0 → 100644
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * 采购商登录页 | ||
11 | + * @author Administrator | ||
12 | + * | ||
13 | + */ | ||
14 | +public class BuyerLoginPage extends BasePage { | ||
15 | + public BuyerLoginPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + /* | ||
19 | + * 页面元素定位 | ||
20 | + */ | ||
21 | + //用户名:邮箱 | ||
22 | + @FindBy (xpath = "//*[@id='username']") | ||
23 | + WebElement userName; | ||
24 | + | ||
25 | + //密码 | ||
26 | + @FindBy (xpath = "//*[@id='password']") | ||
27 | + WebElement passWord; | ||
28 | + | ||
29 | + //登录按钮 | ||
30 | + @FindBy (xpath = "//*[@id='login']") | ||
31 | + WebElement signIn; | ||
32 | + | ||
33 | + /* | ||
34 | + * 页面方法 | ||
35 | + */ | ||
36 | + /** | ||
37 | + * 采购商登录方法 | ||
38 | + * @param account 账号 | ||
39 | + * @param password 密码 | ||
40 | + * @return IndexPage | ||
41 | + */ | ||
42 | + public IndexPage login(String account,String password) { | ||
43 | + sendKeys(userName, account); | ||
44 | + sendKeys(passWord, password); | ||
45 | + click(signIn); | ||
46 | + return new IndexPage(driver); | ||
47 | + } | ||
48 | +} |
src/main/java/com/buyer/pageObject/ConslidationPage.java
0 → 100644
@@ -0,0 +1,97 @@ | @@ -0,0 +1,97 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * 暂存柜,拼柜页面 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class ConslidationPage extends BasePage { | ||
17 | + public ConslidationPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + //关闭提示 | ||
24 | + @FindBy(xpath="//*[@class='close']") | ||
25 | + WebElement close; | ||
26 | + | ||
27 | + //选择散货 | ||
28 | + @FindBy (xpath ="//button[text()='Bulk cargo']") | ||
29 | + WebElement bulkCargo; | ||
30 | + | ||
31 | + //确认 | ||
32 | + @FindBy (xpath="//button[text()='OK']") | ||
33 | + WebElement ok; | ||
34 | + | ||
35 | + //查询输入框 | ||
36 | + @FindBy (xpath="//*[@id='left-search']/div/input") | ||
37 | + WebElement searchText; | ||
38 | + | ||
39 | + //查询按钮 | ||
40 | + @FindBy (xpath="//*[@id='left-search']/div/span") | ||
41 | + WebElement search; | ||
42 | + | ||
43 | + //左边列表第一个复选框 | ||
44 | + @FindBy (xpath="//*[@id='left-product-list']/div[1]/div/div[2]/div/ul/li[1]/input") | ||
45 | + WebElement leftFirstCheckbox; | ||
46 | + | ||
47 | + //中间加入右边的箭头 | ||
48 | + @FindBy (xpath="//*[@id='icon-pi-right-big']") | ||
49 | + WebElement add; | ||
50 | + | ||
51 | + //右边的第一个复选框 | ||
52 | + @FindBy (xpath="//*[@id='right-product-list']/div/div/div[2]/div/ul/li[1]/input") | ||
53 | + WebElement rightFirstCheckbox; | ||
54 | + | ||
55 | + //下一步,设置贴纸 | ||
56 | + @FindBy (xpath="//*[@id='next']") | ||
57 | + WebElement next; | ||
58 | + | ||
59 | + //确认弹框-可能会提示价格不一致 | ||
60 | + @FindBy (xpath ="//a[text()='OK']") | ||
61 | + WebElement ok2; | ||
62 | + | ||
63 | + /** | ||
64 | + * 开始拼柜 | ||
65 | + * @return SettingMarkerPage | ||
66 | + */ | ||
67 | + public SettingMarksPage conslidation() { | ||
68 | + //是否有操作提示弹框 | ||
69 | + if(isVisibility(By.xpath("//*[@class='close']"))) { | ||
70 | + click(close); | ||
71 | + } | ||
72 | + forceWait(1000); | ||
73 | + //是否有选择货柜 | ||
74 | + if(isVisibility(By.xpath("//button[text()='Bulk cargo']"))) { | ||
75 | + click(bulkCargo); | ||
76 | + click(ok); | ||
77 | + forceWait(1000); | ||
78 | + } | ||
79 | + sendKeys(searchText, Model.getSkuNo()); | ||
80 | + click(search); | ||
81 | + click(leftFirstCheckbox); | ||
82 | + click(add); | ||
83 | + //是否有加入到暂存柜 | ||
84 | + dynamicWait(By.xpath("//*[@id='right-product-list']/div/div/div[2]/div/ul/li[1]/input")); | ||
85 | + forceWait(2000); | ||
86 | + moveHeightScroll("100"); | ||
87 | + forceWait(1000); | ||
88 | + click(next); | ||
89 | + //如果提示价格变化,确认弹框 | ||
90 | + if(isVisibility(By.xpath("//a[text()='OK']"))) { | ||
91 | + click(ok2); | ||
92 | + forceWait(1000); | ||
93 | + click(next); | ||
94 | + } | ||
95 | + return new SettingMarksPage(driver); | ||
96 | + } | ||
97 | +} |
@@ -0,0 +1,131 @@ | @@ -0,0 +1,131 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * 采购商首页 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class IndexPage extends BasePage { | ||
17 | + public IndexPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + //登录-sign in | ||
24 | + @FindBy (xpath ="//*[@id='SignIn']/a") | ||
25 | + WebElement signIn; | ||
26 | + | ||
27 | + //注册-register | ||
28 | + @FindBy (xpath ="//*[@class='u-login']/a") | ||
29 | + WebElement register; | ||
30 | + | ||
31 | + //关键字输入框 | ||
32 | + @FindBy (xpath ="//*[@class='search-tx']/input") | ||
33 | + WebElement searchText; | ||
34 | + | ||
35 | + //查询按钮 | ||
36 | + @FindBy (xpath ="//*[@class='btn btn-primary search-btn']") | ||
37 | + WebElement searchButton; | ||
38 | + | ||
39 | + //绑定手机弹窗-关闭按钮 | ||
40 | + @FindBy (xpath ="//*[contains(@class,'layui-layer-close1')]") | ||
41 | + WebElement closed; | ||
42 | + | ||
43 | + //右上角购物车 | ||
44 | + @FindBy (xpath ="//*[@id='miniCart']") | ||
45 | + WebElement minicart; | ||
46 | + | ||
47 | + /* | ||
48 | + * 页面方法 | ||
49 | + */ | ||
50 | + /** | ||
51 | + * 进入登录页面 | ||
52 | + * @return BuyerLoginPage | ||
53 | + */ | ||
54 | + public BuyerLoginPage toLoginPage() { | ||
55 | + click(signIn); | ||
56 | + return new BuyerLoginPage(driver); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * 进入注册页面 | ||
61 | + * @return RegisterPage | ||
62 | + */ | ||
63 | + public RegisterPage toRegisterPage() { | ||
64 | + click(register); | ||
65 | + return new RegisterPage(driver); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * 进入购物车 | ||
70 | + * @return ShoppingCartPage | ||
71 | + */ | ||
72 | + public ShoppingCartPage toShoppingCartPage() { | ||
73 | + if (isVisibility(By.xpath("//*[@id='bind-phone']"))) { | ||
74 | + forceWait(1000); | ||
75 | + click(closed); | ||
76 | + } | ||
77 | + click(minicart); | ||
78 | + return new ShoppingCartPage(driver); | ||
79 | + } | ||
80 | + /** | ||
81 | + * 关键字搜索商品 | ||
82 | + * @return KeywordResultPage | ||
83 | + */ | ||
84 | + public KeywordResultPage keywordSearch() { | ||
85 | + //判断是否绑定手机 | ||
86 | + if (isVisibility(By.xpath("//*[@id='bind-phone']"))) { | ||
87 | + click(closed); | ||
88 | + } | ||
89 | + //如果是非活动 | ||
90 | +// if (Model.getIsactivity()==0 &&(Model.getSkuNo().equals("选填,勿填活动商品")||Model.getSkuNo().equals(""))) { | ||
91 | + if (Model.getIsactivity()==0 &&(("选填,勿填活动商品").equals(Model.getSkuNo())||("").equals(Model.getSkuNo()))) { | ||
92 | + //判断是否自定义输入商品编号 | ||
93 | + String sql = "SELECT s.id,s.`no` from prd_category c\r\n" + | ||
94 | + "LEFT JOIN prd_goods g on c.id = g.category_id\r\n" + | ||
95 | + "LEFT JOIN prd_goods_sku s on s.goods_id = g.id\r\n" + | ||
96 | + "where find_in_set(5,REPLACE(c.path,'.',','))\r\n" + | ||
97 | + "AND s.`no` > 200000000\r\n" + | ||
98 | + "AND s.id NOT IN (SELECT g.sku_id FROM sale_group_buy g)\r\n" + | ||
99 | + "AND s.id NOT IN (SELECT t.sku_id FROM sale_shopping_cart t)\r\n" + | ||
100 | + "AND s.src = 1\r\n" + | ||
101 | + "AND s.`status` = 2\r\n" + | ||
102 | + "AND s.is_stop_product = 0\r\n" + | ||
103 | + "AND s.is_delete = 0\r\n" + | ||
104 | + "limit 1"; | ||
105 | + Model.setSkuNo(DBSqlSearch(sql, "no")); | ||
106 | + }else if (Model.getIsactivity()==1 &&(("选填,勿填非活动商品").equals(Model.getSkuNo())||("").equals(Model.getSkuNo()))) { | ||
107 | + //活动商品 | ||
108 | + String sql = "SELECT s.id,s.`no` from prd_category c\r\n" + | ||
109 | + "LEFT JOIN prd_goods g on c.id = g.category_id\r\n" + | ||
110 | + "LEFT JOIN prd_goods_sku s on s.goods_id = g.id\r\n" + | ||
111 | + "LEFT JOIN sale_group_buy a on a.sku_id = s.id\r\n" + | ||
112 | + "where s.`no` > 200000000\r\n" + | ||
113 | + "AND s.id NOT IN (SELECT t.sku_id FROM sale_shopping_cart t)\r\n" + | ||
114 | + "AND a.`status` = 20 and s.src = 1 \r\n" + | ||
115 | + "limit 1;"; | ||
116 | + Model.setSkuNo(DBSqlSearch(sql, "no")); | ||
117 | + } | ||
118 | +// System.out.println(Model.getSkuNo()); | ||
119 | + sendKeys(searchText, Model.getSkuNo()); | ||
120 | + click(searchButton); | ||
121 | + return new KeywordResultPage(driver); | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * 断言是否注册成功,根据是否有绑定手机号的弹窗来判断 | ||
126 | + * @return boolean | ||
127 | + */ | ||
128 | + public boolean isSucceed() { | ||
129 | + return isVisibility(By.xpath("//*[contains(@class,'layui-layer-close1')]")); | ||
130 | + } | ||
131 | +} |
src/main/java/com/buyer/pageObject/KeywordResultPage.java
0 → 100644
@@ -0,0 +1,116 @@ | @@ -0,0 +1,116 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * 关键字查询结果页 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class KeywordResultPage extends BasePage { | ||
17 | + public KeywordResultPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + //加入购物车 | ||
24 | + @FindBy (xpath ="//*[@id='product-list']/ul[1]/div[1]/li[1]/div[1]/div[1]/div[4]/div[2]") | ||
25 | + WebElement addToCart; | ||
26 | + | ||
27 | + //确认添加 | ||
28 | + @FindBy (xpath ="//*[@id='product-list']/ul[1]/div[1]/li[1]/div[2]/div[3]/div[1]") | ||
29 | + WebElement confirmAdd; | ||
30 | + | ||
31 | + //添加购物车时,提示加入一款成功toast | ||
32 | + @FindBy (xpath ="//*[@class='util-bill-pd']") | ||
33 | + WebElement toast; | ||
34 | + | ||
35 | + //右上角购物车 | ||
36 | + @FindBy (xpath ="//*[@id='miniCart']") | ||
37 | + WebElement minicart; | ||
38 | + | ||
39 | + //订购量 | ||
40 | + @FindBy (xpath="//*[contains(text(),'quantity')]/../span[2]/input") | ||
41 | + WebElement count; | ||
42 | + | ||
43 | + //活动商品-添加购物车 | ||
44 | + @FindBy (xpath ="//*[@class='btn-box']/div[2]") | ||
45 | + WebElement addToCart1; | ||
46 | + | ||
47 | + //查询输入框 | ||
48 | + @FindBy (xpath ="//*[@class='search-tx']/input") | ||
49 | + WebElement searchText; | ||
50 | + | ||
51 | + /* | ||
52 | + * 页面方法 | ||
53 | + */ | ||
54 | + /** | ||
55 | + * 加入到购物车中,且会进入购物车校验是否加入成功 | ||
56 | + * @return ShoppingCartPage | ||
57 | + */ | ||
58 | + public ShoppingCartPage addToCart() { | ||
59 | + if (Model.getIsactivity() == 0) {//该sku为非活动商品 | ||
60 | + click(addToCart); | ||
61 | + forceWait(1000); | ||
62 | + click(count); | ||
63 | + sendKeys(count, "50"); | ||
64 | + }else if (Model.getIsactivity() == 1) {//该sku为活动商品 | ||
65 | + click(addToCart1); | ||
66 | + forceWait(1000); | ||
67 | + click(count); | ||
68 | + sendKeys(count, "200"); | ||
69 | + } | ||
70 | + | ||
71 | + click(confirmAdd); | ||
72 | + dynamicWait(By.xpath("//*[@class='util-bill-pd']")); | ||
73 | + forceWait(1000); | ||
74 | + click(minicart); | ||
75 | + if (Model.getIsactivity() == 1) { | ||
76 | + getManager();//找出对应的类目经理 | ||
77 | + } | ||
78 | + return new ShoppingCartPage(driver); | ||
79 | + } | ||
80 | + /** | ||
81 | + * 由于操作过快,系统会提示:有人正在操作 | ||
82 | + * sku加入到购物车,但不进入购物车,防止无法操作后续的拼柜 | ||
83 | + * 此方法与addToCart()一样,只是不进入购物车 | ||
84 | + */ | ||
85 | + public void addSku() { | ||
86 | + if (Model.getIsactivity() == 0) { | ||
87 | + click(addToCart); | ||
88 | + forceWait(1000); | ||
89 | + click(count); | ||
90 | + sendKeys(count, "50"); | ||
91 | + }else if (Model.getIsactivity() == 1) { | ||
92 | + click(addToCart1); | ||
93 | + forceWait(1000); | ||
94 | + click(count); | ||
95 | + sendKeys(count, "200"); | ||
96 | + } | ||
97 | + click(confirmAdd); | ||
98 | + dynamicWait(By.xpath("//*[@class='util-bill-pd']")); | ||
99 | + if (Model.getIsactivity() == 1) { | ||
100 | + sendKeys(searchText, "查询数据库ing……程序还在进行,无聊可以先去撩撩妹子呀!"); | ||
101 | + getManager();//找出对应的类目经理 | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 根据sql查出商品对应类目经理,并在model类中设置其值 | ||
107 | + */ | ||
108 | + public void getManager() { | ||
109 | + //查找商品对应的类目经理sql | ||
110 | + String sql = "SELECT u.account_name from prd_goods g \r\n" + | ||
111 | + "LEFT JOIN prd_goods_sku s on g.id = s.goods_id\r\n" + | ||
112 | + "LEFT JOIN pri_user u on u.id = g.category_manager_id\r\n" + | ||
113 | + "where s.`no` in ("+Model.getSkuNo()+");"; | ||
114 | + Model.setManager(DBSqlSearch(sql, "account_name")); | ||
115 | + } | ||
116 | +} |
src/main/java/com/buyer/pageObject/MyOrderPage.java
0 → 100644
src/main/java/com/buyer/pageObject/OrderPreviewPage.java
0 → 100644
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + *订单预览页 | ||
13 | + */ | ||
14 | +public class OrderPreviewPage extends BasePage { | ||
15 | + public OrderPreviewPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + //是否授权:同意 | ||
20 | + @FindBy (xpath ="//*[@ng-checked='list.isAuthorExchange==1']") | ||
21 | + WebElement agree; | ||
22 | + | ||
23 | + //提交po | ||
24 | + @FindBy (xpath ="//*[@id='react-orderConfirmation-submit']") | ||
25 | + WebElement sendPO; | ||
26 | + | ||
27 | + //弹框:确认 | ||
28 | + @FindBy (xpath ="//a[text()='Send PO']") | ||
29 | + WebElement confirm; | ||
30 | + | ||
31 | + /** | ||
32 | + * 提交po | ||
33 | + * @return PayDepositPage | ||
34 | + */ | ||
35 | + public PayDepositPage submit() { | ||
36 | +// while(!(isVisibility(By.xpath("//*[@ng-checked='list.isAuthorExchange==1']")))) { | ||
37 | +// forceWait(1000); | ||
38 | +// } | ||
39 | + dynamicWait(By.xpath("//*[@ng-checked='list.isAuthorExchange==1']")); | ||
40 | + moveHeightScroll("50"); | ||
41 | + forceWait(500); | ||
42 | + jsExecutorClick(agree); | ||
43 | + click(sendPO); | ||
44 | + forceWait(1000); | ||
45 | + click(confirm); | ||
46 | + return new PayDepositPage(driver); | ||
47 | + } | ||
48 | +} |
src/main/java/com/buyer/pageObject/PayDepositPage.java
0 → 100644
@@ -0,0 +1,69 @@ | @@ -0,0 +1,69 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *支付定金页 | ||
14 | + */ | ||
15 | +public class PayDepositPage extends BasePage { | ||
16 | + public PayDepositPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + | ||
20 | + //PO信息 | ||
21 | + @FindBy (xpath="//*[contains(text(),'PO information')]") | ||
22 | + WebElement POInfo; | ||
23 | + | ||
24 | + //查看资金详情---可用资金不足 | ||
25 | + @FindBy (xpath ="//button[@class='submit-payment-deposit-button btn btn-primary']") | ||
26 | + WebElement FundDetail; | ||
27 | + | ||
28 | + //免定金模式--确认按钮 | ||
29 | + @FindBy (xpath ="//*[@ng-click='submit()']") | ||
30 | + WebElement ok; | ||
31 | + | ||
32 | + //po单号 | ||
33 | + @FindBy (xpath ="//*[contains(text(),'PO number:')]/../../td[2]/span") | ||
34 | + WebElement poNum; | ||
35 | + | ||
36 | + /** | ||
37 | + * 查看资金详情 | ||
38 | + * @return AssetManagementPage | ||
39 | + */ | ||
40 | + public AssetManagementPage toAssetManagementPage() { | ||
41 | + click(FundDetail); | ||
42 | + return new AssetManagementPage(driver); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 确认PO | ||
47 | + * @return MyOrderPage | ||
48 | + */ | ||
49 | + public MyOrderPage confirm() { | ||
50 | + click(ok); | ||
51 | + return new MyOrderPage(driver); | ||
52 | + } | ||
53 | + | ||
54 | + public void operate() { | ||
55 | + /*while (!(isVisibility(By.xpath("//*[contains(text(),'PO information')]")))) { | ||
56 | + forceWait(1000); | ||
57 | + }*/ | ||
58 | + dynamicWait(By.xpath("//*[contains(text(),'PO information')]")); | ||
59 | + Model.setPoNum(poNum.getText()); | ||
60 | + if (isVisibility(By.xpath("//button[@class='submit-payment-deposit-button btn btn-primary']"))) { | ||
61 | + //如果是可用资金不足,跳转到资金管理 | ||
62 | + toAssetManagementPage(); | ||
63 | + }else if (isVisibility(By.xpath("//*[@ng-click='submit()']"))) { | ||
64 | + //免定金模式,确认po,跳转到我的订单列表 | ||
65 | + confirm(); | ||
66 | + } | ||
67 | + forceWait(2000); | ||
68 | + } | ||
69 | +} |
src/main/java/com/buyer/pageObject/RegisterPage.java
0 → 100644
@@ -0,0 +1,165 @@ | @@ -0,0 +1,165 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +import org.openqa.selenium.WebDriver; | ||
7 | +import org.openqa.selenium.WebElement; | ||
8 | +import org.openqa.selenium.support.FindBy; | ||
9 | + | ||
10 | +import com.essa.framework.BasePage; | ||
11 | +import com.essa.framework.Model; | ||
12 | +import com.essa.framework.Tools; | ||
13 | + | ||
14 | +/** | ||
15 | + * 采购商注册页 | ||
16 | + * @author Administrator | ||
17 | + * | ||
18 | + */ | ||
19 | +public class RegisterPage extends BasePage { | ||
20 | + public RegisterPage(WebDriver driver) { | ||
21 | + super(driver); | ||
22 | + } | ||
23 | + /* | ||
24 | + * 元素定位 | ||
25 | + */ | ||
26 | + //检查点-是否进入页面 | ||
27 | + @FindBy (xpath ="//*[contains(text(),' Own essa.cn account')]") | ||
28 | + WebElement checkPoint; | ||
29 | + | ||
30 | |||
31 | + @FindBy (xpath ="//*[@id='email']") | ||
32 | + WebElement email; | ||
33 | + | ||
34 | + //password | ||
35 | + @FindBy (xpath ="//*[@id='password']") | ||
36 | + WebElement password; | ||
37 | + | ||
38 | + //confirmPassword | ||
39 | + @FindBy (xpath ="//*[@id='confirmPassword']") | ||
40 | + WebElement confirmPassword; | ||
41 | + | ||
42 | + //币种 currency | ||
43 | + @FindBy (xpath ="//*[@id='currPlaceholder']") | ||
44 | + WebElement currPlaceholder; | ||
45 | + | ||
46 | + //CNY | ||
47 | + @FindBy (xpath="//*[text()='CNY']") | ||
48 | + WebElement CNY; | ||
49 | + | ||
50 | + //companyName | ||
51 | + @FindBy (xpath="//*[@id='companyName']") | ||
52 | + WebElement companyName; | ||
53 | + | ||
54 | + //空白的地方-用于关闭选项框 | ||
55 | + @FindBy (xpath ="//*[@class='register-right']") | ||
56 | + WebElement blank; | ||
57 | + | ||
58 | + //区域continent | ||
59 | + @FindBy (xpath ="//*[@id='continentPlaceholder']") | ||
60 | + WebElement continentPlaceholder; | ||
61 | + | ||
62 | + //欧洲europe | ||
63 | + @FindBy (xpath="//*[text()='Europe']") | ||
64 | + WebElement Europe; | ||
65 | + | ||
66 | + //country | ||
67 | + @FindBy (xpath ="//*[@id='countryPlaceholder']") | ||
68 | + WebElement country; | ||
69 | + | ||
70 | + //俄罗斯Russian | ||
71 | + @FindBy (xpath ="//*[text()='Russian federation']") | ||
72 | + WebElement Russian; | ||
73 | + | ||
74 | + //contactName | ||
75 | + @FindBy (xpath ="//*[@id='contactName']") | ||
76 | + WebElement contactName; | ||
77 | + | ||
78 | + //phone | ||
79 | + @FindBy (xpath ="//*[@id='phone']") | ||
80 | + WebElement phone; | ||
81 | + | ||
82 | + //purchaseQuantity | ||
83 | + @FindBy (xpath ="//*[@id='purchaseQuantity']") | ||
84 | + WebElement purchaseQuantity; | ||
85 | + | ||
86 | + //quantity | ||
87 | + @FindBy (xpath ="//*[contains(text(),'1 000 000 - 2 500 000 USD')]") | ||
88 | + WebElement quantity; | ||
89 | + | ||
90 | + //singleQuantity | ||
91 | + @FindBy (xpath ="//*[@id='singleQuantity']") | ||
92 | + WebElement singleQuantity; | ||
93 | + | ||
94 | + //single | ||
95 | + @FindBy (xpath ="//*[text()='30-49 ctn']") | ||
96 | + WebElement single; | ||
97 | + | ||
98 | + //select | ||
99 | + @FindBy (xpath ="//*[text()='Select']") | ||
100 | + WebElement select; | ||
101 | + | ||
102 | + //toys1 | ||
103 | + @FindBy (xpath ="//*[@title='Animals&plants']") | ||
104 | + WebElement toys1; | ||
105 | + | ||
106 | + //toys2 | ||
107 | + @FindBy (xpath ="//*[text()='Dolls and accessories']") | ||
108 | + WebElement toys2; | ||
109 | + | ||
110 | + //toys3 | ||
111 | + @FindBy (xpath ="//*[text()='Bricks']") | ||
112 | + WebElement toys3; | ||
113 | + | ||
114 | + //referralCode | ||
115 | + @FindBy (xpath ="//*[@id='referralCode']") | ||
116 | + WebElement referralCode; | ||
117 | + | ||
118 | + //checkBox | ||
119 | + @FindBy (xpath ="//*[@id='protocol']") | ||
120 | + WebElement checkbox; | ||
121 | + | ||
122 | + //Register | ||
123 | + @FindBy (xpath ="//*[@id='submit']") | ||
124 | + WebElement register; | ||
125 | + | ||
126 | + /* | ||
127 | + * 页面方法 | ||
128 | + */ | ||
129 | + /** | ||
130 | + * 注册 | ||
131 | + * @return IndexPage | ||
132 | + */ | ||
133 | + public IndexPage register() { | ||
134 | + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm"); | ||
135 | + String num = Tools.getTime(); | ||
136 | + sendKeys(email, Model.getEmail()); | ||
137 | + sendKeys(password, "essa123"); | ||
138 | + sendKeys(confirmPassword, "essa123"); | ||
139 | + click(currPlaceholder); | ||
140 | + click(CNY); | ||
141 | + sendKeys(companyName, "Auto"+num); | ||
142 | + click(continentPlaceholder); | ||
143 | + click(Europe); | ||
144 | + click(Russian); | ||
145 | + sendKeys(contactName, "Tester"+num); | ||
146 | + sendKeys(phone, format.format(new Date())); | ||
147 | + forceWait(500); | ||
148 | + click(purchaseQuantity); | ||
149 | + click(quantity); | ||
150 | + forceWait(500); | ||
151 | + click(singleQuantity); | ||
152 | + click(single); | ||
153 | + moveHeightScroll("100"); | ||
154 | + jsExecutorClick(select); | ||
155 | + click(toys1); | ||
156 | + click(toys2); | ||
157 | + click(toys3); | ||
158 | + click(blank); | ||
159 | + sendKeys(referralCode, Model.getInvateCode()); | ||
160 | + jsExecutorClick(checkbox); | ||
161 | + click(register); | ||
162 | + forceWait(3000); | ||
163 | + return new IndexPage(driver); | ||
164 | + } | ||
165 | +} |
src/main/java/com/buyer/pageObject/SettingMarksPage.java
0 → 100644
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + * 设置唛头页 | ||
12 | + * @author Administrator | ||
13 | + * | ||
14 | + */ | ||
15 | +public class SettingMarksPage extends BasePage { | ||
16 | + public SettingMarksPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + //不应用唛头 | ||
20 | + @FindBy (xpath ="//*[@title='No shipping marks for these products']") | ||
21 | + WebElement noNeedMarks; | ||
22 | + | ||
23 | + //下一步 | ||
24 | + @FindBy (xpath ="//*[text()='Next step']") | ||
25 | + WebElement next; | ||
26 | + | ||
27 | + //弹框提示-确定 | ||
28 | + @FindBy (xpath ="//*[text()='OK']") | ||
29 | + WebElement ok; | ||
30 | + | ||
31 | + /** | ||
32 | + * 设置唛头:不应用唛头 | ||
33 | + * @return SettingStickerPage | ||
34 | + */ | ||
35 | + public SettingStickerPage setMarks() { | ||
36 | + /*while(!(isVisibility(By.xpath("//*[@title='No shipping marks for these products']")))) { | ||
37 | + forceWait(1000); | ||
38 | + }*/ | ||
39 | + dynamicWait(By.xpath("//*[@title='No shipping marks for these products']")); | ||
40 | + click(noNeedMarks); | ||
41 | + click(next); | ||
42 | + forceWait(500); | ||
43 | + click(ok); | ||
44 | + return new SettingStickerPage(driver); | ||
45 | + } | ||
46 | +} |
src/main/java/com/buyer/pageObject/SettingStickerPage.java
0 → 100644
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + *设置贴纸页 | ||
13 | + */ | ||
14 | +public class SettingStickerPage extends BasePage { | ||
15 | + public SettingStickerPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + //不应用贴纸 | ||
19 | + @FindBy (xpath ="//*[@title='No stickers for these products']") | ||
20 | + WebElement noNeedSticker; | ||
21 | + | ||
22 | + //下一步 | ||
23 | + @FindBy (xpath ="//*[text()='Next step']") | ||
24 | + WebElement next; | ||
25 | + | ||
26 | + //弹框提示-确定 | ||
27 | + @FindBy (xpath ="//*[text()='OK']") | ||
28 | + WebElement ok; | ||
29 | + | ||
30 | + /** | ||
31 | + * 设置贴纸:不应用贴纸 | ||
32 | + * @return OrderPreviewPage | ||
33 | + */ | ||
34 | + public OrderPreviewPage setSticker() { | ||
35 | + /*while (!(isVisibility(By.xpath("//*[@title='No stickers for these products']")))) { | ||
36 | + forceWait(1000); | ||
37 | + }*/ | ||
38 | + dynamicWait(By.xpath("//*[@title='No stickers for these products']")); | ||
39 | + click(noNeedSticker); | ||
40 | + click(next); | ||
41 | + click(ok); | ||
42 | + return new OrderPreviewPage(driver); | ||
43 | + } | ||
44 | +} |
src/main/java/com/buyer/pageObject/ShoppingCartPage.java
0 → 100644
@@ -0,0 +1,81 @@ | @@ -0,0 +1,81 @@ | ||
1 | +package com.buyer.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * 购物车页 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class ShoppingCartPage extends BasePage { | ||
17 | + public ShoppingCartPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + //关键字查询框 | ||
24 | + @FindBy (xpath ="//*[@ng-model='keyword']") | ||
25 | + WebElement keyword; | ||
26 | + | ||
27 | + //查询按钮 | ||
28 | + @FindBy (xpath ="//*[contains(@ng-click,'search()')]") | ||
29 | + WebElement searchButton; | ||
30 | + | ||
31 | + //搜索结果的一个sku对应的复选框 | ||
32 | + @FindBy (xpath ="//*[contains(@class,'products-list ng-scope')]/div[2]/div[2]/span[1]/input") | ||
33 | + WebElement checkbox; | ||
34 | + | ||
35 | + //可拼柜 | ||
36 | + @FindBy (xpath="//*[text()='Consolidation allowed']") | ||
37 | + WebElement consolidationAllowed; | ||
38 | + | ||
39 | + //开始拼柜 | ||
40 | + @FindBy (xpath ="//button[contains(text(),' Start consolidation')]") | ||
41 | + WebElement startConslidation; | ||
42 | + | ||
43 | + //确认采购按钮 | ||
44 | + @FindBy (xpath = "//*[@class='products-list ng-scope']/div[2]/div/div[1]/div/span[5]/div/button") | ||
45 | + WebElement confirmOrder; | ||
46 | + | ||
47 | + /* | ||
48 | + * 页面方法 | ||
49 | + */ | ||
50 | + /** | ||
51 | + * 断言sku是否已经加入购物车 | ||
52 | + * @return true:已加入 false:未加入 | ||
53 | + */ | ||
54 | + public boolean isSucceed() { | ||
55 | + mywait(keyword); | ||
56 | + sendKeys(keyword, Model.getSkuNo()); | ||
57 | + click(searchButton); | ||
58 | + mywait(checkbox); | ||
59 | + forceWait(2000); | ||
60 | + return isVisibility(By.xpath("//*[contains(text(),'"+Model.getSkuNo()+"')]")); | ||
61 | + } | ||
62 | + /** | ||
63 | + * 开始拼柜 | ||
64 | + * @return ConslidationPage | ||
65 | + */ | ||
66 | + public ConslidationPage startConslidation() { | ||
67 | + mywait(keyword); | ||
68 | + click(consolidationAllowed); | ||
69 | + mywait(startConslidation); | ||
70 | + click(startConslidation); | ||
71 | + return new ConslidationPage(driver); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * 确认采购 | ||
76 | + */ | ||
77 | + public void confirmOrder() { | ||
78 | + dynamicLoad(By.xpath("//*[@class='products-list ng-scope']/div[2]/div/div[1]/div/span[5]/div/button")); | ||
79 | + click(confirmOrder); | ||
80 | + } | ||
81 | +} |
src/main/java/com/buyer/testSuite/TestAddToCart.java
0 → 100644
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +package com.buyer.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import org.testng.asserts.SoftAssert; | ||
9 | + | ||
10 | +import com.buyer.pageObject.IndexPage; | ||
11 | +import com.buyer.pageObject.KeywordResultPage; | ||
12 | +import com.buyer.pageObject.ShoppingCartPage; | ||
13 | +import com.essa.framework.Model; | ||
14 | +import com.essa.pageObject.BaseTest; | ||
15 | + | ||
16 | +/** | ||
17 | + * @author Administrator | ||
18 | + *测试用例:采购商平台采购流程 | ||
19 | + */ | ||
20 | +public class TestAddToCart extends BaseTest { | ||
21 | + WebDriver driver; | ||
22 | + | ||
23 | + @BeforeClass | ||
24 | + public void setUp() { | ||
25 | + initBuyer(); | ||
26 | + loginBuyerValid(Model.getBuyerAccount(),Model.getBuyerPassword()); | ||
27 | +// loginBuyerValid("buyer51551@essa.cn","essa123"); | ||
28 | +// Model.setIsactivity(1); | ||
29 | +// Model.setSkuNo(""); | ||
30 | + } | ||
31 | + @AfterClass | ||
32 | + public void tearDown() { | ||
33 | + driver.quit(); | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * 关键字查询,并将搜到的结果加入购物车 | ||
38 | + */ | ||
39 | + @Test(description="关键字搜索,并将sku加入购物车",groups= {"first"}) | ||
40 | + public void keywordToCart() { | ||
41 | + this.driver = getDriver(); | ||
42 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
43 | + indexPage.keywordSearch(); | ||
44 | + KeywordResultPage keywordResultPage = PageFactory.initElements(driver, KeywordResultPage.class); | ||
45 | + keywordResultPage.addToCart(); | ||
46 | + //断言 | ||
47 | + ShoppingCartPage shoppingCartPage = PageFactory.initElements(driver, ShoppingCartPage.class); | ||
48 | + boolean actual = shoppingCartPage.isSucceed(); | ||
49 | + SoftAssert softAssert = new SoftAssert(); | ||
50 | + softAssert.assertEquals(actual, true, "加入购物车失败!"); | ||
51 | + softAssert.assertAll(); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 关键字查询,加入购物车,但不进入购物车,防止提示有人正在操作 | ||
56 | + */ | ||
57 | + @Test(description="将sku加入购物车") | ||
58 | + public void addSku() { | ||
59 | + this.driver = getDriver(); | ||
60 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
61 | + indexPage.keywordSearch(); | ||
62 | + KeywordResultPage keywordResultPage = PageFactory.initElements(driver, KeywordResultPage.class); | ||
63 | + keywordResultPage.addSku(); | ||
64 | + } | ||
65 | +} |
src/main/java/com/buyer/testSuite/TestConfirmBuy.java
0 → 100644
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +package com.buyer.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeTest; | ||
7 | +import org.testng.annotations.Test; | ||
8 | + | ||
9 | +import com.buyer.pageObject.IndexPage; | ||
10 | +import com.buyer.pageObject.ShoppingCartPage; | ||
11 | +import com.essa.framework.Model; | ||
12 | +import com.essa.pageObject.BaseTest; | ||
13 | + | ||
14 | +public class TestConfirmBuy extends BaseTest { | ||
15 | + | ||
16 | + WebDriver driver; | ||
17 | + | ||
18 | + @BeforeTest | ||
19 | + public void setUp() { | ||
20 | + initBuyer(); | ||
21 | + loginBuyerValid(Model.getBuyerAccount(),Model.getBuyerPassword()); | ||
22 | + } | ||
23 | + | ||
24 | + @AfterClass | ||
25 | + public void tearDown() { | ||
26 | + driver.quit(); | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 登录采购商账号,确认订单 | ||
31 | + */ | ||
32 | + @Test(description="采购商确认采购") | ||
33 | + public void confirmBuy() { | ||
34 | + this.driver = getDriver(); | ||
35 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
36 | + indexPage.toShoppingCartPage(); | ||
37 | + ShoppingCartPage shoppingCartPage = PageFactory.initElements(driver, ShoppingCartPage.class); | ||
38 | + shoppingCartPage.confirmOrder(); | ||
39 | + } | ||
40 | +} |
src/main/java/com/buyer/testSuite/TestRegister.java
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +package com.buyer.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import org.testng.asserts.SoftAssert; | ||
9 | + | ||
10 | +import com.buyer.pageObject.IndexPage; | ||
11 | +import com.buyer.pageObject.RegisterPage; | ||
12 | +import com.essa.pageObject.BaseTest; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author Administrator | ||
16 | + *测试用例:采购商注册信息填写 | ||
17 | + */ | ||
18 | +public class TestRegister extends BaseTest{ | ||
19 | + WebDriver driver; | ||
20 | + | ||
21 | + @BeforeClass | ||
22 | + public void setUp() { | ||
23 | + initBuyer(); | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * 注册buyer | ||
28 | + */ | ||
29 | + @Test(description="填写注册采购商信息,注册采购商") | ||
30 | + public void register() { | ||
31 | + this.driver = getDriver(); | ||
32 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
33 | + indexPage.toRegisterPage(); | ||
34 | + RegisterPage registerPage = PageFactory.initElements(driver, RegisterPage.class); | ||
35 | + registerPage.register(); | ||
36 | + | ||
37 | + SoftAssert softAssert = new SoftAssert(); | ||
38 | + softAssert.assertEquals(indexPage.isSucceed(), true, "采购商注册失败了!"); | ||
39 | + softAssert.assertAll(); | ||
40 | + } | ||
41 | + @AfterClass | ||
42 | + public void tearDown() { | ||
43 | + driver.quit(); | ||
44 | + } | ||
45 | +} |
@@ -0,0 +1,64 @@ | @@ -0,0 +1,64 @@ | ||
1 | +package com.buyer.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import com.buyer.pageObject.ConslidationPage; | ||
9 | +import com.buyer.pageObject.IndexPage; | ||
10 | +import com.buyer.pageObject.OrderPreviewPage; | ||
11 | +import com.buyer.pageObject.PayDepositPage; | ||
12 | +import com.buyer.pageObject.SettingMarksPage; | ||
13 | +import com.buyer.pageObject.SettingStickerPage; | ||
14 | +import com.buyer.pageObject.ShoppingCartPage; | ||
15 | +import com.essa.framework.Model; | ||
16 | +import com.essa.pageObject.BaseTest; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author Administrator | ||
20 | + *测试用例:采购商平台采购流程 | ||
21 | + */ | ||
22 | +public class TestSendPO extends BaseTest { | ||
23 | + WebDriver driver; | ||
24 | + | ||
25 | + @BeforeClass | ||
26 | + public void setUp() { | ||
27 | + initBuyer(); | ||
28 | + loginBuyerValid(Model.getBuyerAccount(),Model.getBuyerPassword()); | ||
29 | +// loginBuyerValid("buyer51551@essa.cn","essa123"); | ||
30 | + } | ||
31 | + @AfterClass | ||
32 | + public void tearDown() { | ||
33 | + driver.quit(); | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * 开始拼柜 | ||
38 | + */ | ||
39 | + @Test(description="开始拼柜") | ||
40 | + public void conslidation() { | ||
41 | + this.driver = getDriver(); | ||
42 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
43 | + indexPage.toShoppingCartPage(); | ||
44 | + ShoppingCartPage shoppingCartPage = PageFactory.initElements(driver, ShoppingCartPage.class); | ||
45 | + shoppingCartPage.startConslidation(); | ||
46 | + ConslidationPage conslidationPage = PageFactory.initElements(driver, ConslidationPage.class); | ||
47 | + conslidationPage.conslidation(); | ||
48 | + } | ||
49 | + /** | ||
50 | + * 提交PO | ||
51 | + */ | ||
52 | + @Test(description="设置贴纸唛头,提交PO") | ||
53 | + public void sendPO() { | ||
54 | + this.driver = getDriver(); | ||
55 | + SettingMarksPage settingMarksPage = PageFactory.initElements(driver, SettingMarksPage.class); | ||
56 | + settingMarksPage.setMarks(); | ||
57 | + SettingStickerPage settingStickerPage = PageFactory.initElements(driver, SettingStickerPage.class); | ||
58 | + settingStickerPage.setSticker(); | ||
59 | + OrderPreviewPage orderPreviewPage = PageFactory.initElements(driver, OrderPreviewPage.class); | ||
60 | + orderPreviewPage.submit(); | ||
61 | + PayDepositPage payDepositPage = PageFactory.initElements(driver, PayDepositPage.class); | ||
62 | + payDepositPage.operate(); | ||
63 | + } | ||
64 | +} |
@@ -0,0 +1,700 @@ | @@ -0,0 +1,700 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import java.awt.Robot; | ||
4 | +import java.awt.Toolkit; | ||
5 | +import java.awt.datatransfer.StringSelection; | ||
6 | +import java.awt.event.KeyEvent; | ||
7 | +import java.io.File; | ||
8 | +import java.io.FileInputStream; | ||
9 | +import java.io.IOException; | ||
10 | +import java.sql.Connection; | ||
11 | +import java.sql.ResultSet; | ||
12 | +import java.text.SimpleDateFormat; | ||
13 | +import java.util.ArrayList; | ||
14 | +import java.util.Date; | ||
15 | +import java.util.Iterator; | ||
16 | +import java.util.List; | ||
17 | +import java.util.Set; | ||
18 | + | ||
19 | +import org.apache.commons.io.FileUtils; | ||
20 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
21 | +import org.apache.poi.ss.usermodel.Cell; | ||
22 | +import org.apache.poi.ss.usermodel.Row; | ||
23 | +import org.apache.poi.ss.usermodel.Sheet; | ||
24 | +import org.apache.poi.ss.usermodel.Workbook; | ||
25 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
26 | +import org.openqa.selenium.Alert; | ||
27 | +import org.openqa.selenium.By; | ||
28 | +import org.openqa.selenium.JavascriptExecutor; | ||
29 | +import org.openqa.selenium.Keys; | ||
30 | +import org.openqa.selenium.NoSuchElementException; | ||
31 | +import org.openqa.selenium.OutputType; | ||
32 | +import org.openqa.selenium.TakesScreenshot; | ||
33 | +import org.openqa.selenium.WebDriver; | ||
34 | +import org.openqa.selenium.WebElement; | ||
35 | +import org.openqa.selenium.interactions.Actions; | ||
36 | +import org.openqa.selenium.support.ui.ExpectedConditions; | ||
37 | +import org.openqa.selenium.support.ui.Select; | ||
38 | +import org.openqa.selenium.support.ui.WebDriverWait; | ||
39 | + | ||
40 | +import com.essa.framework.BasePage; | ||
41 | +import com.essa.framework.LogType; | ||
42 | +import com.essa.framework.Logger; | ||
43 | +import com.mysql.cj.jdbc.PreparedStatement; | ||
44 | + | ||
45 | +public class BasePage { | ||
46 | + | ||
47 | + public static WebDriver driver; | ||
48 | + public static String pageTitle; | ||
49 | + public static String pageUrl; | ||
50 | + public static String OutputFileName = getDateTimeByFormat(new Date(), "yyyyMMdd_HHmmss"); | ||
51 | + | ||
52 | + /** | ||
53 | + * 构造方法 | ||
54 | + * @param driver | ||
55 | + */ | ||
56 | + public BasePage(WebDriver driver) { | ||
57 | + BasePage.driver = driver; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 在文本框内输入字符 | ||
62 | + * @param element | ||
63 | + * @param text | ||
64 | + */ | ||
65 | + protected void sendKeys(WebElement element, String text) { | ||
66 | + try { | ||
67 | + mywait(element); | ||
68 | + if (element.isEnabled()) { | ||
69 | + element.clear(); | ||
70 | + Logger.Output(LogType.LogTypeName.INFO, "清除文本框中已有字符:" + partialStr(element.toString(), "xpath:")); | ||
71 | + element.sendKeys(text); | ||
72 | + Logger.Output(LogType.LogTypeName.INFO, "输入的字符是:" + text); | ||
73 | + } | ||
74 | + } catch (Exception e) { | ||
75 | + Logger.Output(LogType.LogTypeName.ERROR, element.toString()+"元素不存在"); | ||
76 | + } | ||
77 | + | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 点击元素,这里指点击鼠标左键 | ||
82 | + * @param element | ||
83 | + */ | ||
84 | + protected void click(WebElement element) { | ||
85 | + | ||
86 | + try { | ||
87 | + mywait(element); | ||
88 | + if (element.isEnabled()) { | ||
89 | + Logger.Output(LogType.LogTypeName.INFO, "点击元素:" + partialStr(element.toString(), "xpath:")); | ||
90 | + element.click(); | ||
91 | + } | ||
92 | + } catch (Exception e) { | ||
93 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
94 | + } | ||
95 | + | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * 在文本输入框执行清除操作 | ||
100 | + * @param element | ||
101 | + */ | ||
102 | + protected void clear(WebElement element) { | ||
103 | + try { | ||
104 | + if (element.isEnabled()) { | ||
105 | + element.clear(); | ||
106 | + Logger.Output(LogType.LogTypeName.INFO, "清除输入框中字符:" + partialStr(element.toString(), "xpath:") ); | ||
107 | + } | ||
108 | + } catch (Exception e) { | ||
109 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
110 | + } | ||
111 | + | ||
112 | + } | ||
113 | + | ||
114 | + /** | ||
115 | + * 判断一个页面元素是否显示在当前页面 | ||
116 | + * @param element | ||
117 | + */ | ||
118 | + protected void verifyElementIsPresent(WebElement element) { | ||
119 | + | ||
120 | + try { | ||
121 | + if (element.isDisplayed()) { | ||
122 | + Logger.Output(LogType.LogTypeName.INFO, "元素存在:" + partialStr(element.toString(), "xpath:").trim()); | ||
123 | + | ||
124 | + } | ||
125 | + } catch (Exception e) { | ||
126 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * 获取页面的标题 | ||
132 | + * @return | ||
133 | + */ | ||
134 | + protected String getCurrentPageTitle() { | ||
135 | + | ||
136 | + pageTitle = driver.getTitle(); | ||
137 | + Logger.Output(LogType.LogTypeName.INFO, "当前页面的标题为:" + pageTitle); | ||
138 | + return pageTitle; | ||
139 | + } | ||
140 | + | ||
141 | + /** | ||
142 | + * 获取页面的url | ||
143 | + * @return | ||
144 | + */ | ||
145 | + public static String getCurrentPageUrl() { | ||
146 | + pageUrl = driver.getCurrentUrl(); | ||
147 | + Logger.Output(LogType.LogTypeName.INFO, "当前页面的URL为:" + pageUrl); | ||
148 | + return pageUrl; | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * 处理多窗口之间切换 | ||
153 | + */ | ||
154 | + protected void switchWindow() { | ||
155 | + | ||
156 | + String currentWindow = driver.getWindowHandle();// 获取当前窗口句柄 | ||
157 | + Set<String> handles = driver.getWindowHandles();// 获取所有窗口句柄 | ||
158 | + Logger.Output(LogType.LogTypeName.INFO, "当前窗口数量: " + handles.size()); | ||
159 | + Iterator<String> it = handles.iterator(); | ||
160 | + while (it.hasNext()) { | ||
161 | + if (currentWindow == it.next()) { | ||
162 | + driver.close(); | ||
163 | + continue; | ||
164 | + } | ||
165 | + try { | ||
166 | + // driver.close();// 关闭旧窗口 | ||
167 | + WebDriver window = driver.switchTo().window(it.next());// 切换到新窗口 | ||
168 | + Logger.Output(LogType.LogTypeName.INFO, "新窗口的标题为:" + window.getTitle()); | ||
169 | + } catch (Exception e) { | ||
170 | + Logger.Output(LogType.LogTypeName.ERROR, "无法切换到新打开窗口" + e.getMessage()); | ||
171 | + | ||
172 | + } | ||
173 | + // driver.close();//关闭当前焦点所在的窗口 | ||
174 | + } | ||
175 | + // driver.switchTo().window(currentWindow);//回到原来页面 | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * 处理多窗口之间切换 | ||
180 | + * 将会关闭当前的窗口 | ||
181 | + */ | ||
182 | + protected void switchMoreWindow() { | ||
183 | + | ||
184 | + String handle = driver.getWindowHandle(); | ||
185 | + for(String temhandle : driver.getWindowHandles()) { | ||
186 | + if (!temhandle.equals(handle)) { | ||
187 | + driver.close(); | ||
188 | + driver.switchTo().window(temhandle); | ||
189 | + } | ||
190 | + } | ||
191 | + } | ||
192 | + /** | ||
193 | + * 浏览器弹框操作,true确认弹框,false取消弹框 | ||
194 | + * @param isAccept | ||
195 | + */ | ||
196 | + protected void alert(boolean isAccept) { | ||
197 | + Alert alert = driver.switchTo().alert(); | ||
198 | + if (isAccept) { | ||
199 | + Logger.Output(LogType.LogTypeName.INFO, "提示框内容为:" + alert.getText()); | ||
200 | + alert.accept(); | ||
201 | + Logger.Output(LogType.LogTypeName.INFO, "确认弹框"); | ||
202 | + } else { | ||
203 | + Logger.Output(LogType.LogTypeName.INFO, "提示框内容为:" + alert.getText()); | ||
204 | + alert.dismiss(); | ||
205 | + Logger.Output(LogType.LogTypeName.INFO, "取消弹框"); | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + /** | ||
210 | + * 下拉框选择选项 | ||
211 | + * 元素必须可以使用select,input和button使用会报错 | ||
212 | + * @param element | ||
213 | + * @param optionText | ||
214 | + */ | ||
215 | + protected void selectElement(WebElement element, String optionText) { | ||
216 | + Select select = new Select(element); | ||
217 | + select.selectByVisibleText(optionText); | ||
218 | + Logger.Output(LogType.LogTypeName.INFO, "选择选项:" + optionText); | ||
219 | + } | ||
220 | + | ||
221 | + /** | ||
222 | + * 下拉框选择选项,通过选项中的value来定位 | ||
223 | + * @param element | ||
224 | + * @param value | ||
225 | + */ | ||
226 | + protected void selectElement(WebElement element, int value) { | ||
227 | + Select select = new Select(element); | ||
228 | + select.selectByIndex(value); | ||
229 | + Logger.Output(LogType.LogTypeName.INFO, "选择选项:" + value); | ||
230 | + } | ||
231 | + /** | ||
232 | + * 判断元素在页面中是否存在 | ||
233 | + * @param element | ||
234 | + * @return boolean | ||
235 | + */ | ||
236 | + protected boolean isElementExist(WebElement element) { | ||
237 | + try { | ||
238 | + Boolean bool = element.isDisplayed(); | ||
239 | + | ||
240 | + Logger.Output(LogType.LogTypeName.INFO, "检查元素是否存在:" +partialStr(element.toString(), "xpath:")+":"+ bool); | ||
241 | + return bool; | ||
242 | + } catch (NoSuchElementException e) { | ||
243 | + takeScreenShot(); | ||
244 | + Logger.Output(LogType.LogTypeName.ERROR, "无法确认当前元素是否存在:" + e.getMessage()); | ||
245 | + return false; | ||
246 | + } | ||
247 | + } | ||
248 | + | ||
249 | + /** | ||
250 | + * 元素在页面上是否可见,不建议用此方法,有时会报错,找不出原因 | ||
251 | + * @param element | ||
252 | + * @return boolean | ||
253 | + */ | ||
254 | + protected boolean isVisibility(WebElement element) { | ||
255 | + try { | ||
256 | + if(ExpectedConditions.visibilityOf(element) != null) { | ||
257 | + Logger.Output(LogType.LogTypeName.INFO, "元素在页面上可见"); | ||
258 | + return true; | ||
259 | + } | ||
260 | + } catch (NoSuchElementException e) { | ||
261 | + Logger.Output(LogType.LogTypeName.ERROR, "无法页面上是否有此元素"); | ||
262 | + return false; | ||
263 | + } | ||
264 | + Logger.Output(LogType.LogTypeName.INFO, "元素在页面不可见"); | ||
265 | + return false; | ||
266 | + } | ||
267 | + | ||
268 | + /** | ||
269 | + * 元素在页面上是否可见 | ||
270 | + * @param element | ||
271 | + * @return | ||
272 | + */ | ||
273 | + protected boolean isVisibility(By by) { | ||
274 | + try { | ||
275 | + Logger.Output(LogType.LogTypeName.INFO, "检查元素在页面上是否可见"); | ||
276 | + if(ExpectedConditions.visibilityOf(driver.findElement(by)) != null) { | ||
277 | + Logger.Output(LogType.LogTypeName.INFO, "元素可见:"+by.toString()); | ||
278 | + return true; | ||
279 | + } | ||
280 | + } catch (NoSuchElementException e) { | ||
281 | + } | ||
282 | + Logger.Output(LogType.LogTypeName.INFO, "元素不可见:"+by.toString()); | ||
283 | + return false; | ||
284 | + } | ||
285 | + | ||
286 | + | ||
287 | + /** | ||
288 | + * 获取元素的文本值 | ||
289 | + * @param element | ||
290 | + */ | ||
291 | + protected String getText(WebElement element) { | ||
292 | + | ||
293 | + try { | ||
294 | + if (element.isEnabled()) { | ||
295 | + Logger.Output(LogType.LogTypeName.INFO, "获取当前元素的文本值:" + element.getText()); | ||
296 | + return element.getText(); | ||
297 | + } | ||
298 | + } catch (Exception e) { | ||
299 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
300 | + } | ||
301 | + return null; | ||
302 | + } | ||
303 | + | ||
304 | + /** | ||
305 | + * js的点击操作 | ||
306 | + * @param element | ||
307 | + */ | ||
308 | + protected void jsExecutorClick(WebElement element) { | ||
309 | + try { | ||
310 | + mywait(element); | ||
311 | + JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; | ||
312 | + jsExecutor.executeScript("arguments[0].click();", element); | ||
313 | + Logger.Output(LogType.LogTypeName.INFO, "调用JavaScript点击元素:" + partialStr(element.toString(), "xpath:")); | ||
314 | + } catch (Exception e) { | ||
315 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
316 | + } | ||
317 | + | ||
318 | + } | ||
319 | + | ||
320 | + /** | ||
321 | + * js的删除操作 | ||
322 | + * @param webElement | ||
323 | + * @param attribute | ||
324 | + */ | ||
325 | + protected void jsExecutorRemoveAttribute(WebElement webElement, String attribute) { | ||
326 | + try { | ||
327 | + JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; | ||
328 | + jsExecutor.executeScript("arguments[0].removeAttribute('" + attribute + "');", webElement); | ||
329 | + Logger.Output(LogType.LogTypeName.INFO, "调用JavaScript删除元素属性:" + attribute); | ||
330 | + } catch (Exception e) { | ||
331 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
332 | + } | ||
333 | + | ||
334 | + } | ||
335 | + | ||
336 | + /** | ||
337 | + * 获取js返回的值 | ||
338 | + * @param webElement | ||
339 | + * @return | ||
340 | + */ | ||
341 | + protected String jsExecutorGetAttributeValue(WebElement webElement) { | ||
342 | + try { | ||
343 | + JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; | ||
344 | + Logger.Output(LogType.LogTypeName.INFO, "调用JavaScript返回元素属性值"); | ||
345 | + return (String) jsExecutor.executeScript("return arguments[0].id;", webElement); | ||
346 | + } catch (Exception e) { | ||
347 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
348 | + return null; | ||
349 | + } | ||
350 | + } | ||
351 | + | ||
352 | + /** | ||
353 | + * 读取excel中的数据 | ||
354 | + * @param filepath excel的路径地址 | ||
355 | + * @param filename excel的文件名 | ||
356 | + * @param SheetName excel的worksheet名 | ||
357 | + * @return | ||
358 | + * @throws Exception | ||
359 | + */ | ||
360 | + public static Object[][] readExcel(String filepath, String filename, String SheetName){ | ||
361 | + try { | ||
362 | + File file = new File(filepath + "\\" + filename); | ||
363 | + FileInputStream inputStream = new FileInputStream(file); | ||
364 | + Workbook Workbook = null; | ||
365 | + // 获取文件扩展名 | ||
366 | + String fileExtensionName = filename.substring(filename.indexOf(".")); | ||
367 | + Logger.Output(LogType.LogTypeName.INFO, "获取所要读取的文件"); | ||
368 | + // 判断是.xlsx还是.xls的文件并进行实例化 | ||
369 | + if (fileExtensionName.equals(".xlsx")) { | ||
370 | + Workbook = new XSSFWorkbook(inputStream); | ||
371 | + Logger.Output(LogType.LogTypeName.INFO, "文件为:.xlsx格式"); | ||
372 | + } else if (fileExtensionName.equals(".xls")) { | ||
373 | + Workbook = new HSSFWorkbook(inputStream); | ||
374 | + Logger.Output(LogType.LogTypeName.INFO, "文件为:.xls格式"); | ||
375 | + } | ||
376 | + // 通过sheetName生成Sheet对象 | ||
377 | + Sheet Sheet = Workbook.getSheet(SheetName); | ||
378 | + int rowCount = Sheet.getLastRowNum() - Sheet.getFirstRowNum(); | ||
379 | + List<Object[]> records = new ArrayList<Object[]>(); | ||
380 | + for (int i = 0; i < rowCount + 1; i++) { | ||
381 | + Row row = Sheet.getRow(i); | ||
382 | + String fields[] = new String[row.getLastCellNum()]; | ||
383 | + for (int j = 0; j < row.getLastCellNum(); j++) { | ||
384 | + if (row.getCell(j).getCellType() == Cell.CELL_TYPE_NUMERIC) { | ||
385 | + row.getCell(j).setCellType(Cell.CELL_TYPE_STRING); | ||
386 | + } | ||
387 | + // 判断数据的类型 | ||
388 | + switch (row.getCell(j).getCellType()) { | ||
389 | + case Cell.CELL_TYPE_NUMERIC: // 数字 | ||
390 | + fields[j] = String.valueOf(row.getCell(j).getNumericCellValue()); | ||
391 | + break; | ||
392 | + case Cell.CELL_TYPE_STRING: // 字符串 | ||
393 | + fields[j] = String.valueOf(row.getCell(j).getStringCellValue()); | ||
394 | + break; | ||
395 | + case Cell.CELL_TYPE_BOOLEAN: // Boolean | ||
396 | + fields[j] = String.valueOf(row.getCell(j).getBooleanCellValue()); | ||
397 | + break; | ||
398 | + case Cell.CELL_TYPE_FORMULA: // 公式 | ||
399 | + fields[j] = String.valueOf(row.getCell(j).getCellFormula()); | ||
400 | + break; | ||
401 | + case Cell.CELL_TYPE_BLANK: // 空值 | ||
402 | + fields[j] = ""; | ||
403 | + break; | ||
404 | + case Cell.CELL_TYPE_ERROR: // 故障 | ||
405 | + fields[j] = "非法字符"; | ||
406 | + break; | ||
407 | + default: | ||
408 | + fields[j] = "未知类型"; | ||
409 | + break; | ||
410 | + } | ||
411 | + } | ||
412 | + records.add(fields); | ||
413 | + } | ||
414 | + Object[][] results = new Object[records.size()][]; | ||
415 | + for (int i = 0; i < records.size(); i++) { | ||
416 | + results[i] = records.get(i); | ||
417 | + } | ||
418 | + Logger.Output(LogType.LogTypeName.INFO, "读取文件成功"); | ||
419 | + return results; | ||
420 | + } catch (Exception e) { | ||
421 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
422 | + } | ||
423 | + return null; | ||
424 | + } | ||
425 | + | ||
426 | + /** | ||
427 | + * 上传文件 | ||
428 | + * @param filePath | ||
429 | + * @throws Exception | ||
430 | + */ | ||
431 | + protected void uploadFile(String filePath){ | ||
432 | + try { | ||
433 | + Logger.Output(LogType.LogTypeName.INFO, "开始上传文件"); | ||
434 | + StringSelection sel = new StringSelection(filePath); | ||
435 | + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null); | ||
436 | + // 新建一个Robot类的对象 | ||
437 | + Robot robot = new Robot(); | ||
438 | + Thread.sleep(1000); | ||
439 | + | ||
440 | + // 按下回车 | ||
441 | + robot.keyPress(KeyEvent.VK_ENTER); | ||
442 | + | ||
443 | + // 释放回车 | ||
444 | + robot.keyRelease(KeyEvent.VK_ENTER); | ||
445 | + | ||
446 | + // 按下 CTRL+V | ||
447 | + robot.keyPress(KeyEvent.VK_CONTROL); | ||
448 | + robot.keyPress(KeyEvent.VK_V); | ||
449 | + | ||
450 | + // 释放 CTRL+V | ||
451 | + robot.keyRelease(KeyEvent.VK_CONTROL); | ||
452 | + robot.keyRelease(KeyEvent.VK_V); | ||
453 | + Thread.sleep(1000); | ||
454 | + | ||
455 | + // 点击回车 Enter | ||
456 | + robot.keyPress(KeyEvent.VK_ENTER); | ||
457 | + robot.keyRelease(KeyEvent.VK_ENTER); | ||
458 | + | ||
459 | + Logger.Output(LogType.LogTypeName.INFO, "上传文件成功"); | ||
460 | + } catch (Exception e) { | ||
461 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
462 | + } | ||
463 | + } | ||
464 | + | ||
465 | + /** | ||
466 | + * 字符串切片 | ||
467 | + * @param element 需要被操作的元素 | ||
468 | + * @param begin 从这个字符开始切 | ||
469 | + * @param end 到这个字符结尾 | ||
470 | + * 例子:某个元素的文本值为:广州市天河区猎德,只要“天河区” | ||
471 | + * 第二个参数:天, 第三个参数:区 | ||
472 | + * @return | ||
473 | + */ | ||
474 | + protected String partialStr(WebElement element, String begin, String end) { | ||
475 | + String result_string = element.getText(); | ||
476 | + Logger.Output(LogType.LogTypeName.INFO, "获取所需切片的字符串"); | ||
477 | + // 根据词切片,取第二片字符串 | ||
478 | + String st1 = result_string.split(begin)[1]; | ||
479 | + Logger.Output(LogType.LogTypeName.INFO, "切除" + begin + "之前的字符串"); | ||
480 | + // 再切一次结尾,得到我们想要的结果 | ||
481 | + String search_need = st1.split(end)[0]; | ||
482 | + Logger.Output(LogType.LogTypeName.INFO, "切除" + end + "之后的字符串"); | ||
483 | + Logger.Output(LogType.LogTypeName.INFO, "返回切片后的字符串"); | ||
484 | + return search_need; | ||
485 | + } | ||
486 | + | ||
487 | + /** | ||
488 | + * 复写切片,仅在本页面作为截断日志文本后面带的一堆字符串 | ||
489 | + * @param string | ||
490 | + * @param begin | ||
491 | + * @return | ||
492 | + */ | ||
493 | + protected String partialStr(String string,String begin) { | ||
494 | + String st1 = string.split(begin)[1]; | ||
495 | + return st1; | ||
496 | + } | ||
497 | + | ||
498 | + /**要的元素是否存在,最多5秒 | ||
499 | + * @param element | ||
500 | + */ | ||
501 | + protected void mywait(WebElement element) { | ||
502 | + | ||
503 | + WebDriverWait wait = new WebDriverWait(driver, 7); | ||
504 | +// Logger.Output(LogType.LogTypeName.INFO, "等待元素在页面上加载可见,最多5秒"); | ||
505 | + wait.until(ExpectedConditions.visibilityOf(element)); | ||
506 | + } | ||
507 | + | ||
508 | + /** | ||
509 | + * 设立检查点,判断页面是否是我们要的 | ||
510 | + * @param checkPoint | ||
511 | + * @param element | ||
512 | + * @return | ||
513 | + */ | ||
514 | + protected boolean isThisPage(String checkPoint,WebElement element) { | ||
515 | + boolean bool1=checkPoint.equals(element.getText()); | ||
516 | + Logger.Output(LogType.LogTypeName.INFO, "判断检查点是否存在:"+bool1); | ||
517 | + return bool1; | ||
518 | + } | ||
519 | + | ||
520 | + /** | ||
521 | + * 截图当前页面 | ||
522 | + */ | ||
523 | + protected void takeScreenShot() { | ||
524 | + File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); | ||
525 | + | ||
526 | + try { | ||
527 | + // 拷贝截图文件到我们项目./Screenshots | ||
528 | + FileUtils.copyFile(src, new File(".\\Log\\Screenshots\\"+OutputFileName+"截图.png")); | ||
529 | + Logger.Output(LogType.LogTypeName.INFO, "截图当前页面成功!"); | ||
530 | + } | ||
531 | + | ||
532 | + catch (IOException e) { | ||
533 | + System.out.println(e.getMessage()); | ||
534 | + Logger.Output(LogType.LogTypeName.ERROR, "截图当前页面失败!"); | ||
535 | + } | ||
536 | + | ||
537 | + } | ||
538 | + | ||
539 | + /** | ||
540 | + * 上下移动滚动条,这里使用js操作 | ||
541 | + * @param percent 0:最下方 100:最上方 | ||
542 | + */ | ||
543 | + protected void moveHeightScroll(String percent) { | ||
544 | + JavascriptExecutor js = (JavascriptExecutor)driver; | ||
545 | + js.executeScript("scrollBy(0, 0-document.body.scrollHeight *"+percent+"/100)"); | ||
546 | + try { | ||
547 | + Thread.sleep(1000); | ||
548 | + } catch (Exception e) { | ||
549 | + } | ||
550 | + Logger.Output(LogType.LogTypeName.INFO, "上下拖动滚动条"); | ||
551 | + } | ||
552 | + | ||
553 | + /** | ||
554 | + * 左右移动滚动条 | ||
555 | + * @param percent 0:最左 100:最右 | ||
556 | + */ | ||
557 | + protected void moveWidthScroll(String percent) { | ||
558 | + JavascriptExecutor js = (JavascriptExecutor)driver; | ||
559 | + js.executeScript("scrollBy(0, 0-document.body.scrollWidth *"+percent+"/100)"); | ||
560 | + Logger.Output(LogType.LogTypeName.INFO, "左右拖动滚动条"); | ||
561 | + } | ||
562 | + | ||
563 | + /** | ||
564 | + * 鼠标点击 | ||
565 | + * @param element | ||
566 | + */ | ||
567 | + protected void actionClick(WebElement element) { | ||
568 | + try { | ||
569 | + Actions action = new Actions(driver); | ||
570 | + Logger.Output(LogType.LogTypeName.INFO, "鼠标事件点击元素"); | ||
571 | + action.click(element).perform(); | ||
572 | + } catch (Exception e) { | ||
573 | + Logger.Output(LogType.LogTypeName.ERROR, "鼠标事件点击元素失败!"); | ||
574 | + } | ||
575 | + } | ||
576 | + | ||
577 | + /** | ||
578 | + * 鼠标双击 | ||
579 | + * @param element | ||
580 | + */ | ||
581 | + protected void actionDoubleClick(WebElement element) { | ||
582 | + try { | ||
583 | + Actions action = new Actions(driver); | ||
584 | + Logger.Output(LogType.LogTypeName.INFO, "鼠标双击元素"); | ||
585 | + action.doubleClick(element).perform(); | ||
586 | + } catch (Exception e) { | ||
587 | + Logger.Output(LogType.LogTypeName.ERROR, "鼠标双击元素失败!"); | ||
588 | + } | ||
589 | + } | ||
590 | + | ||
591 | + | ||
592 | + /** | ||
593 | + * 模拟鼠标事件拖动元素 | ||
594 | + * @param element 需要拖动的元素 | ||
595 | + * @param horizontal 水平方向:正数向右,负数向左 | ||
596 | + * @param vertical 垂直方向:正数向上,负数向下 | ||
597 | + */ | ||
598 | + protected void jsExecutorDragAndDrop(WebElement element,int horizontal,int vertical) { | ||
599 | + try { | ||
600 | + Actions action = new Actions(driver); | ||
601 | + action.dragAndDropBy(element, horizontal, vertical).perform(); | ||
602 | + Logger.Output(LogType.LogTypeName.INFO, "使用鼠标拖动,将元素水平拖动"+horizontal+" 垂直拖动"+vertical); | ||
603 | + } catch (Exception e) { | ||
604 | + Logger.Output(LogType.LogTypeName.ERROR, e.getMessage() + "."); | ||
605 | + } | ||
606 | + } | ||
607 | + | ||
608 | + /** | ||
609 | + * 移动鼠标到指定元素 | ||
610 | + * @param element | ||
611 | + */ | ||
612 | + public void moveMouse(WebElement element) { | ||
613 | + try { | ||
614 | + Actions action = new Actions(driver); | ||
615 | + Logger.Output(LogType.LogTypeName.INFO, "移动鼠标到指定元素上"); | ||
616 | + action.moveToElement(element).perform(); | ||
617 | + } catch (Exception e) { | ||
618 | + Logger.Output(LogType.LogTypeName.ERROR, "移动鼠标失败了~"); | ||
619 | + } | ||
620 | + } | ||
621 | + | ||
622 | + /** | ||
623 | + * 键盘回车 | ||
624 | + * @param element | ||
625 | + */ | ||
626 | + protected void enter(WebElement element) { | ||
627 | + try { | ||
628 | + Logger.Output(LogType.LogTypeName.INFO, "对元素进行键盘回车"); | ||
629 | + element.sendKeys(Keys.ENTER); | ||
630 | + } catch (Exception e) { | ||
631 | + Logger.Output(LogType.LogTypeName.ERROR, "键盘回车失败!"); | ||
632 | + } | ||
633 | + } | ||
634 | + | ||
635 | + /** | ||
636 | + * 强行等待,有时候页面加载需要时间,检查点检测不出使用 | ||
637 | + * @param msec | ||
638 | + */ | ||
639 | + protected void forceWait(int msec) { | ||
640 | + try { | ||
641 | + Logger.Output(LogType.LogTypeName.INFO, "强行等待:"+msec/1000+"秒"); | ||
642 | + Thread.sleep(msec); | ||
643 | + } catch (Exception e) { | ||
644 | + Logger.Output(LogType.LogTypeName.ERROR, "强行等待失败"); | ||
645 | + } | ||
646 | + } | ||
647 | + /** | ||
648 | + * 动态等待,如果元素不存在,等待一秒直到元素出现,最长7秒 | ||
649 | + * @param by | ||
650 | + */ | ||
651 | + protected void dynamicWait(By by) { | ||
652 | + for(int count=0;count<7&&!(isVisibility(by));count++) { | ||
653 | + forceWait(1000); | ||
654 | + } | ||
655 | + } | ||
656 | + | ||
657 | + /** | ||
658 | + * 与上面的方法相反,如果元素存在,等待直到元素不存在,最长7秒 | ||
659 | + * @param by | ||
660 | + */ | ||
661 | + protected void dynamicLoad(By by) { | ||
662 | + for(int count=0;count<7&&isVisibility(by);count++) { | ||
663 | + forceWait(1000); | ||
664 | + } | ||
665 | + } | ||
666 | + /** | ||
667 | + * 连接数据库查询数据 | ||
668 | + * @param sql 查询sql | ||
669 | + * @param field 需要的字段,这个方法只支持一个字段查询 | ||
670 | + * @return 返回字段值 | ||
671 | + */ | ||
672 | + protected String DBSqlSearch(String sql,String field) { | ||
673 | + try { | ||
674 | + Connection conn = DButil.getCon(); | ||
675 | + PreparedStatement pstmt = (PreparedStatement) conn.prepareStatement(sql); | ||
676 | + ResultSet rs = pstmt.executeQuery(); | ||
677 | + while (rs.next()) { | ||
678 | + return rs.getString(field); | ||
679 | + } | ||
680 | + DButil.close(rs, pstmt, conn); | ||
681 | + } catch (Exception e) { | ||
682 | + e.printStackTrace(); | ||
683 | + } | ||
684 | + return null; | ||
685 | + } | ||
686 | + | ||
687 | + /** | ||
688 | + * 获取当前系统时间,得到格式化时间字符串 | ||
689 | + * @param date | ||
690 | + * @param format | ||
691 | + * @return | ||
692 | + */ | ||
693 | + protected static String getDateTimeByFormat(Date date, String format) { | ||
694 | + | ||
695 | + SimpleDateFormat df = new SimpleDateFormat(format); | ||
696 | + | ||
697 | + return df.format(date); | ||
698 | + | ||
699 | + } | ||
700 | +} | ||
0 | \ No newline at end of file | 701 | \ No newline at end of file |
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | + | ||
6 | +public class BasePage1 { | ||
7 | + public static WebDriver driver; | ||
8 | + /** | ||
9 | + * 构造方法 | ||
10 | + * @param driver | ||
11 | + */ | ||
12 | + public BasePage1(WebDriver driver) { | ||
13 | + BasePage.driver = driver; | ||
14 | + } | ||
15 | + /** | ||
16 | + * 填写文本 | ||
17 | + * @param element 元素 | ||
18 | + * @param text 文本值 | ||
19 | + */ | ||
20 | + protected void sendKeys(WebElement element, String text) { | ||
21 | + element.clear();// 清除原有文本 | ||
22 | + element.sendKeys(text); | ||
23 | + } | ||
24 | + /** | ||
25 | + * 鼠标左键点击 | ||
26 | + * @param element 元素 | ||
27 | + */ | ||
28 | + protected void click(WebElement element) { | ||
29 | + element.click(); | ||
30 | + } | ||
31 | + /** | ||
32 | + * 获取当前页面的标题 | ||
33 | + * @return 标题 | ||
34 | + */ | ||
35 | + protected String getCurrentPageTitle() { | ||
36 | + return driver.getTitle(); | ||
37 | + } | ||
38 | +} |
src/main/java/com/essa/framework/BrowserEngine.java
0 → 100644
@@ -0,0 +1,143 @@ | @@ -0,0 +1,143 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.chrome.ChromeDriver; | ||
5 | +import org.openqa.selenium.firefox.FirefoxDriver; | ||
6 | +import org.openqa.selenium.ie.InternetExplorerDriver; | ||
7 | +import org.openqa.selenium.remote.CapabilityType; | ||
8 | +import org.openqa.selenium.remote.DesiredCapabilities; | ||
9 | + | ||
10 | +import java.io.FileInputStream; | ||
11 | +import java.io.IOException; | ||
12 | +import java.io.InputStream; | ||
13 | +import java.util.Properties; | ||
14 | +import java.util.concurrent.TimeUnit; | ||
15 | + | ||
16 | +public class BrowserEngine { | ||
17 | + | ||
18 | + private static String browserName; | ||
19 | + private String serverURL; | ||
20 | + private String buyerURL; | ||
21 | + private static WebDriver driver; | ||
22 | + private static String env1; | ||
23 | + | ||
24 | + public void initConfigData() throws IOException{ | ||
25 | + Properties p = new Properties(); | ||
26 | + // 加载配置文件 | ||
27 | +// System.load("./config.properties"); | ||
28 | +// InputStream a = ClassLoader.getSystemResourceAsStream("config.properties"); | ||
29 | +// System.out.println("browserName + " + System.getProperty("browserName")); | ||
30 | + InputStream ips = new FileInputStream(".\\src\\main\\resources\\config.properties"); | ||
31 | + p.load(ips); | ||
32 | +// Logger.Output(LogType.LogTypeName.INFO, "开始从配置文件中选择浏览器"); | ||
33 | + browserName=p.getProperty("browserName");//使用jframe要注释 | ||
34 | + Logger.Output(LogType.LogTypeName.INFO, "所选择的浏览器类型为: "+ browserName); | ||
35 | + if (env1=="DIT") { | ||
36 | + serverURL = p.getProperty("DIT"); | ||
37 | + buyerURL = p.getProperty("BDIT"); | ||
38 | + }else if (env1 =="HOTFIX") { | ||
39 | + serverURL = p.getProperty("HOTFIX"); | ||
40 | + buyerURL = p.getProperty("BHOTFIX"); | ||
41 | + }else if (env1 == "UAT") { | ||
42 | + serverURL = p.getProperty("UAT"); | ||
43 | + buyerURL = p.getProperty("BUAT"); | ||
44 | + }else { | ||
45 | + serverURL = p.getProperty("SIT"); | ||
46 | + buyerURL = p.getProperty("BSIT"); | ||
47 | + } | ||
48 | + Logger.Output(LogType.LogTypeName.INFO, "所测试的环境为:"+ env1); | ||
49 | + Model.setEnv(env1);//我也不知道为什么执行完上面的代码后,env会变为sit | ||
50 | + ips.close(); | ||
51 | + } | ||
52 | + /** | ||
53 | + * bpms环境初始化 | ||
54 | + * @param environment | ||
55 | + * @param browser | ||
56 | + */ | ||
57 | + public static void setInit(String environment,String browser) { | ||
58 | + browserName = browser; | ||
59 | + env1 = environment; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * bpms获取地址方法 | ||
64 | + * @return | ||
65 | + */ | ||
66 | + public WebDriver getBrowser(){ | ||
67 | + | ||
68 | + if(browserName.equalsIgnoreCase("Firefox")){ | ||
69 | + System.setProperty("webdriver.gecko.driver", ".\\resources\\geckodriver.exe"); | ||
70 | + driver = new FirefoxDriver(); | ||
71 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动FireFox浏览器"); | ||
72 | + } | ||
73 | + else if(browserName.equals("Chrome")){ | ||
74 | + System.setProperty("webdriver.chrome.driver", ".\\src\\main\\resources\\chromedriver.exe"); //图形界面 | ||
75 | + driver= new ChromeDriver(); | ||
76 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动Chrome浏览器"); | ||
77 | + }else if(browserName.equalsIgnoreCase("IE")){ | ||
78 | + System.setProperty("webdriver.ie.driver", ".\\src\\main\resources\\IEDriverServer.exe"); | ||
79 | + driver= new InternetExplorerDriver(); | ||
80 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动IE浏览器"); | ||
81 | + } | ||
82 | + driver.manage().window().maximize(); | ||
83 | + Logger.Output(LogType.LogTypeName.INFO, "窗口最大化"); | ||
84 | + driver.get(serverURL); | ||
85 | + Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ serverURL); | ||
86 | + callWait(5); | ||
87 | + return driver; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * buyer获取浏览器,并读取buyer的地址 | ||
92 | + * @return | ||
93 | + */ | ||
94 | + public WebDriver buyerGetBrowser() { | ||
95 | + if (browserName.equals("Chrome")) { | ||
96 | + System.setProperty("webdriver.chrome.driver", ".\\resources\\chromedriver.exe"); //图形界面 | ||
97 | + driver= new ChromeDriver(); | ||
98 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动Chrome浏览器"); | ||
99 | + }else if (browserName.equals("Firefox")) { | ||
100 | + System.setProperty("webdriver.gecko.driver", ".\\resources\\geckodriver.exe"); | ||
101 | + driver = new FirefoxDriver(); | ||
102 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动FireFox浏览器"); | ||
103 | + } | ||
104 | + driver.manage().window().maximize(); | ||
105 | + Logger.Output(LogType.LogTypeName.INFO, "窗口最大化"); | ||
106 | + driver.get(buyerURL); | ||
107 | + Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ buyerURL); | ||
108 | + callWait(5); | ||
109 | + return driver; | ||
110 | + } | ||
111 | + | ||
112 | + | ||
113 | + /** | ||
114 | + * 退出驱动 | ||
115 | + * @throws InterruptedException | ||
116 | + */ | ||
117 | + public void tearDown() throws InterruptedException{ | ||
118 | + Logger.Output(LogType.LogTypeName.INFO, "关闭浏览器"); | ||
119 | + driver.quit(); | ||
120 | + Thread.sleep(3000); | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * 隐式时间等待方法 | ||
125 | + * @param time | ||
126 | + */ | ||
127 | + public void callWait(int time){ | ||
128 | + | ||
129 | + driver.manage().timeouts().implicitlyWait(time, TimeUnit.SECONDS); | ||
130 | + Logger.Output(LogType.LogTypeName.INFO, "设置隐性等待"+time+" 秒"); | ||
131 | + } | ||
132 | + /** | ||
133 | + *跳过安全链接 | ||
134 | + */ | ||
135 | + public void anQuan() { | ||
136 | + // 创建DesiredCapabilities类的一个对象实例 | ||
137 | + DesiredCapabilities cap=DesiredCapabilities.chrome(); | ||
138 | + // 设置变量ACCEPT_SSL_CERTS的值为True | ||
139 | + cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); | ||
140 | + Logger.Output(LogType.LogTypeName.INFO, "设置浏览器可以打开不安全链接"); | ||
141 | + } | ||
142 | +} | ||
143 | + |
@@ -0,0 +1,74 @@ | @@ -0,0 +1,74 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +public class DBInfo { | ||
4 | + | ||
5 | + //sit | ||
6 | + public static String sitJdbcName = "com.mysql.cj.jdbc.Driver"; | ||
7 | + public static String sitSqlUrl = "jdbc:mysql://192.168.1.247:3307/bpms"; | ||
8 | + public static String sitUser = "root"; | ||
9 | + public static String sitPassword = "redhat"; | ||
10 | + //hotfix | ||
11 | + public static String hotfixJdbcName = "com.mysql.cj.jdbc.Driver"; | ||
12 | + public static String hotfixSqlUrl = "jdbc:mysql://192.168.1.19:3321/bpms"; | ||
13 | + public static String hotfixUser = "essa_hotfix"; | ||
14 | + public static String hotfixPassword = "essa^_hotfix^D<K123"; | ||
15 | + //dit | ||
16 | + public static String ditJdbcName; | ||
17 | + public static String ditSqlUrl; | ||
18 | + public static String ditUser; | ||
19 | + public static String ditPassword; | ||
20 | + //uat | ||
21 | + public static String uatJdbcName = "com.mysql.cj.jdbc.Driver"; | ||
22 | + public static String uatSqlUrl = "jdbc:mysql://112.74.135.97:3325/bpms"; | ||
23 | + public static String uatUser = "essa_uat"; | ||
24 | + public static String uatPassword = "lXI!RqH6thvmMNNh"; | ||
25 | + | ||
26 | + public static String getSitJdbcName() { | ||
27 | + return sitJdbcName; | ||
28 | + } | ||
29 | + public static String getSitSqlUrl() { | ||
30 | + return sitSqlUrl; | ||
31 | + } | ||
32 | + public static String getSitUser() { | ||
33 | + return sitUser; | ||
34 | + } | ||
35 | + public static String getSitPassword() { | ||
36 | + return sitPassword; | ||
37 | + } | ||
38 | + public static String getHotfixJdbcName() { | ||
39 | + return hotfixJdbcName; | ||
40 | + } | ||
41 | + public static String getHotfixSqlUrl() { | ||
42 | + return hotfixSqlUrl; | ||
43 | + } | ||
44 | + public static String getHotfixUser() { | ||
45 | + return hotfixUser; | ||
46 | + } | ||
47 | + public static String getHotfixPassword() { | ||
48 | + return hotfixPassword; | ||
49 | + } | ||
50 | + public static String getDitJdbcName() { | ||
51 | + return ditJdbcName; | ||
52 | + } | ||
53 | + public static String getDitSqlUrl() { | ||
54 | + return ditSqlUrl; | ||
55 | + } | ||
56 | + public static String getDitUser() { | ||
57 | + return ditUser; | ||
58 | + } | ||
59 | + public static String getDitPassword() { | ||
60 | + return ditPassword; | ||
61 | + } | ||
62 | + public static String getUatJdbcName() { | ||
63 | + return uatJdbcName; | ||
64 | + } | ||
65 | + public static String getUatSqlUrl() { | ||
66 | + return uatSqlUrl; | ||
67 | + } | ||
68 | + public static String getUatUser() { | ||
69 | + return uatUser; | ||
70 | + } | ||
71 | + public static String getUatPassword() { | ||
72 | + return uatPassword; | ||
73 | + } | ||
74 | +} |
@@ -0,0 +1,143 @@ | @@ -0,0 +1,143 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import java.sql.Connection; | ||
4 | +import java.sql.DriverManager; | ||
5 | +import java.sql.ResultSet; | ||
6 | +import java.sql.SQLException; | ||
7 | + | ||
8 | +import com.mysql.cj.api.jdbc.Statement; | ||
9 | +import com.mysql.cj.jdbc.CallableStatement; | ||
10 | +import com.mysql.cj.jdbc.PreparedStatement; | ||
11 | + | ||
12 | +public class DButil { | ||
13 | + // 数据库驱动名字 | ||
14 | + private static String jdbcName = null; | ||
15 | + // 数据库协议地址 | ||
16 | + private static String dbUrl = null; | ||
17 | + // 数据库用户名 | ||
18 | + private static String dbUser = null; | ||
19 | + // 数据库密码 | ||
20 | + private static String dbPassword = null; | ||
21 | + | ||
22 | + public static Connection getCon() { | ||
23 | + Connection conn = null; | ||
24 | + if ("SIT".equals(Model.getEnv())) { | ||
25 | + try { | ||
26 | + jdbcName = DBInfo.getSitJdbcName(); | ||
27 | + dbUrl = DBInfo.getSitSqlUrl(); | ||
28 | + dbUser = DBInfo.getSitUser(); | ||
29 | + dbPassword = DBInfo.getSitPassword(); | ||
30 | + Class.forName(jdbcName); | ||
31 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | ||
32 | + return conn; | ||
33 | + } catch (Exception e) { | ||
34 | + e.printStackTrace(); | ||
35 | + } | ||
36 | + } else if ("HOTFIX".equals(Model.getEnv())) { | ||
37 | + try { | ||
38 | + jdbcName = DBInfo.getHotfixJdbcName(); | ||
39 | + dbUrl = DBInfo.getHotfixSqlUrl(); | ||
40 | + dbUser = DBInfo.getHotfixUser(); | ||
41 | + dbPassword = DBInfo.getHotfixPassword(); | ||
42 | + Class.forName(jdbcName); | ||
43 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | ||
44 | + return conn; | ||
45 | + } catch (Exception e) { | ||
46 | + e.printStackTrace(); | ||
47 | + } | ||
48 | + } else if ("DIT".equals(Model.getEnv())) { | ||
49 | + try { | ||
50 | + jdbcName = DBInfo.getDitJdbcName(); | ||
51 | + dbUrl = DBInfo.getDitSqlUrl(); | ||
52 | + dbUser = DBInfo.getDitUser(); | ||
53 | + dbPassword = DBInfo.getDitPassword(); | ||
54 | + Class.forName(jdbcName); | ||
55 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | ||
56 | + return conn; | ||
57 | + } catch (Exception e) { | ||
58 | + e.printStackTrace(); | ||
59 | + } | ||
60 | + } else if ("UAT".equals(Model.getEnv())) { | ||
61 | + try { | ||
62 | + jdbcName = DBInfo.getUatJdbcName(); | ||
63 | + dbUrl = DBInfo.getUatSqlUrl(); | ||
64 | + dbUser = DBInfo.getUatUser(); | ||
65 | + dbPassword = DBInfo.getUatPassword(); | ||
66 | + Class.forName(jdbcName); | ||
67 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | ||
68 | + return conn; | ||
69 | + } catch (Exception e) { | ||
70 | + e.printStackTrace(); | ||
71 | + } | ||
72 | + } | ||
73 | + return null; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 关闭连接 | ||
78 | + * | ||
79 | + * @param stmt | ||
80 | + * @param conn | ||
81 | + * @throws Exception | ||
82 | + */ | ||
83 | + public static void close(Statement stmt, Connection conn) throws Exception { | ||
84 | + if (stmt != null) { | ||
85 | + stmt.close(); | ||
86 | + if (conn != null) { | ||
87 | + conn.close(); | ||
88 | + } | ||
89 | + } | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * 关闭连接 | ||
94 | + * | ||
95 | + * @param cstmt | ||
96 | + * @param conn | ||
97 | + * @throws Exception | ||
98 | + */ | ||
99 | + public static void close(CallableStatement cstmt, Connection conn) throws Exception { | ||
100 | + if (cstmt != null) { | ||
101 | + cstmt.close(); | ||
102 | + if (conn != null) { | ||
103 | + conn.close(); | ||
104 | + } | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * 关闭连接 | ||
110 | + * | ||
111 | + * @param pstmt | ||
112 | + * @param conn | ||
113 | + * @throws SQLException | ||
114 | + */ | ||
115 | + public static void close(PreparedStatement pstmt, Connection conn) throws SQLException { | ||
116 | + if (pstmt != null) { | ||
117 | + pstmt.close(); | ||
118 | + if (conn != null) { | ||
119 | + conn.close(); | ||
120 | + } | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * 重载关闭方法 | ||
126 | + * | ||
127 | + * @param rs | ||
128 | + * @param pstmt | ||
129 | + * @param conn | ||
130 | + * @throws Exception | ||
131 | + */ | ||
132 | + public static void close(ResultSet rs, PreparedStatement pstmt, Connection conn) throws Exception { | ||
133 | + if (rs != null) { | ||
134 | + rs.close(); | ||
135 | + if (pstmt != null) { | ||
136 | + pstmt.close(); | ||
137 | + if (conn != null) { | ||
138 | + conn.close(); | ||
139 | + } | ||
140 | + } | ||
141 | + } | ||
142 | + } | ||
143 | +} |
src/main/java/com/essa/framework/ListenerSuite.java
0 → 100644
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import org.testng.ISuite; | ||
4 | +import org.testng.ISuiteListener; | ||
5 | + | ||
6 | +import com.essa.framework.SendEmail; | ||
7 | + | ||
8 | +public class ListenerSuite implements ISuiteListener { | ||
9 | + | ||
10 | + private String[] args; | ||
11 | + | ||
12 | + public void onFinish(ISuite arg0) { | ||
13 | + SendEmail.main(args); | ||
14 | + } | ||
15 | + | ||
16 | + public void onStart(ISuite arg0) { | ||
17 | + // TODO Auto-generated method stub | ||
18 | + } | ||
19 | + | ||
20 | +} |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +public class LogType { | ||
4 | + | ||
5 | + public LogType(){ | ||
6 | + | ||
7 | + } | ||
8 | + | ||
9 | + public enum LogTypeName{ | ||
10 | + | ||
11 | + // | ||
12 | + INFO, | ||
13 | + // | ||
14 | + ERROR, | ||
15 | + // | ||
16 | + WARNING, | ||
17 | + // | ||
18 | + DEBUG; | ||
19 | + } | ||
20 | +} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import java.io.File; | ||
4 | +import java.io.FileOutputStream; | ||
5 | +import java.io.OutputStreamWriter; | ||
6 | +import java.text.SimpleDateFormat; | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +import com.essa.framework.LogType; | ||
10 | + | ||
11 | +public class Logger { | ||
12 | + | ||
13 | + public static String OutputFileName = getDateTimeByFormat(new Date(), "yyyyMMdd"); | ||
14 | + private static OutputStreamWriter outputStreamWriter; | ||
15 | + private static String logFileName; | ||
16 | + public static boolean LogFlag = true; | ||
17 | + public static String logContent; | ||
18 | + | ||
19 | + public Logger() { | ||
20 | + | ||
21 | + } | ||
22 | + | ||
23 | + private static void WriteLog(String logEntry) { | ||
24 | + | ||
25 | + try { | ||
26 | + | ||
27 | + // 定义日志文件保存路径和日志文件名称 | ||
28 | + logFileName = ".\\Log" + "\\" + OutputFileName + ".log"; | ||
29 | + if (outputStreamWriter == null) { | ||
30 | + File logFile = new File(logFileName); | ||
31 | + | ||
32 | + if (!logFile.exists()) | ||
33 | + logFile.createNewFile(); | ||
34 | + //利用OutputStreamWriter往日志文件写内容,字符编码是unicode | ||
35 | + outputStreamWriter = new OutputStreamWriter(new FileOutputStream(logFileName), "utf-8"); | ||
36 | + } | ||
37 | + outputStreamWriter.write(logEntry, 0, logEntry.length()); | ||
38 | + | ||
39 | + outputStreamWriter.flush(); | ||
40 | + | ||
41 | + } catch (Exception e) { | ||
42 | + System.out.println(LogType.LogTypeName.ERROR.toString() + ": Failed to write the file " + logFileName); | ||
43 | + e.printStackTrace(); | ||
44 | + | ||
45 | + } | ||
46 | + | ||
47 | + } | ||
48 | + | ||
49 | + //获取当前系统时间,得到格式化时间字符串 | ||
50 | + private static String getDateTimeByFormat(Date date, String format) { | ||
51 | + | ||
52 | + SimpleDateFormat df = new SimpleDateFormat(format); | ||
53 | + | ||
54 | + return df.format(date); | ||
55 | + | ||
56 | + } | ||
57 | + | ||
58 | + public static void Output(LogType.LogTypeName logTypeName, String logMessage) { | ||
59 | + Date date = new Date(); | ||
60 | + String logTime = getDateTimeByFormat(date, "yyyy-MM-dd HH:mm:ss.SSS"); | ||
61 | + String logEntry = logTime + " " + logTypeName.name() + ": " + logMessage + "\r\n"; | ||
62 | + System.out.print(logEntry); | ||
63 | + setLog(logEntry); | ||
64 | + // 定义一个开关,为True就输出日志,如果你不想输出,改成False | ||
65 | + if (LogFlag) | ||
66 | + WriteLog(logEntry); | ||
67 | + } | ||
68 | + /** | ||
69 | + * 获取日志信息 | ||
70 | + * @return | ||
71 | + */ | ||
72 | + public static String getLog() { | ||
73 | + return logContent; | ||
74 | + } | ||
75 | + | ||
76 | + public static void setLog(String logEntry) { | ||
77 | + logContent = logEntry; | ||
78 | + } | ||
79 | +} |
@@ -0,0 +1,128 @@ | @@ -0,0 +1,128 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author Administrator | ||
5 | + *pojo对象,用于存储一些运行过程中的变量 | ||
6 | + */ | ||
7 | +public class Model { | ||
8 | + | ||
9 | + public static String skuNo;//商品编号 | ||
10 | + public static String buyerNo;//采购商编号 | ||
11 | + public static String supplierName;//供应商名称 | ||
12 | + public static String picPath;//图片路径 | ||
13 | + public static String email = "buyer"+Tools.getTime()+"@essa.cn";//采购商邮箱 | ||
14 | + public static String invateCode;//邀请码 | ||
15 | + public static String env;//所选环境 | ||
16 | + public static String buyerAccount;//采购商账号 | ||
17 | + public static String buyerPassword;//采购商密码 | ||
18 | + public static String poNum;//po单号 | ||
19 | + public static int isactivity=0;//是否是活动商品 1:是 0:否 | ||
20 | + public static String manager;//商品的类目经理 | ||
21 | + public static String serialNum;//待办流水号 | ||
22 | + | ||
23 | + | ||
24 | + public static String getSerialNum() { | ||
25 | + return serialNum; | ||
26 | + } | ||
27 | + | ||
28 | + public static void setSerialNum(String serialNum) { | ||
29 | + Model.serialNum = serialNum; | ||
30 | + } | ||
31 | + | ||
32 | + public static String getManager() { | ||
33 | + return manager; | ||
34 | + } | ||
35 | + | ||
36 | + public static void setManager(String manager) { | ||
37 | + Model.manager = manager; | ||
38 | + } | ||
39 | + | ||
40 | + public static int getIsactivity() { | ||
41 | + return isactivity; | ||
42 | + } | ||
43 | + | ||
44 | + public static void setIsactivity(int isactivity) { | ||
45 | + Model.isactivity = isactivity; | ||
46 | + } | ||
47 | + | ||
48 | + public static String getPoNum() { | ||
49 | + return poNum; | ||
50 | + } | ||
51 | + | ||
52 | + public static void setPoNum(String poNum) { | ||
53 | + Model.poNum = poNum; | ||
54 | + } | ||
55 | + | ||
56 | + public static String getBuyerAccount() { | ||
57 | + return buyerAccount; | ||
58 | + } | ||
59 | + | ||
60 | + public static void setBuyerAccount(String buyerAccount) { | ||
61 | + Model.buyerAccount = buyerAccount; | ||
62 | + } | ||
63 | + | ||
64 | + public static String getBuyerPassword() { | ||
65 | + return buyerPassword; | ||
66 | + } | ||
67 | + | ||
68 | + public static void setBuyerPassword(String buyerPassword) { | ||
69 | + Model.buyerPassword = buyerPassword; | ||
70 | + } | ||
71 | + | ||
72 | + public static String getEnv() { | ||
73 | + return env; | ||
74 | + } | ||
75 | + | ||
76 | + public static void setEnv(String env) { | ||
77 | + Model.env = env; | ||
78 | + } | ||
79 | + | ||
80 | + public static String getInvateCode() { | ||
81 | + return invateCode; | ||
82 | + } | ||
83 | + | ||
84 | + public static void setInvateCode(String invateCode) { | ||
85 | + Model.invateCode = invateCode; | ||
86 | + } | ||
87 | + | ||
88 | + public static String getEmail() { | ||
89 | + return email; | ||
90 | + } | ||
91 | + | ||
92 | + public static void setEmail(String email) { | ||
93 | + Model.email = email; | ||
94 | + } | ||
95 | + | ||
96 | + public static String getPicPath() { | ||
97 | + return picPath; | ||
98 | + } | ||
99 | + | ||
100 | + public static void setPicPath(String picPath) { | ||
101 | + Model.picPath = picPath; | ||
102 | + } | ||
103 | + | ||
104 | + public static String getSupplierName() { | ||
105 | + return supplierName; | ||
106 | + } | ||
107 | + | ||
108 | + public static void setSupplierName(String supplierName) { | ||
109 | + Model.supplierName = supplierName; | ||
110 | + } | ||
111 | + | ||
112 | + public static String getBuyerNo() { | ||
113 | + return buyerNo; | ||
114 | + } | ||
115 | + | ||
116 | + public static void setBuyerNo(String buyerNo) { | ||
117 | + Model.buyerNo = buyerNo; | ||
118 | + } | ||
119 | + | ||
120 | + public static String getSkuNo() { | ||
121 | + return skuNo; | ||
122 | + } | ||
123 | + | ||
124 | + public static void setSkuNo(String No) { | ||
125 | + skuNo = No; | ||
126 | + } | ||
127 | + | ||
128 | +} |
@@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import java.util.Properties; | ||
4 | + | ||
5 | +import javax.activation.DataHandler; | ||
6 | +import javax.activation.DataSource; | ||
7 | +import javax.activation.FileDataSource; | ||
8 | +import javax.mail.BodyPart; | ||
9 | +import javax.mail.Message; | ||
10 | +import javax.mail.MessagingException; | ||
11 | +import javax.mail.Multipart; | ||
12 | +import javax.mail.PasswordAuthentication; | ||
13 | +import javax.mail.Session; | ||
14 | +import javax.mail.Transport; | ||
15 | +import javax.mail.internet.InternetAddress; | ||
16 | +import javax.mail.internet.MimeBodyPart; | ||
17 | +import javax.mail.internet.MimeMessage; | ||
18 | +import javax.mail.internet.MimeMultipart; | ||
19 | + | ||
20 | +public class SendEmail { | ||
21 | + | ||
22 | + public static void main(String[] args) { | ||
23 | + | ||
24 | + // 创建一个Property文件对象 | ||
25 | + Properties props = new Properties(); | ||
26 | + | ||
27 | + // 设置邮件服务器的信息,这里设置smtp主机名称 | ||
28 | + props.put("mail.smtp.host", "smtp.qq.com"); | ||
29 | + | ||
30 | + // 设置socket factory 的端口 | ||
31 | + props.put("mail.smtp.socketFactory.port", "465"); | ||
32 | + | ||
33 | + // 设置socket factory | ||
34 | + props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); | ||
35 | + | ||
36 | + // 设置需要身份验证 | ||
37 | + props.put("mail.smtp.auth", "true"); | ||
38 | + | ||
39 | + // 设置SMTP的端口,QQ的smtp端口是25 | ||
40 | + props.put("mail.smtp.port", "25"); | ||
41 | + | ||
42 | + // 身份验证实现 | ||
43 | + Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { | ||
44 | + | ||
45 | + protected PasswordAuthentication getPasswordAuthentication() { | ||
46 | + // 第二个参数,就是我QQ开启smtp的授权码 | ||
47 | + return new PasswordAuthentication("278953238@qq.com", "pfpzqcamljytbjec"); | ||
48 | + | ||
49 | + } | ||
50 | + | ||
51 | + }); | ||
52 | + | ||
53 | + try { | ||
54 | + | ||
55 | + // 创建一个MimeMessage类的实例对象 | ||
56 | + Message message = new MimeMessage(session); | ||
57 | + | ||
58 | + // 设置发件人邮箱地址 | ||
59 | + message.setFrom(new InternetAddress("278953238@qq.com")); | ||
60 | + | ||
61 | + // 设置收件人邮箱地址 | ||
62 | + message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("3289714863@qq.com")); | ||
63 | + | ||
64 | + // 设置邮件主题 | ||
65 | + message.setSubject("测试发送邮件"); | ||
66 | + | ||
67 | + // 创建一个MimeBodyPart的对象,以便添加内容 | ||
68 | + BodyPart messageBodyPart1 = new MimeBodyPart(); | ||
69 | + | ||
70 | + // 设置邮件正文内容 | ||
71 | + messageBodyPart1.setText("这个是邮件的正文部分"); | ||
72 | + | ||
73 | + // 创建另外一个MimeBodyPart对象,以便添加其他内容 | ||
74 | + MimeBodyPart messageBodyPart2 = new MimeBodyPart(); | ||
75 | + | ||
76 | + // 设置邮件中附件文件的路径 | ||
77 | + String filename = ".\\test-output\\emailable-report.html"; | ||
78 | + | ||
79 | + // 创建一个datasource对象,并传递文件 | ||
80 | + DataSource source = new FileDataSource(filename); | ||
81 | + | ||
82 | + // 设置handler | ||
83 | + messageBodyPart2.setDataHandler(new DataHandler(source)); | ||
84 | + | ||
85 | + // 加载文件 | ||
86 | + messageBodyPart2.setFileName(filename); | ||
87 | + | ||
88 | + // 创建一个MimeMultipart类的实例对象 | ||
89 | + Multipart multipart = new MimeMultipart(); | ||
90 | + | ||
91 | + // 添加正文1内容 | ||
92 | + multipart.addBodyPart(messageBodyPart1); | ||
93 | + | ||
94 | + // 添加正文2内容 | ||
95 | + multipart.addBodyPart(messageBodyPart2); | ||
96 | + | ||
97 | + // 设置内容 | ||
98 | + message.setContent(multipart); | ||
99 | + | ||
100 | + // 最终发送邮件 | ||
101 | + Transport.send(message); | ||
102 | + | ||
103 | + System.out.println("=====邮件已经发送====="); | ||
104 | + | ||
105 | + } catch (MessagingException e) { | ||
106 | + | ||
107 | + throw new RuntimeException(e); | ||
108 | + | ||
109 | + } | ||
110 | + | ||
111 | + } | ||
112 | + | ||
113 | +} |
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +package com.essa.framework; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +public class Tools { | ||
7 | + | ||
8 | + /** | ||
9 | + * 获取当前时间 | ||
10 | + * @return MMdd_HHmmss | ||
11 | + */ | ||
12 | + public static String getCurrentTime() { | ||
13 | + SimpleDateFormat format = new SimpleDateFormat("MMdd_HHmmss"); | ||
14 | + Date today = new Date(); | ||
15 | + String time = format.format(today); | ||
16 | + return time; | ||
17 | + } | ||
18 | + /** | ||
19 | + * 使用当前时间作为工厂货号 | ||
20 | + * @return yyyyMMddHHmmss | ||
21 | + */ | ||
22 | + public static String getFactoryNo() { | ||
23 | + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
24 | + Date today = new Date(); | ||
25 | + String time = format.format(today); | ||
26 | + return time; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 获取当前分和秒,另外加一个随机数,作为注册邮箱的区分的数字 | ||
31 | + * @return | ||
32 | + */ | ||
33 | + public static String getTime() { | ||
34 | + SimpleDateFormat format = new SimpleDateFormat("mmss"); | ||
35 | + Date today = new Date(); | ||
36 | + String time = format.format(today); | ||
37 | + int i = (int)(1+Math.random()*(10-1+1)); | ||
38 | + return time+i; | ||
39 | + } | ||
40 | + | ||
41 | +} |
@@ -0,0 +1,69 @@ | @@ -0,0 +1,69 @@ | ||
1 | +package com.essa.pageObject; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.support.PageFactory; | ||
7 | + | ||
8 | +import com.buyer.pageObject.BuyerLoginPage; | ||
9 | +import com.buyer.pageObject.IndexPage; | ||
10 | +import com.essa.framework.BrowserEngine; | ||
11 | +import com.essa.pageObject.LoginPage; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author Administrator | ||
15 | + *测试用例的基类,主要是有登录和调用浏览器的方法 | ||
16 | + */ | ||
17 | +public class BaseTest { | ||
18 | + public WebDriver driver; | ||
19 | + | ||
20 | + public WebDriver getDriver() { | ||
21 | + return driver; | ||
22 | + } | ||
23 | + | ||
24 | + /** | ||
25 | + * bpms调用浏览器,打开要测试的网页 | ||
26 | + */ | ||
27 | + public void initsetUp() { | ||
28 | + BrowserEngine browserEngine = new BrowserEngine(); | ||
29 | + try { | ||
30 | + browserEngine.initConfigData(); | ||
31 | + } catch (IOException e) { | ||
32 | + e.printStackTrace(); | ||
33 | + } | ||
34 | + driver = browserEngine.getBrowser(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * buyer调用浏览器,将访问buyer的地址 | ||
39 | + */ | ||
40 | + public void initBuyer() { | ||
41 | + BrowserEngine browserEngine = new BrowserEngine(); | ||
42 | + try { | ||
43 | + browserEngine.initConfigData(); | ||
44 | + } catch (IOException e) { | ||
45 | + e.printStackTrace(); | ||
46 | + } | ||
47 | + driver = browserEngine.buyerGetBrowser(); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * bpms初始化登录页面,登录 | ||
52 | + * @param account | ||
53 | + */ | ||
54 | + public void loginValid(String account) { | ||
55 | + LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); | ||
56 | + loginPage.login(account, "essa123"); | ||
57 | + } | ||
58 | + /** | ||
59 | + * buyer初始化登录 | ||
60 | + * @param account | ||
61 | + */ | ||
62 | + public void loginBuyerValid(String account,String password) { | ||
63 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | ||
64 | + indexPage.toLoginPage(); | ||
65 | + BuyerLoginPage loginPage = PageFactory.initElements(driver, BuyerLoginPage.class); | ||
66 | + loginPage.login(account, password); | ||
67 | + } | ||
68 | +} | ||
69 | + |
src/main/java/com/essa/pageObject/Documentary/PODocumentaryPage.java
0 → 100644
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +package com.essa.pageObject.Documentary; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | + | ||
5 | +import com.essa.framework.BasePage; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Administrator | ||
9 | + *PO跟单页面 | ||
10 | + */ | ||
11 | +public class PODocumentaryPage extends BasePage { | ||
12 | + | ||
13 | + public PODocumentaryPage(WebDriver driver) { | ||
14 | + super(driver); | ||
15 | + } | ||
16 | + | ||
17 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AddMarketGoodsPage.java
0 → 100644
@@ -0,0 +1,510 @@ | @@ -0,0 +1,510 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | +import com.essa.framework.Tools; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author Administrator | ||
14 | + *添加市场商品页 | ||
15 | + */ | ||
16 | +public class AddMarketGoodsPage extends BasePage { | ||
17 | + public AddMarketGoodsPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + public static String skuNameNo = null; | ||
21 | + /* | ||
22 | + * 页面元素定位 | ||
23 | + */ | ||
24 | + /* | ||
25 | + * 元素定位 | ||
26 | + */ | ||
27 | + //审核人 | ||
28 | + @FindBy(xpath="//*[@ng-model='buyerInfo.auditId']") | ||
29 | + WebElement auditor; | ||
30 | + | ||
31 | + //选择供应商 | ||
32 | + @FindBy (xpath="//*[@ng-click='supplier()']") | ||
33 | + WebElement selectSupplier; | ||
34 | + | ||
35 | + //供应商查询方式选择 | ||
36 | + @FindBy (xpath="//*[@ng-click='showSelect()']") | ||
37 | + WebElement showSelect; | ||
38 | + | ||
39 | + //供应商名称查询 | ||
40 | + @FindBy (xpath="//*[contains(@ng-click,'keywordTypeChecked(item)') and @value='name']/..") | ||
41 | + WebElement queryByName; | ||
42 | + | ||
43 | + //查询输入框 | ||
44 | + @FindBy (xpath="//*[@ng-keyup='keyupChecked()']") | ||
45 | + WebElement queryKeyword; | ||
46 | + | ||
47 | + //供应商查询按钮 | ||
48 | + @FindBy (xpath="//*[@ng-click='search()']") | ||
49 | + WebElement search; | ||
50 | + | ||
51 | + //查询的第一个结果 | ||
52 | + @FindBy (xpath="//*[@id='spTableParams']/tbody/tr[1]") | ||
53 | + WebElement firstRestult; | ||
54 | + | ||
55 | + //供应商选择【确定】 | ||
56 | + @FindBy (xpath="//*[text()='确定']") | ||
57 | + WebElement sureBotton; | ||
58 | + | ||
59 | + //品牌名称选框 | ||
60 | + @FindBy (xpath="//*[text()='品牌名称']/../div[2]/div/div") | ||
61 | + WebElement brandName; | ||
62 | + | ||
63 | + //品牌选项-第一个品牌 | ||
64 | + @FindBy (xpath="//*[@class='msgLayer']/li[1]") | ||
65 | + WebElement firstBrand; | ||
66 | + | ||
67 | + //品牌【确定】 | ||
68 | + //与供应商选择的确定按钮元素一样,可直接使用 | ||
69 | + | ||
70 | + //选择类目 | ||
71 | + @FindBy(xpath="//*[text()='主类目']/../../div[1]/div") | ||
72 | + WebElement selectCategory; | ||
73 | + | ||
74 | + //玩具类目一级类目 | ||
75 | + @FindBy (xpath="//*[@id='undefined_1_switch']") | ||
76 | + WebElement oneLevel; | ||
77 | + | ||
78 | + //动植物二级类目 | ||
79 | + @FindBy (xpath="//*[@id='undefined_7_switch']") | ||
80 | + WebElement twoLevel; | ||
81 | + | ||
82 | + //飞行鸟类三级类目 | ||
83 | + @FindBy (xpath="//*[text()='飞行鸟类']") | ||
84 | + WebElement threeLevel; | ||
85 | + | ||
86 | + //[主类目]选择 | ||
87 | + @FindBy (xpath="//*[contains(@class,'btn btn-success')]") | ||
88 | + WebElement mainCategory; | ||
89 | + | ||
90 | + | ||
91 | + /* | ||
92 | + * 商品属性 | ||
93 | + */ | ||
94 | + //商品属性-功能:第二个-遥控 | ||
95 | + @FindBy (xpath="//*[text()='功能']/../div[2]/div[2]") | ||
96 | + WebElement secondFunction; | ||
97 | + | ||
98 | + //商品属性-特殊功能:第二个-声控 | ||
99 | + @FindBy (xpath="//*[text()='特殊功能']/../div[2]/div[2]") | ||
100 | + WebElement secondSpcialFunction; | ||
101 | + | ||
102 | + //商品属性-外观造型:第一个-仿真 | ||
103 | + @FindBy (xpath="//*[text()='外观造型']/../div[2]/div[1]") | ||
104 | + WebElement skin; | ||
105 | + | ||
106 | + //商品属性-是否带人 | ||
107 | + @FindBy (xpath="//*[text()='是否带人']/../div[2]/div[1]") | ||
108 | + WebElement withPerson; | ||
109 | + | ||
110 | + //商品属性-适用年龄:第三个-6-18个月 | ||
111 | + @FindBy (xpath="//*[text()='适用年龄']/../div[2]/div[3]") | ||
112 | + WebElement forAge; | ||
113 | + | ||
114 | + /* | ||
115 | + * 商品信息 | ||
116 | + */ | ||
117 | + | ||
118 | + //品名选择 | ||
119 | + @FindBy (xpath="//*[text()='品名']/../div[2]/div") | ||
120 | + WebElement selectLanguage; | ||
121 | + | ||
122 | + //品名语言-英语 | ||
123 | + @FindBy (xpath="//*[@class='msg2']/ul[1]/li[2]") | ||
124 | + WebElement english; | ||
125 | + | ||
126 | + //品名输入框 | ||
127 | + @FindBy (xpath="//*[text()='品名']/../div[3]/div/input") | ||
128 | + WebElement goodsName; | ||
129 | + | ||
130 | + //工厂货号输入框 | ||
131 | + @FindBy (xpath="//*[@ng-model='model.factoryNo']") | ||
132 | + WebElement factoryNo; | ||
133 | + | ||
134 | + //包装语言 | ||
135 | + @FindBy (xpath = "//*[@dic-list='包装语言']/div[1]") | ||
136 | + WebElement packageLanguage; | ||
137 | + | ||
138 | + //自有版权 | ||
139 | + @FindBy (xpath="//*[text()='自有版权']") | ||
140 | + WebElement ownCopyright; | ||
141 | + | ||
142 | + //第三方版权 | ||
143 | + @FindBy (xpath="//*[text()='第三方版权']") | ||
144 | + WebElement thirdCopyright; | ||
145 | + | ||
146 | + //无授权 | ||
147 | + @FindBy (xpath="//*[text()='无版权']") | ||
148 | + WebElement noCopyright; | ||
149 | + | ||
150 | + //A货 | ||
151 | + @FindBy (xpath="//*[text()='A货']") | ||
152 | + WebElement AGoods; | ||
153 | + | ||
154 | + //新品保护期 -第三个:7天 | ||
155 | + @FindBy (xpath="//*[@dic-list='新品保护期']/div[3]") | ||
156 | + WebElement sevenDays; | ||
157 | + | ||
158 | + /* | ||
159 | + * 商品规格 | ||
160 | + */ | ||
161 | + | ||
162 | + //计量单位-第一个:只 | ||
163 | + @FindBy (xpath="//*[@dic-list='计量单位']/div[1]") | ||
164 | + WebElement countUnit; | ||
165 | + | ||
166 | + //外箱 | ||
167 | + @FindBy (xpath="//*[text()='外箱']") | ||
168 | + WebElement outBox; | ||
169 | + | ||
170 | + //遥控模式 | ||
171 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']") | ||
172 | + WebElement remoteMode; | ||
173 | + | ||
174 | + //遥控模式:无线电 | ||
175 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']/../../div[3]/div/span[1]") | ||
176 | + WebElement remoteMode2; | ||
177 | + | ||
178 | + //通道 | ||
179 | + @FindBy (xpath="//*[@placeholder='请选择通道']") | ||
180 | + WebElement thoroughfare; | ||
181 | + | ||
182 | + //通道:2通 | ||
183 | + @FindBy (xpath="//*[@placeholder='请选择通道']/../../div[3]/div/span[1]") | ||
184 | + WebElement thoroughfare2; | ||
185 | + | ||
186 | + //常规功能 | ||
187 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']") | ||
188 | + WebElement normalFunction; | ||
189 | + | ||
190 | + //常规功能:灯光 | ||
191 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']/../../div[3]/div/span[2]") | ||
192 | + WebElement normalFunction2; | ||
193 | + | ||
194 | + //是否包电 | ||
195 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']") | ||
196 | + WebElement isBattery; | ||
197 | + | ||
198 | + //是否包电:包电 | ||
199 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']/../../div[3]/div/span[2]") | ||
200 | + WebElement isBattery2; | ||
201 | + | ||
202 | + //是否可充电 | ||
203 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']") | ||
204 | + WebElement isCharge; | ||
205 | + | ||
206 | + //是否可充电:可充电 | ||
207 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']/../../div[3]/div/span[1]") | ||
208 | + WebElement isCharge2; | ||
209 | + | ||
210 | + //配件 | ||
211 | + @FindBy (xpath="//*[@placeholder='请选择配件']") | ||
212 | + WebElement parts; | ||
213 | + | ||
214 | + //配件:无 | ||
215 | + @FindBy (xpath="//*[@placeholder='请选择配件']/../../div[3]/div/span[1]") | ||
216 | + WebElement parts2; | ||
217 | + | ||
218 | + //包装图案 | ||
219 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']") | ||
220 | + WebElement pattern; | ||
221 | + | ||
222 | + //包装图案:无 | ||
223 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']/../../div[3]/div/span[1]") | ||
224 | + WebElement pattern2; | ||
225 | + | ||
226 | + //单品或套装 | ||
227 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']") | ||
228 | + WebElement suit; | ||
229 | + | ||
230 | + //单品或套装:单品 | ||
231 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']/../../div[3]/div/span[1]") | ||
232 | + WebElement suit2; | ||
233 | + | ||
234 | + //局部工艺 | ||
235 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']") | ||
236 | + WebElement localProcess; | ||
237 | + | ||
238 | + //局部工艺:无 | ||
239 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']/../../div[3]/div/span[1]") | ||
240 | + WebElement localProcess2; | ||
241 | + | ||
242 | + //颜色 | ||
243 | + @FindBy (xpath="//*[@placeholder='请选择颜色']") | ||
244 | + WebElement color; | ||
245 | + | ||
246 | + //颜色 | ||
247 | + @FindBy (xpath="//*[@placeholder='请选择颜色']/../../div[3]/div/span[1]") | ||
248 | + WebElement color2; | ||
249 | + | ||
250 | + //装量 | ||
251 | + @FindBy (xpath="//*[@placeholder='请选择装量']") | ||
252 | + WebElement count; | ||
253 | + | ||
254 | + //装量:1 | ||
255 | + @FindBy (xpath="//*[@placeholder='请选择装量']/../../div[3]/div/span[2]") | ||
256 | + WebElement count2; | ||
257 | + | ||
258 | + //包装类型 | ||
259 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']") | ||
260 | + WebElement packingType; | ||
261 | + | ||
262 | + //包装类型:OPP袋 | ||
263 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']/../../div[3]/div/span[1]") | ||
264 | + WebElement packingType2; | ||
265 | + | ||
266 | + //包装方式 | ||
267 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']") | ||
268 | + WebElement packingWay; | ||
269 | + | ||
270 | + //包装方式:OPP袋 | ||
271 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']/../../div[3]/div/span[1]") | ||
272 | + WebElement packingWay2; | ||
273 | + | ||
274 | + //“+”sku按钮 | ||
275 | + @FindBy (xpath="//*[@class='addSku']") | ||
276 | + WebElement addSku; | ||
277 | + | ||
278 | + //计数数量 | ||
279 | + @FindBy (xpath="//*[@title='计数数量']/div/input") | ||
280 | + WebElement skuItemCount; | ||
281 | + | ||
282 | + //销售MOQ | ||
283 | + @FindBy (xpath="//*[@title='销售MOQ']/div/input") | ||
284 | + WebElement saleMOQ; | ||
285 | + | ||
286 | + //供货周期 | ||
287 | + @FindBy (xpath="//*[@title='供货周期']/div/input") | ||
288 | + WebElement supplyTime; | ||
289 | + | ||
290 | + //供应商报价 | ||
291 | + @FindBy (xpath="//*[@placeholder='单品价格']") | ||
292 | + WebElement suppliPrice; | ||
293 | + | ||
294 | + //横向滚动条1 | ||
295 | + @FindBy (xpath="//*[@id='customScroll']") | ||
296 | + WebElement widthScroll1; | ||
297 | + | ||
298 | +// //横向滚动条2,滚动条与内容一起,无法拖动 | ||
299 | +// @FindBy (xpath="//*[contains(@id,'table-single-goods-sku')]/..") | ||
300 | +// WebElement widthScroll2; | ||
301 | + | ||
302 | + //外箱体积-长 | ||
303 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[2]/input") | ||
304 | + WebElement packageLong; | ||
305 | + | ||
306 | + //外箱体积-宽 | ||
307 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[3]/input") | ||
308 | + WebElement packageWidth; | ||
309 | + | ||
310 | + //外箱体积-高 | ||
311 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[4]/input") | ||
312 | + WebElement packageHigh; | ||
313 | + | ||
314 | + //毛重 | ||
315 | + @FindBy (xpath="//*[@title='毛重']/div/input") | ||
316 | + WebElement grossWeight; | ||
317 | + | ||
318 | + //净重 | ||
319 | + @FindBy (xpath="//*[@title='净重']/div/input") | ||
320 | + WebElement netWeight; | ||
321 | + | ||
322 | + //上传图片 | ||
323 | + @FindBy (xpath="//*[contains(@handler-obj,'skuPicsHandler')]") | ||
324 | + WebElement updatePic; | ||
325 | + | ||
326 | + //图片上传成功验证 | ||
327 | + @FindBy (xpath="//*[contains(@ng-click,'deleteInfo')]") | ||
328 | + WebElement isUpudate; | ||
329 | + | ||
330 | + //提交审核 | ||
331 | + @FindBy (xpath="//*[text()='提交审核']") | ||
332 | + WebElement submit; | ||
333 | + | ||
334 | + //提交审核后弹窗--确定按钮 | ||
335 | + @FindBy(xpath="//*[text()='确定']") | ||
336 | + WebElement confirm; | ||
337 | + | ||
338 | + //提交审核后弹窗--商品编号 | ||
339 | + @FindBy (xpath="//*[@ng-bind='item.no']") | ||
340 | + WebElement skuNo; | ||
341 | + | ||
342 | + /* | ||
343 | + * 页面方法 | ||
344 | + */ | ||
345 | + /** | ||
346 | + * 选择供应商 | ||
347 | + * @param 供应商名称 | ||
348 | + * @throws InterruptedException | ||
349 | + */ | ||
350 | + public void selectSupplier(){ | ||
351 | + dynamicWait(By.xpath("//*[@ng-click='supplier()']")); | ||
352 | + selectElement(auditor, "邢昌勇"); | ||
353 | + click(selectSupplier); | ||
354 | + click(showSelect); | ||
355 | + click(queryByName); | ||
356 | + sendKeys(queryKeyword,Model.getSupplierName()); | ||
357 | + click(search); | ||
358 | + forceWait(1000); | ||
359 | + mywait(firstRestult); | ||
360 | + click(firstRestult); | ||
361 | + click(sureBotton); | ||
362 | + } | ||
363 | + /** | ||
364 | + * 选择品牌 | ||
365 | + */ | ||
366 | + public void selectBrand() { | ||
367 | + forceWait(1000); | ||
368 | + click(brandName); | ||
369 | + mywait(firstBrand); | ||
370 | + click(firstBrand); | ||
371 | + click(sureBotton); | ||
372 | + } | ||
373 | + /** | ||
374 | + * 选择主类目 | ||
375 | + * 注意:这里只能用js点击事件才能展开那个“+” | ||
376 | + * @throws InterruptedException | ||
377 | + */ | ||
378 | + public void selectCategory(){ | ||
379 | + forceWait(1000); | ||
380 | + mywait(selectCategory); | ||
381 | + click(selectCategory); | ||
382 | + jsExecutorClick(oneLevel); | ||
383 | + jsExecutorClick(twoLevel); | ||
384 | + jsExecutorClick(threeLevel); | ||
385 | + jsExecutorClick(mainCategory); | ||
386 | + click(sureBotton); | ||
387 | + } | ||
388 | + /** | ||
389 | + * 配置商品属性 | ||
390 | + */ | ||
391 | + public void goodsProperty() { | ||
392 | + mywait(secondFunction); | ||
393 | + click(secondFunction); | ||
394 | + click(secondSpcialFunction); | ||
395 | + click(skin); | ||
396 | + click(withPerson); | ||
397 | + click(forAge); | ||
398 | + } | ||
399 | + /** | ||
400 | + * 配置商品信息 | ||
401 | + */ | ||
402 | + public void goodsInfo() { | ||
403 | + skuNameNo = Tools.getCurrentTime(); | ||
404 | + //挪动滚动条,否则查找不到元素 | ||
405 | + moveHeightScroll("40"); | ||
406 | + sendKeys(goodsName, "市场"+skuNameNo); | ||
407 | + click(selectLanguage); | ||
408 | + click(english); | ||
409 | + sendKeys(goodsName, "Market"+skuNameNo); | ||
410 | + sendKeys(factoryNo, Tools.getFactoryNo()); | ||
411 | + click(packageLanguage); | ||
412 | + click(ownCopyright); | ||
413 | + click(sevenDays); | ||
414 | + } | ||
415 | + /** | ||
416 | + * 选择sku属性,并提交 | ||
417 | + * @return 商品发布页 | ||
418 | + */ | ||
419 | + public void goodsSpecifications() { | ||
420 | + moveHeightScroll("65"); | ||
421 | + click(countUnit); | ||
422 | + click(outBox); | ||
423 | + click(remoteMode); | ||
424 | + click(remoteMode2); | ||
425 | + click(thoroughfare); | ||
426 | + click(thoroughfare2); | ||
427 | + click(normalFunction); | ||
428 | + click(normalFunction2); | ||
429 | + click(isBattery); | ||
430 | + click(isBattery2); | ||
431 | + click(isCharge); | ||
432 | + click(isCharge2); | ||
433 | + click(parts); | ||
434 | + click(parts2); | ||
435 | + click(pattern); | ||
436 | + click(pattern2); | ||
437 | + click(suit); | ||
438 | + click(suit2); | ||
439 | + click(localProcess); | ||
440 | + click(localProcess2); | ||
441 | + click(color); | ||
442 | + click(color2); | ||
443 | + click(count); | ||
444 | + click(count2); | ||
445 | + click(packingType); | ||
446 | + click(packingType2); | ||
447 | + click(packingWay); | ||
448 | + click(packingWay2); | ||
449 | + click(addSku); | ||
450 | + | ||
451 | + sendKeys(skuItemCount, "10"); | ||
452 | + sendKeys(saleMOQ, "10"); | ||
453 | + sendKeys(supplyTime, "3"); | ||
454 | + | ||
455 | + //供应商报价,随机生成一个1-200的价格 | ||
456 | + int sp = (int)(1+Math.random()*200); | ||
457 | + sendKeys(suppliPrice, sp+""); | ||
458 | + | ||
459 | + jsExecutorDragAndDrop(widthScroll1,2000,0); | ||
460 | + mywait(packageLong); | ||
461 | + | ||
462 | + //外箱体积 | ||
463 | + sendKeys(packageLong, "100"); | ||
464 | + sendKeys(packageWidth, "50"); | ||
465 | + sendKeys(packageHigh, "40"); | ||
466 | + //毛重,净重 | ||
467 | + sendKeys(grossWeight, "1.5"); | ||
468 | + sendKeys(netWeight, "1.2"); | ||
469 | + } | ||
470 | + | ||
471 | + /** | ||
472 | + * 上传sku图片并提交审核,确认弹框 | ||
473 | + */ | ||
474 | + public void updatePic() { | ||
475 | + click(updatePic); | ||
476 | + uploadFile(Model.getPicPath()); | ||
477 | + /*while(!isElementExist(isUpudate)) { | ||
478 | + forceWait(1000); | ||
479 | + }*/ | ||
480 | + dynamicWait(By.xpath("//*[contains(@ng-click,'deleteInfo')]")); | ||
481 | + forceWait(1000); | ||
482 | + click(submit); | ||
483 | + forceWait(1000); | ||
484 | + mywait(confirm); | ||
485 | + setSkuNo(); | ||
486 | + click(confirm); | ||
487 | + } | ||
488 | + | ||
489 | + /** | ||
490 | + * 市场商品建档,将上面的方法整合 | ||
491 | + * @return MarketGoodsRelesePage | ||
492 | + */ | ||
493 | + public MarketGoodsRelesePage addMarketGoods() { | ||
494 | + selectSupplier(); | ||
495 | + selectBrand(); | ||
496 | + selectCategory(); | ||
497 | + goodsProperty(); | ||
498 | + goodsInfo(); | ||
499 | + goodsSpecifications(); | ||
500 | + updatePic(); | ||
501 | + return new MarketGoodsRelesePage(driver); | ||
502 | + } | ||
503 | + | ||
504 | + /** | ||
505 | + * 将商品编号写进model | ||
506 | + */ | ||
507 | + public void setSkuNo() { | ||
508 | + Model.setSkuNo(skuNo.getText()); | ||
509 | + } | ||
510 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AddOriginalGoodsPage.java
0 → 100644
@@ -0,0 +1,505 @@ | @@ -0,0 +1,505 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Tools; | ||
10 | + | ||
11 | +/** | ||
12 | + * 新增原厂商品页面 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class AddOriginalGoodsPage extends BasePage { | ||
17 | + public AddOriginalGoodsPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + | ||
21 | + public static String skuNameNo = null; | ||
22 | + public static String supplierName ; | ||
23 | + | ||
24 | + /* | ||
25 | + * 元素定位 | ||
26 | + */ | ||
27 | + | ||
28 | + //选择供应商 | ||
29 | + @FindBy (xpath="//*[@ng-click='supplier()']") | ||
30 | + WebElement selectSupplier; | ||
31 | + | ||
32 | + //供应商查询方式选择 | ||
33 | + @FindBy (xpath="//*[@ng-click='showSelect()']") | ||
34 | + WebElement showSelect; | ||
35 | + | ||
36 | + //供应商名称查询 | ||
37 | + @FindBy (xpath="//*[contains(@ng-click,'keywordTypeChecked(item)') and @value='name']/..") | ||
38 | +// @FindBy (xpath="//*[@ng-click='showSelect()']/../ul[1]") | ||
39 | + WebElement queryByName; | ||
40 | + | ||
41 | + //查询输入框 | ||
42 | + @FindBy (xpath="//*[@ng-keyup='keyupChecked()']") | ||
43 | + WebElement queryKeyword; | ||
44 | + | ||
45 | + //供应商查询按钮 | ||
46 | + @FindBy (xpath="//*[@ng-click='search()']") | ||
47 | + WebElement search; | ||
48 | + | ||
49 | + //查询的第一个结果 | ||
50 | + @FindBy (xpath="//*[@id='spTableParams']/tbody/tr[1]") | ||
51 | + WebElement firstRestult; | ||
52 | + | ||
53 | + //供应商选择【确定】 | ||
54 | + @FindBy (xpath="//*[text()='确定']") | ||
55 | + WebElement sureBotton; | ||
56 | + | ||
57 | + //品牌名称选框 | ||
58 | + @FindBy (xpath="//*[text()='品牌名称']/../div[2]/div/div") | ||
59 | + WebElement brandName; | ||
60 | + | ||
61 | + //品牌选项-第一个品牌 | ||
62 | + @FindBy (xpath="//*[@class='msgLayer']/li[1]") | ||
63 | + WebElement firstBrand; | ||
64 | + | ||
65 | + //品牌【确定】 | ||
66 | + //与供应商选择的确定按钮元素一样,可直接使用 | ||
67 | + | ||
68 | + //选择类目 | ||
69 | + @FindBy(xpath="//*[text()='主类目']/../../div[1]/div") | ||
70 | + WebElement selectCategory; | ||
71 | + | ||
72 | + //玩具类目一级类目 | ||
73 | + @FindBy (xpath="//*[@id='undefined_1_switch']") | ||
74 | + WebElement oneLevel; | ||
75 | + | ||
76 | + //动植物二级类目 | ||
77 | + @FindBy (xpath="//*[@id='undefined_7_switch']") | ||
78 | + WebElement twoLevel; | ||
79 | + | ||
80 | + //飞行鸟类三级类目 | ||
81 | + @FindBy (xpath="//*[text()='飞行鸟类']") | ||
82 | + WebElement threeLevel; | ||
83 | + | ||
84 | + //[主类目]选择 | ||
85 | + @FindBy (xpath="//*[contains(@class,'btn btn-success')]") | ||
86 | + WebElement mainCategory; | ||
87 | + | ||
88 | + | ||
89 | + /* | ||
90 | + * 商品属性 | ||
91 | + */ | ||
92 | + //商品属性-功能:第二个-遥控 | ||
93 | + @FindBy (xpath="//*[text()='功能']/../div[2]/div[2]") | ||
94 | + WebElement secondFunction; | ||
95 | + | ||
96 | + //商品属性-特殊功能:第二个-声控 | ||
97 | + @FindBy (xpath="//*[text()='特殊功能']/../div[2]/div[2]") | ||
98 | + WebElement secondSpcialFunction; | ||
99 | + | ||
100 | + //商品属性-外观造型:第一个-仿真 | ||
101 | + @FindBy (xpath="//*[text()='外观造型']/../div[2]/div[1]") | ||
102 | + WebElement skin; | ||
103 | + | ||
104 | + //商品属性-是否带人 | ||
105 | + @FindBy (xpath="//*[text()='是否带人']/../div[2]/div[1]") | ||
106 | + WebElement withPerson; | ||
107 | + | ||
108 | + //商品属性-适用年龄:第三个-6-18个月 | ||
109 | + @FindBy (xpath="//*[text()='适用年龄']/../div[2]/div[3]") | ||
110 | + WebElement forAge; | ||
111 | + | ||
112 | + /* | ||
113 | + * 商品信息 | ||
114 | + */ | ||
115 | + | ||
116 | + //品名选择 | ||
117 | + @FindBy (xpath="//*[text()='品名']/../div[2]/div") | ||
118 | + WebElement selectLanguage; | ||
119 | + | ||
120 | + //品名语言-英语 | ||
121 | + @FindBy (xpath="//*[@class='msg2']/ul[1]/li[2]") | ||
122 | + WebElement english; | ||
123 | + | ||
124 | + //品名输入框 | ||
125 | + @FindBy (xpath="//*[text()='品名']/../div[3]/div/input") | ||
126 | + WebElement goodsName; | ||
127 | + | ||
128 | + //工厂货号输入框 | ||
129 | + @FindBy (xpath="//*[@ng-model='model.factoryNo']") | ||
130 | + WebElement factoryNo; | ||
131 | + | ||
132 | + //包装语言 | ||
133 | + @FindBy (xpath = "//*[@dic-list='包装语言']/div[1]") | ||
134 | + WebElement packageLanguage; | ||
135 | + | ||
136 | + //自有版权 | ||
137 | + @FindBy (xpath="//*[text()='自有版权']") | ||
138 | + WebElement ownCopyright; | ||
139 | + | ||
140 | + //第三方版权 | ||
141 | + @FindBy (xpath="//*[text()='第三方版权']") | ||
142 | + WebElement thirdCopyright; | ||
143 | + | ||
144 | + //无授权 | ||
145 | + @FindBy (xpath="//*[text()='无版权']") | ||
146 | + WebElement noCopyright; | ||
147 | + | ||
148 | + //A货 | ||
149 | + @FindBy (xpath="//*[text()='A货']") | ||
150 | + WebElement AGoods; | ||
151 | + | ||
152 | + //新品保护期 -第三个:7天 | ||
153 | + @FindBy (xpath="//*[@dic-list='新品保护期']/div[3]") | ||
154 | + WebElement sevenDays; | ||
155 | + | ||
156 | + /* | ||
157 | + * 商品规格 | ||
158 | + */ | ||
159 | + | ||
160 | + //计量单位-第一个:只 | ||
161 | + @FindBy (xpath="//*[@dic-list='计量单位']/div[1]") | ||
162 | + WebElement countUnit; | ||
163 | + | ||
164 | + //外箱 | ||
165 | + @FindBy (xpath="//*[text()='外箱']") | ||
166 | + WebElement outBox; | ||
167 | + | ||
168 | + //遥控模式 | ||
169 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']") | ||
170 | + WebElement remoteMode; | ||
171 | + | ||
172 | + //遥控模式:无线电 | ||
173 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']/../../div[3]/div/span[1]") | ||
174 | + WebElement remoteMode2; | ||
175 | + | ||
176 | + //通道 | ||
177 | + @FindBy (xpath="//*[@placeholder='请选择通道']") | ||
178 | + WebElement thoroughfare; | ||
179 | + | ||
180 | + //通道:2通 | ||
181 | + @FindBy (xpath="//*[@placeholder='请选择通道']/../../div[3]/div/span[1]") | ||
182 | + WebElement thoroughfare2; | ||
183 | + | ||
184 | + //常规功能 | ||
185 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']") | ||
186 | + WebElement normalFunction; | ||
187 | + | ||
188 | + //常规功能:灯光 | ||
189 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']/../../div[3]/div/span[2]") | ||
190 | + WebElement normalFunction2; | ||
191 | + | ||
192 | + //是否包电 | ||
193 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']") | ||
194 | + WebElement isBattery; | ||
195 | + | ||
196 | + //是否包电:包电 | ||
197 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']/../../div[3]/div/span[2]") | ||
198 | + WebElement isBattery2; | ||
199 | + | ||
200 | + //是否可充电 | ||
201 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']") | ||
202 | + WebElement isCharge; | ||
203 | + | ||
204 | + //是否可充电:可充电 | ||
205 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']/../../div[3]/div/span[1]") | ||
206 | + WebElement isCharge2; | ||
207 | + | ||
208 | + //配件 | ||
209 | + @FindBy (xpath="//*[@placeholder='请选择配件']") | ||
210 | + WebElement parts; | ||
211 | + | ||
212 | + //配件:无 | ||
213 | + @FindBy (xpath="//*[@placeholder='请选择配件']/../../div[3]/div/span[1]") | ||
214 | + WebElement parts2; | ||
215 | + | ||
216 | + //包装图案 | ||
217 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']") | ||
218 | + WebElement pattern; | ||
219 | + | ||
220 | + //包装图案:无 | ||
221 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']/../../div[3]/div/span[1]") | ||
222 | + WebElement pattern2; | ||
223 | + | ||
224 | + //单品或套装 | ||
225 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']") | ||
226 | + WebElement suit; | ||
227 | + | ||
228 | + //单品或套装:单品 | ||
229 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']/../../div[3]/div/span[1]") | ||
230 | + WebElement suit2; | ||
231 | + | ||
232 | + //局部工艺 | ||
233 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']") | ||
234 | + WebElement localProcess; | ||
235 | + | ||
236 | + //局部工艺:无 | ||
237 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']/../../div[3]/div/span[1]") | ||
238 | + WebElement localProcess2; | ||
239 | + | ||
240 | + //颜色 | ||
241 | + @FindBy (xpath="//*[@placeholder='请选择颜色']") | ||
242 | + WebElement color; | ||
243 | + | ||
244 | + //颜色 | ||
245 | + @FindBy (xpath="//*[@placeholder='请选择颜色']/../../div[3]/div/span[1]") | ||
246 | + WebElement color2; | ||
247 | + | ||
248 | + //装量 | ||
249 | + @FindBy (xpath="//*[@placeholder='请选择装量']") | ||
250 | + WebElement count; | ||
251 | + | ||
252 | + //装量:9 装量的具体值 | ||
253 | + @FindBy (xpath="//*[@placeholder='请选择装量']/../../div[3]/div/span[2]") | ||
254 | + WebElement count2; | ||
255 | + | ||
256 | + //包装类型 | ||
257 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']") | ||
258 | + WebElement packingType; | ||
259 | + | ||
260 | + //包装类型:OPP袋 | ||
261 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']/../../div[3]/div/span[1]") | ||
262 | + WebElement packingType2; | ||
263 | + | ||
264 | + //包装方式 | ||
265 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']") | ||
266 | + WebElement packingWay; | ||
267 | + | ||
268 | + //包装方式:OPP袋 | ||
269 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']/../../div[3]/div/span[1]") | ||
270 | + WebElement packingWay2; | ||
271 | + | ||
272 | + //“+”sku按钮 | ||
273 | + @FindBy (xpath="//*[@class='addSku']") | ||
274 | + WebElement addSku; | ||
275 | + | ||
276 | + //计数数量 | ||
277 | + @FindBy (xpath="//*[@title='计数数量']/div/input") | ||
278 | + WebElement skuItemCount; | ||
279 | + | ||
280 | + //销售MOQ | ||
281 | + @FindBy (xpath="//*[@title='销售MOQ']/div/input") | ||
282 | + WebElement saleMOQ; | ||
283 | + | ||
284 | + //供货周期 | ||
285 | + @FindBy (xpath="//*[@title='供货周期']/div/input") | ||
286 | + WebElement supplyTime; | ||
287 | + | ||
288 | + //供应商报价 | ||
289 | + @FindBy (xpath="//*[@placeholder='单品价格']") | ||
290 | + WebElement suppliPrice; | ||
291 | + | ||
292 | + //横向滚动条1 | ||
293 | + @FindBy (xpath="//*[@id='customScroll']") | ||
294 | + WebElement widthScroll1; | ||
295 | + | ||
296 | +// //横向滚动条2,滚动条与内容一起,无法拖动 | ||
297 | +// @FindBy (xpath="//*[contains(@id,'table-single-goods-sku')]/..") | ||
298 | +// WebElement widthScroll2; | ||
299 | + | ||
300 | + //外箱体积-长 | ||
301 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[2]/input") | ||
302 | + WebElement packageLong; | ||
303 | + | ||
304 | + //外箱体积-宽 | ||
305 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[3]/input") | ||
306 | + WebElement packageWidth; | ||
307 | + | ||
308 | + //外箱体积-高 | ||
309 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[4]/input") | ||
310 | + WebElement packageHigh; | ||
311 | + | ||
312 | + //毛重 | ||
313 | + @FindBy (xpath="//*[@title='毛重']/div/input") | ||
314 | + WebElement grossWeight; | ||
315 | + | ||
316 | + //净重 | ||
317 | + @FindBy (xpath="//*[@title='净重']/div/input") | ||
318 | + WebElement netWeight; | ||
319 | + | ||
320 | + //保存 | ||
321 | + @FindBy (xpath="//*[text()='保存']") | ||
322 | + WebElement save; | ||
323 | + | ||
324 | + //提示 | ||
325 | + @FindBy(xpath="//*[text()='原厂商品保存成功']") | ||
326 | + WebElement succeedMessage; | ||
327 | + | ||
328 | + /* | ||
329 | + * 以下为页面方法 | ||
330 | + */ | ||
331 | + | ||
332 | + /** | ||
333 | + * 选择供应商 | ||
334 | + * @param 供应商名称 | ||
335 | + * @throws InterruptedException | ||
336 | + */ | ||
337 | + public void selectSupplier(String supplierName){ | ||
338 | + forceWait(2000); | ||
339 | + dynamicWait(By.xpath("//*[@ng-click='supplier()']")); | ||
340 | + click(selectSupplier); | ||
341 | + click(showSelect); | ||
342 | + click(queryByName); | ||
343 | + sendKeys(queryKeyword,supplierName); | ||
344 | + click(search); | ||
345 | + forceWait(1000); | ||
346 | + dynamicWait(By.xpath("//*[@id='spTableParams']/tbody/tr[1]")); | ||
347 | + click(firstRestult); | ||
348 | + click(sureBotton); | ||
349 | + } | ||
350 | + | ||
351 | + /** | ||
352 | + * 选择品牌 | ||
353 | + */ | ||
354 | + public void selectBrand() { | ||
355 | + forceWait(1000); | ||
356 | + click(brandName); | ||
357 | + dynamicWait(By.xpath("//*[@class='msgLayer']/li[1]")); | ||
358 | + click(firstBrand); | ||
359 | + click(sureBotton); | ||
360 | + } | ||
361 | + | ||
362 | + /** | ||
363 | + * 选择主类目 | ||
364 | + * 注意:这里只能用js点击事件才能展开那个“+” | ||
365 | + * @throws InterruptedException | ||
366 | + */ | ||
367 | + public void selectCategory(){ | ||
368 | + forceWait(1000); | ||
369 | + mywait(selectCategory); | ||
370 | + click(selectCategory); | ||
371 | + jsExecutorClick(oneLevel); | ||
372 | + jsExecutorClick(twoLevel); | ||
373 | + jsExecutorClick(threeLevel); | ||
374 | + jsExecutorClick(mainCategory); | ||
375 | + click(sureBotton); | ||
376 | + } | ||
377 | + | ||
378 | + /** | ||
379 | + * 配置商品属性 | ||
380 | + */ | ||
381 | + public void goodsProperty() { | ||
382 | + mywait(secondFunction); | ||
383 | + click(secondFunction); | ||
384 | + click(secondSpcialFunction); | ||
385 | + click(skin); | ||
386 | + click(withPerson); | ||
387 | + click(forAge); | ||
388 | + } | ||
389 | + | ||
390 | + /** | ||
391 | + * 配置商品信息 | ||
392 | + */ | ||
393 | + public void goodsInfo() { | ||
394 | + skuNameNo = Tools.getCurrentTime(); | ||
395 | + //挪动滚动条,否则查找不到元素 | ||
396 | + moveHeightScroll("40"); | ||
397 | + sendKeys(goodsName, "原厂"+skuNameNo); | ||
398 | + click(selectLanguage); | ||
399 | + click(english); | ||
400 | + sendKeys(goodsName, "Original"+skuNameNo); | ||
401 | + sendKeys(factoryNo, Tools.getFactoryNo()); | ||
402 | + click(packageLanguage); | ||
403 | + click(ownCopyright); | ||
404 | + click(sevenDays); | ||
405 | + } | ||
406 | + | ||
407 | + /** | ||
408 | + * 选择sku属性,并提交 | ||
409 | + * @return 商品发布页 | ||
410 | + */ | ||
411 | + public GoodsRelesePage goodsSpecifications() { | ||
412 | + moveHeightScroll("65"); | ||
413 | + click(countUnit); | ||
414 | + click(outBox); | ||
415 | + click(remoteMode); | ||
416 | + click(remoteMode2); | ||
417 | + click(thoroughfare); | ||
418 | + click(thoroughfare2); | ||
419 | + click(normalFunction); | ||
420 | + click(normalFunction2); | ||
421 | + click(isBattery); | ||
422 | + click(isBattery2); | ||
423 | + click(isCharge); | ||
424 | + click(isCharge2); | ||
425 | + click(parts); | ||
426 | + click(parts2); | ||
427 | + click(pattern); | ||
428 | + click(pattern2); | ||
429 | + click(suit); | ||
430 | + click(suit2); | ||
431 | + click(localProcess); | ||
432 | + click(localProcess2); | ||
433 | + click(color); | ||
434 | + click(color2); | ||
435 | + click(count); | ||
436 | + click(count2); | ||
437 | + click(packingType); | ||
438 | + click(packingType2); | ||
439 | + click(packingWay); | ||
440 | + click(packingWay2); | ||
441 | + click(addSku); | ||
442 | + | ||
443 | + sendKeys(skuItemCount, "10"); | ||
444 | + sendKeys(saleMOQ, "10"); | ||
445 | + sendKeys(supplyTime, "3"); | ||
446 | + | ||
447 | + //供应商报价,随机生成一个1-200的价格 | ||
448 | + int sp = (int)(1+Math.random()*200); | ||
449 | + sendKeys(suppliPrice, sp+""); | ||
450 | + | ||
451 | + jsExecutorDragAndDrop(widthScroll1,2000,0); | ||
452 | + mywait(packageLong); | ||
453 | + | ||
454 | + //外箱体积 | ||
455 | + sendKeys(packageLong, "100"); | ||
456 | + sendKeys(packageWidth, "50"); | ||
457 | + sendKeys(packageHigh, "40"); | ||
458 | + //毛重,净重 | ||
459 | + sendKeys(grossWeight, "1.5"); | ||
460 | + sendKeys(netWeight, "1.2"); | ||
461 | + | ||
462 | + click(save); | ||
463 | + return new GoodsRelesePage(driver); | ||
464 | + } | ||
465 | + | ||
466 | + /** | ||
467 | + * 原厂商品建档,将上面的方法整合 | ||
468 | + * @param supplierName | ||
469 | + * @return | ||
470 | + * @throws InterruptedException | ||
471 | + */ | ||
472 | + public GoodsRelesePage addOriginalGoods() { | ||
473 | + selectSupplier(supplierName); | ||
474 | + selectBrand(); | ||
475 | + selectCategory(); | ||
476 | + goodsProperty(); | ||
477 | + goodsInfo(); | ||
478 | + goodsSpecifications(); | ||
479 | + return new GoodsRelesePage(driver); | ||
480 | + } | ||
481 | + | ||
482 | + /** | ||
483 | + * 用于断言是否商品建档成功 | ||
484 | + * @return boolean | ||
485 | + */ | ||
486 | + public boolean isSucceed() { | ||
487 | + return isElementExist(succeedMessage); | ||
488 | + } | ||
489 | + | ||
490 | + /** | ||
491 | + * 返回商品名称后面的那串数字 | ||
492 | + * @return | ||
493 | + */ | ||
494 | + public static String getSkuNameNo() { | ||
495 | + return skuNameNo; | ||
496 | + } | ||
497 | + | ||
498 | + /** | ||
499 | + * 通过GUI设置供应商名称 | ||
500 | + * @param suppliername | ||
501 | + */ | ||
502 | + public static void setSupplierName(String suppliername) { | ||
503 | + supplierName = suppliername; | ||
504 | + } | ||
505 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AuditMarketGoodsPage.java
0 → 100644
@@ -0,0 +1,70 @@ | @@ -0,0 +1,70 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *审核市场商品列表页 | ||
14 | + */ | ||
15 | +public class AuditMarketGoodsPage extends BasePage { | ||
16 | + public AuditMarketGoodsPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + /*搜索控件*/ | ||
24 | + //采购商编号 | ||
25 | + @FindBy (xpath="//*[@placeholder='请输入采购商编号']") | ||
26 | + WebElement buyerNo; | ||
27 | + | ||
28 | + //sku编号 | ||
29 | + @FindBy (xpath="//*[contains(@placeholder,'请输入多个商品编号')]") | ||
30 | + WebElement skuNo; | ||
31 | + | ||
32 | + //查询 | ||
33 | + @FindBy (xpath="//*[text()='查询']") | ||
34 | + WebElement search; | ||
35 | + | ||
36 | + //搜索结果-第一个复选框 | ||
37 | + @FindBy (xpath="//*[@ng-table='tableParams']/tbody[1]/tr[1]/td[1]/input") | ||
38 | + WebElement firstCheckBox; | ||
39 | + | ||
40 | + //审核按钮 | ||
41 | + @FindBy (xpath="//*[text()='审核']") | ||
42 | + WebElement audit; | ||
43 | + | ||
44 | + /* | ||
45 | + * 页面方法 | ||
46 | + */ | ||
47 | + /** | ||
48 | + * 选择要审核的商品,并点击审核按钮 | ||
49 | + * @return AuditMarketOpreatePage | ||
50 | + */ | ||
51 | + public AuditMarketOpreatePage auditMarketGoods() { | ||
52 | + forceWait(500); | ||
53 | + sendKeys(skuNo, Model.getSkuNo()); | ||
54 | + click(search); | ||
55 | + forceWait(1000); | ||
56 | + mywait(firstCheckBox); | ||
57 | + click(firstCheckBox); | ||
58 | + click(audit); | ||
59 | + return new AuditMarketOpreatePage(driver); | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 如果审核成功,返回false,列表中已经不存在该待审核sku | ||
64 | + * @return boolean | ||
65 | + */ | ||
66 | + public boolean isSucceed() { | ||
67 | + forceWait(1500); | ||
68 | + return isVisibility(By.xpath("//*[contains(text(),'"+Model.getSkuNo()+"')]")); | ||
69 | + } | ||
70 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AuditMarketOpreatePage.java
0 → 100644
@@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *审核市场商品操作页,点击审核的那个页面 | ||
12 | + */ | ||
13 | +public class AuditMarketOpreatePage extends BasePage { | ||
14 | + public AuditMarketOpreatePage(WebDriver driver) { | ||
15 | + super(driver); | ||
16 | + } | ||
17 | + /*元素定位*/ | ||
18 | + | ||
19 | + //审核通过 | ||
20 | + @FindBy(xpath="//*[text()='审核通过']") | ||
21 | + WebElement pass; | ||
22 | + | ||
23 | + /*页面方法*/ | ||
24 | + /** | ||
25 | + * 审核通过 | ||
26 | + * @return | ||
27 | + */ | ||
28 | + public AuditMarketGoodsPage auditPass() { | ||
29 | + forceWait(2000); | ||
30 | + moveHeightScroll("100"); | ||
31 | + click(pass); | ||
32 | + return new AuditMarketGoodsPage(driver); | ||
33 | + } | ||
34 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AuditOriginalGoodsPage.java
0 → 100644
@@ -0,0 +1,74 @@ | @@ -0,0 +1,74 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + *审核原厂商品列表页 | ||
13 | + */ | ||
14 | +public class AuditOriginalGoodsPage extends BasePage { | ||
15 | + public AuditOriginalGoodsPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //第一个复选框,同时也是检查点 | ||
24 | + @FindBy(xpath="//*[@ng-table='tableParams']/tbody[1]/tr[1]/td[1]/input") | ||
25 | + WebElement checkBox; | ||
26 | + | ||
27 | + /** | ||
28 | + * 根据商品名称获得其复选框 | ||
29 | + * @return WebElement | ||
30 | + */ | ||
31 | + private WebElement getCheckBox() { | ||
32 | + String no = AddOriginalGoodsPage.getSkuNameNo(); | ||
33 | + return driver.findElement(By.xpath("//*[contains(@class,'col-sm-') and contains(text(),'"+no+"')]/../../../../td[1]/input")); | ||
34 | + } | ||
35 | + | ||
36 | + //审核 | ||
37 | + @FindBy(xpath="//*[text()='审核']") | ||
38 | + WebElement audit; | ||
39 | + | ||
40 | + //批量通过并上架 | ||
41 | + @FindBy(xpath="//*[text()='批量通过并上架']") | ||
42 | + WebElement batchAudit; | ||
43 | + | ||
44 | + /* | ||
45 | + * 页面方法 | ||
46 | + */ | ||
47 | + | ||
48 | + /** | ||
49 | + * 选择商品,并进入审核页面 | ||
50 | + * @return AuditOriginalOpreatePage | ||
51 | + */ | ||
52 | + public AuditOriginalOpreatePage toAuditOriginalSku() { | ||
53 | +// forceWait(2000); | ||
54 | +// mywait(checkBox); | ||
55 | + dynamicWait(By.xpath("//*[@ng-table='tableParams']/tbody[1]/tr[1]/td[1]/input")); | ||
56 | + click(getCheckBox()); | ||
57 | + click(audit); | ||
58 | + return new AuditOriginalOpreatePage(driver); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * 用于断言列表是否有要找的商品 | ||
63 | + * @return boolean | ||
64 | + */ | ||
65 | + public boolean isSucceed() { | ||
66 | +// mywait(checkBox); | ||
67 | +// forceWait(2000); | ||
68 | + dynamicWait(By.xpath("//*[@ng-table='tableParams']/tbody[1]/tr[1]/td[1]/input")); | ||
69 | + String SkuNameNo = AddOriginalGoodsPage.getSkuNameNo(); | ||
70 | + boolean b = isVisibility(By.xpath("//*[contains(text(),'"+SkuNameNo+"')]")); | ||
71 | + return b; | ||
72 | + } | ||
73 | + | ||
74 | +} |
src/main/java/com/essa/pageObject/GoodsManage/AuditOriginalOpreatePage.java
0 → 100644
@@ -0,0 +1,52 @@ | @@ -0,0 +1,52 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *审核原厂商品页面 | ||
12 | + */ | ||
13 | +public class AuditOriginalOpreatePage extends BasePage { | ||
14 | + public AuditOriginalOpreatePage(WebDriver driver) { | ||
15 | + super(driver); | ||
16 | + } | ||
17 | + /* | ||
18 | + * 元素定位 | ||
19 | + */ | ||
20 | + | ||
21 | + //审核通过 | ||
22 | + @FindBy(xpath="//*[text()='审核通过']") | ||
23 | + WebElement pass; | ||
24 | + | ||
25 | + //审核通过提示语 | ||
26 | + @FindBy(xpath="//*[text()='商品审核已通过'") | ||
27 | + WebElement succeedMessage; | ||
28 | + | ||
29 | + /* | ||
30 | + * 页面方法 | ||
31 | + */ | ||
32 | + | ||
33 | + /** | ||
34 | + * 挪动滚动条至底部,点击审核通过 | ||
35 | + * @return AuditOriginalGoodsPage | ||
36 | + */ | ||
37 | + public AuditOriginalGoodsPage auditPass() { | ||
38 | + forceWait(2000); | ||
39 | + moveHeightScroll("100"); | ||
40 | + click(pass); | ||
41 | + return new AuditOriginalGoodsPage(driver); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * 用于断言商品审核是否通过 | ||
46 | + * @return boolean | ||
47 | + */ | ||
48 | + public boolean isSucceed() { | ||
49 | + return isElementExist(succeedMessage); | ||
50 | + } | ||
51 | + | ||
52 | +} |
src/main/java/com/essa/pageObject/GoodsManage/EditSpuPage.java
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *编辑spu页 | ||
12 | + */ | ||
13 | +public class EditSpuPage extends BasePage { | ||
14 | + public EditSpuPage(WebDriver driver) { | ||
15 | + super(driver); | ||
16 | + } | ||
17 | + /* | ||
18 | + * 页面元素定位 | ||
19 | + */ | ||
20 | + | ||
21 | + //上传图片 | ||
22 | + @FindBy(xpath="//*[@class='webuploader-element-invisible']/../label") | ||
23 | + WebElement upDatePic; | ||
24 | + | ||
25 | + //保存 | ||
26 | + @FindBy(xpath="//*[text()='保存']") | ||
27 | + WebElement save; | ||
28 | + | ||
29 | + /* | ||
30 | + * 页面方法 | ||
31 | + */ | ||
32 | + | ||
33 | + /** | ||
34 | + * 编辑spu图片 | ||
35 | + * @return GoodsRelesePage | ||
36 | + * @throws InterruptedException | ||
37 | + */ | ||
38 | + public GoodsRelesePage editSpuPic() throws InterruptedException { | ||
39 | + moveHeightScroll("30"); | ||
40 | + jsExecutorClick(upDatePic); | ||
41 | + moveHeightScroll("0"); | ||
42 | + click(save); | ||
43 | + return new GoodsRelesePage(driver); | ||
44 | + } | ||
45 | +} |
src/main/java/com/essa/pageObject/GoodsManage/GoodsBankPage.java
0 → 100644
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
4 | +import org.openqa.selenium.WebDriver; | ||
5 | +import org.openqa.selenium.WebElement; | ||
6 | +import com.essa.framework.BasePage; | ||
7 | +import com.essa.framework.Model; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *商品库页 | ||
12 | + */ | ||
13 | +public class GoodsBankPage extends BasePage { | ||
14 | + public GoodsBankPage(WebDriver driver) { | ||
15 | + super(driver); | ||
16 | + } | ||
17 | + /* | ||
18 | + * 页面元素定位 | ||
19 | + */ | ||
20 | + | ||
21 | + //商品名称 | ||
22 | + private WebElement getSkuName() { | ||
23 | + String no = AddOriginalGoodsPage.skuNameNo; | ||
24 | + return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]")); | ||
25 | + } | ||
26 | + | ||
27 | + //商品编号 | ||
28 | + private WebElement getSkuNo() { | ||
29 | + String no = AddOriginalGoodsPage.skuNameNo; | ||
30 | + return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]/../li[3]")); | ||
31 | + } | ||
32 | + | ||
33 | + /* | ||
34 | + * 页面方法 | ||
35 | + */ | ||
36 | + | ||
37 | + /** | ||
38 | + * 获取商品编号 | ||
39 | + * @return No | ||
40 | + */ | ||
41 | + public String getNo() { | ||
42 | + dynamicWait(By.xpath("//*[@id='undercarriageGoods']/tbody[1]/tr[1]/td[1]/input")); | ||
43 | + String skuNo = getSkuNo().getText(); | ||
44 | + Model.setSkuNo(skuNo); | ||
45 | + return skuNo; | ||
46 | + } | ||
47 | +} |
src/main/java/com/essa/pageObject/GoodsManage/GoodsRelesePage.java
0 → 100644
@@ -0,0 +1,88 @@ | @@ -0,0 +1,88 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + *商品发布管理 | ||
13 | + */ | ||
14 | +public class GoodsRelesePage extends BasePage { | ||
15 | + public GoodsRelesePage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + /* | ||
19 | + * 元素定位 | ||
20 | + */ | ||
21 | + | ||
22 | + //商品发布--检查点 | ||
23 | + @FindBy(xpath="//*[text()='商品发布']") | ||
24 | + WebElement checkPoint; | ||
25 | + | ||
26 | + /* | ||
27 | + //勾选第1个复选框--后续最好根据商品名称来定位勾选框 | ||
28 | + @FindBy(xpath="//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input") | ||
29 | + WebElement checkBox; | ||
30 | + */ | ||
31 | + | ||
32 | + /** | ||
33 | + * 根据商品名称获得其复选框 | ||
34 | + * @return | ||
35 | + */ | ||
36 | + private WebElement getCheckBox() { | ||
37 | + String no = AddOriginalGoodsPage.getSkuNameNo(); | ||
38 | + return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]/../../td[1]/input")); | ||
39 | + } | ||
40 | + | ||
41 | + //图片更新 | ||
42 | + @FindBy(xpath="//*[contains(text(),'图片更新')]") | ||
43 | + WebElement updatePic; | ||
44 | + | ||
45 | + //编辑 | ||
46 | + @FindBy(xpath="//*[contains(text(),'编辑')]") | ||
47 | + WebElement edit; | ||
48 | + | ||
49 | + /* | ||
50 | + * 页面方法 | ||
51 | + */ | ||
52 | + | ||
53 | + /** | ||
54 | + * 进入更新图片页面 | ||
55 | + * @return UpdatePicPage | ||
56 | + */ | ||
57 | + public UpdatePicPage toUpDatePic() { | ||
58 | + forceWait(2000); | ||
59 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | ||
60 | + click(getCheckBox()); | ||
61 | + click(updatePic); | ||
62 | + return new UpdatePicPage(driver); | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * 进入编辑页面 | ||
67 | + * @return EditSpuPage | ||
68 | + * @throws InterruptedException | ||
69 | + */ | ||
70 | + public EditSpuPage toEditSpuPage() { | ||
71 | + isThisPage("商品发布", checkPoint); | ||
72 | + click(getCheckBox()); | ||
73 | + click(edit); | ||
74 | + return new EditSpuPage(driver); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 断言商品建档是否成功 | ||
79 | + * @return boolean | ||
80 | + */ | ||
81 | + public boolean isAddOrignalSucceed() { | ||
82 | + forceWait(1000); | ||
83 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | ||
84 | + String SkuNameNo = AddOriginalGoodsPage.getSkuNameNo(); | ||
85 | + //由于@findby只能输入常量,不能输入变量,所以这里用最底层的方法来寻找元素 | ||
86 | + return isVisibility((driver.findElement(By.xpath("//*[contains(text(),'"+SkuNameNo+"')]")))); | ||
87 | + } | ||
88 | +} |
src/main/java/com/essa/pageObject/GoodsManage/MarketGoodsRelesePage.java
0 → 100644
@@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | +import com.essa.framework.Model; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author Administrator | ||
12 | + *市场商品发布页 | ||
13 | + */ | ||
14 | +public class MarketGoodsRelesePage extends BasePage { | ||
15 | + | ||
16 | + public MarketGoodsRelesePage (WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + /* | ||
20 | + * 页面元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //采购商编号 | ||
24 | + @FindBy (xpath="//*[@placeholder='请输入采购商编号']") | ||
25 | + WebElement buyerNo; | ||
26 | + | ||
27 | + //查询按钮 | ||
28 | + @FindBy (xpath="//*[text()='查询']") | ||
29 | + WebElement search; | ||
30 | + | ||
31 | + //市场商品发布--列表第一个 | ||
32 | + @FindBy (xpath="//*[@id='tableViewList']/div/div/div/div[2]/table/tbody/tr[1]/td[9]/button") | ||
33 | + WebElement goodsRelese1; | ||
34 | + | ||
35 | + /* | ||
36 | + * 页面方法 | ||
37 | + */ | ||
38 | + /** | ||
39 | + * 选择采购商,点击市场发布,进入市场商品建档页面 | ||
40 | + * @return AddMarketGoodsPage | ||
41 | + */ | ||
42 | + public AddMarketGoodsPage toAddMarketGoodsPage() { | ||
43 | + mywait(goodsRelese1); | ||
44 | + sendKeys(buyerNo, Model.getBuyerNo()); | ||
45 | + click(search); | ||
46 | + forceWait(1000); | ||
47 | + mywait(goodsRelese1); | ||
48 | + click(goodsRelese1); | ||
49 | + forceWait(1000); | ||
50 | + switchWindow(); | ||
51 | + return new AddMarketGoodsPage(driver); | ||
52 | + } | ||
53 | + | ||
54 | +} |
src/main/java/com/essa/pageObject/GoodsManage/UpdatePicPage.java
0 → 100644
@@ -0,0 +1,98 @@ | @@ -0,0 +1,98 @@ | ||
1 | +package com.essa.pageObject.GoodsManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + *更新图片 | ||
13 | + */ | ||
14 | +public class UpdatePicPage extends BasePage { | ||
15 | + public UpdatePicPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + public static String picPath; | ||
19 | + | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + | ||
24 | + //检查点 | ||
25 | + @FindBy(xpath="//*[text()='SPU信息']") | ||
26 | + WebElement checkPoint; | ||
27 | + | ||
28 | + //spu上传图片按钮 | ||
29 | + @FindBy(xpath="//*[@id='spuWrapper']/div[3]/div[2]") | ||
30 | + WebElement spuUploadPic; | ||
31 | + | ||
32 | + //spu的主图 | ||
33 | + @FindBy(xpath="//*[@class='load-pic']") | ||
34 | + WebElement spuPic; | ||
35 | + | ||
36 | + //sku上传图片按钮 | ||
37 | + @FindBy(xpath="//*[@id='skuWrapper']/div/div/div[1]/div[2]") | ||
38 | + WebElement skuUploadPic; | ||
39 | + | ||
40 | + //SKU图片上的X | ||
41 | + @FindBy(xpath="//*[contains(@ng-click,'picInfo,')]") | ||
42 | + WebElement skuPic; | ||
43 | + | ||
44 | + //保存按钮 | ||
45 | + @FindBy(xpath="//*[text()='保存']") | ||
46 | + WebElement save; | ||
47 | + | ||
48 | + //保存成功提示 | ||
49 | + @FindBy(xpath="保存成功") | ||
50 | + WebElement succeedMessage; | ||
51 | + | ||
52 | + /* | ||
53 | + * 以下为页面方法 | ||
54 | + */ | ||
55 | + | ||
56 | + /** | ||
57 | + * 更新商品图片 | ||
58 | + * @param picPath 作为商品图片的本机地址 | ||
59 | + * @return GoodsRelesePage | ||
60 | + */ | ||
61 | + public GoodsRelesePage upDatePic() { | ||
62 | + forceWait(2000); | ||
63 | + dynamicWait(By.xpath("//*[text()='SPU信息']")); | ||
64 | + click(spuUploadPic); | ||
65 | + uploadFile(picPath); | ||
66 | + //如果spu图片还在上传,则等待2秒 | ||
67 | + /*while(!isElementExist(spuPic)) { | ||
68 | + forceWait(2000); | ||
69 | + }*/ | ||
70 | + dynamicWait(By.xpath("//*[@class='load-pic']")); | ||
71 | + click(skuUploadPic); | ||
72 | + uploadFile(picPath); | ||
73 | + //如果默认的sku图片还存在,说明图片还在上传,继续等待 | ||
74 | + /*while (!isElementExist(skuPic)) { | ||
75 | + forceWait(2000); | ||
76 | + }*/ | ||
77 | + dynamicWait(By.xpath("//*[contains(@ng-click,'picInfo,')]")); | ||
78 | + forceWait(1000); | ||
79 | + click(save); | ||
80 | + return new GoodsRelesePage(driver); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 断言更新图片是否成功 | ||
85 | + * @return | ||
86 | + */ | ||
87 | + public boolean isSucceed() { | ||
88 | + return isElementExist(succeedMessage); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 通过GUI设置本机图片路径 | ||
93 | + * @param picpath | ||
94 | + */ | ||
95 | + public static void setPicPath(String picpath) { | ||
96 | + picPath = picpath; | ||
97 | + } | ||
98 | +} |
@@ -0,0 +1,429 @@ | @@ -0,0 +1,429 @@ | ||
1 | +package com.essa.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | +import com.essa.framework.BasePage; | ||
7 | +import com.essa.framework.Model; | ||
8 | +import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | ||
9 | +import com.essa.pageObject.GoodsManage.AuditMarketGoodsPage; | ||
10 | +import com.essa.pageObject.GoodsManage.AuditOriginalGoodsPage; | ||
11 | +import com.essa.pageObject.GoodsManage.GoodsBankPage; | ||
12 | +import com.essa.pageObject.GoodsManage.GoodsRelesePage; | ||
13 | +import com.essa.pageObject.GoodsManage.MarketGoodsRelesePage; | ||
14 | +import com.essa.pageObject.PODocumentary.PODocumentaryListPage; | ||
15 | +import com.essa.pageObject.StorageManage.GoodsReceiveTaskPage; | ||
16 | +import com.essa.pageObject.StorageManage.NoticeReceivePage; | ||
17 | +import com.essa.pageObject.buyPlaneManage.SkuCategoryManagerCongfigPage; | ||
18 | +import com.essa.pageObject.buyerManage.InvateCodePage; | ||
19 | +import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage; | ||
20 | +import com.essa.pageObject.marketingManage.GroupControlPage; | ||
21 | +import com.essa.pageObject.marketingManage.GroupSettingPage; | ||
22 | +import com.essa.pageObject.needDealt.NeedDealtApplyPage; | ||
23 | + | ||
24 | +/** | ||
25 | + * @author Administrator | ||
26 | + *bpms后台首页 | ||
27 | + */ | ||
28 | +public class HomePage extends BasePage{ | ||
29 | + public HomePage(WebDriver driver) { | ||
30 | + super(driver); | ||
31 | + } | ||
32 | + | ||
33 | + /* | ||
34 | + * 元素定位 | ||
35 | + */ | ||
36 | + | ||
37 | + //退出 | ||
38 | + @FindBy (xpath="//*[text()='退出']") | ||
39 | + WebElement logout; | ||
40 | + | ||
41 | + //左上角图标--用于回到首页 | ||
42 | + @FindBy (xpath="//*[@class='logo-text']") | ||
43 | + WebElement essaIcon; | ||
44 | + | ||
45 | + //供应商管理 | ||
46 | + @FindBy (xpath="//*[text()='供应商管理']") | ||
47 | + WebElement supplier; | ||
48 | + | ||
49 | + //平台运营跟进管理 | ||
50 | + @FindBy (xpath="//*/a[contains(text(),'平台运营跟进管理')]") | ||
51 | + WebElement operationsTrack; | ||
52 | + | ||
53 | + //供应商查询 | ||
54 | + @FindBy (xpath="//*[text()='供应商查询']") | ||
55 | + WebElement searchSuppliers; | ||
56 | + | ||
57 | + //商品管理 | ||
58 | + @FindBy (xpath="//*[text()='商品管理']") | ||
59 | + WebElement goodsManage; | ||
60 | + | ||
61 | + //商品库 | ||
62 | + @FindBy (xpath="//*[text()='商品库']") | ||
63 | + WebElement goodBank; | ||
64 | + | ||
65 | + //原厂商品发布 | ||
66 | + @FindBy (xpath="//*[text()='原厂商品发布']") | ||
67 | + WebElement addOriginalGoods; | ||
68 | + | ||
69 | + //市场商品发布 | ||
70 | + @FindBy (xpath="//*[text()='市场商品发布']") | ||
71 | + WebElement marketGoodsRelese; | ||
72 | + | ||
73 | + //商品发布管理-子元素 | ||
74 | + @FindBy(xpath="//*[@name='child.text' and text()='商品发布管理']") | ||
75 | + WebElement goodsPublish; | ||
76 | + | ||
77 | + //原厂商品发布审核 | ||
78 | + @FindBy(xpath="//*[text()='原厂商品发布审核']") | ||
79 | + WebElement auditOriginal; | ||
80 | + | ||
81 | + //市场商品发布审核 | ||
82 | + @FindBy(xpath="//*[text()='市场商品发布审核']") | ||
83 | + WebElement auditMarket; | ||
84 | + | ||
85 | + //采购计划管理 | ||
86 | + @FindBy(xpath="//*[text()='采购计划管理']") | ||
87 | + WebElement buyerPlaneManage; | ||
88 | + | ||
89 | + //商品类目经理分配配置 | ||
90 | + @FindBy(xpath="//*[text()='商品类目经理分配配置']") | ||
91 | + WebElement skuManagerConfig; | ||
92 | + | ||
93 | + //营销管理 | ||
94 | + @FindBy (xpath="//*[text()='营销管理']") | ||
95 | + WebElement marketingManage; | ||
96 | + | ||
97 | + //团购设置 | ||
98 | + @FindBy (xpath="//*[text()='团购设置']/..") | ||
99 | + WebElement groupSetting; | ||
100 | + | ||
101 | + //团购控制 | ||
102 | + @FindBy (xpath="//*[text()='团购控制']/..") | ||
103 | + WebElement groupControl; | ||
104 | + | ||
105 | + //采购商管理 | ||
106 | + @FindBy (xpath="//*[text()='采购商管理']") | ||
107 | + WebElement buyerManage; | ||
108 | + | ||
109 | + //生成邀请码 | ||
110 | + @FindBy (xpath="//*[text()='生成邀请码']" ) | ||
111 | + WebElement inviteCode; | ||
112 | + | ||
113 | + //询价管理 | ||
114 | + @FindBy (xpath ="//span[text()='询价管理']") | ||
115 | + WebElement inquiryManage; | ||
116 | + | ||
117 | + //成品询价任务列表 | ||
118 | + @FindBy (xpath = "//*[text()='成品询价任务列表']") | ||
119 | + WebElement productInquiryTask; | ||
120 | + | ||
121 | + //产品开发 | ||
122 | + @FindBy (xpath ="//*[text()='产品开发']") | ||
123 | + WebElement productDev; | ||
124 | + | ||
125 | + //项目立项书新增 | ||
126 | + @FindBy (xpath ="//*[text()='项目立项书新增']") | ||
127 | + WebElement addProject; | ||
128 | + | ||
129 | + //项目立项书查询 | ||
130 | + @FindBy (xpath ="//*[text()='项目立项书查询']") | ||
131 | + WebElement quiryProject; | ||
132 | + | ||
133 | + //待办中的"采购计划审核流程" | ||
134 | + @FindBy (xpath = "//*[@title='采购计划审核流程']") | ||
135 | + WebElement purchasePlaneProcess; | ||
136 | + | ||
137 | + //待办中的“船务确认备选船期流程” | ||
138 | + @FindBy (xpath = "//*[text()='船务确认备选船期流程']") | ||
139 | + WebElement confirmDailingDate; | ||
140 | + | ||
141 | + //第一条待办 | ||
142 | + @FindBy (xpath = "//*[@ng-table='tableParams']/tbody/tr[1]") | ||
143 | + WebElement firstNeedDealt; | ||
144 | + | ||
145 | + //待办搜索文本框 | ||
146 | + @FindBy (xpath ="//*[@name='searchForm']/div/input") | ||
147 | + WebElement searchText; | ||
148 | + | ||
149 | + //待办搜索按钮 | ||
150 | + @FindBy (xpath = "//*[@name='searchForm']/div/span/button") | ||
151 | + WebElement search; | ||
152 | + | ||
153 | + //跟单管理 | ||
154 | + @FindBy (xpath = "//*[text()='跟单管理']") | ||
155 | + WebElement DocumentaryManage; | ||
156 | + | ||
157 | + //PO跟单 | ||
158 | + @FindBy (xpath ="//*[text()='PO跟单']") | ||
159 | + WebElement PODocumentary; | ||
160 | + | ||
161 | + //仓储管理 | ||
162 | + @FindBy (xpath = "//span[contains(text(),'仓储管理')]") | ||
163 | + WebElement StorageManage; | ||
164 | + | ||
165 | + //收货通知 | ||
166 | + @FindBy (xpath = "//a[@name='child.text'][contains(text(),'收货通知')]") | ||
167 | + WebElement NoticeReceive; | ||
168 | + | ||
169 | + //收货任务管理 | ||
170 | + @FindBy (xpath = "//a[contains(text(),'收货任务管理')]") | ||
171 | + WebElement goodsReceiveTask; | ||
172 | + | ||
173 | + /* | ||
174 | + * 方法 | ||
175 | + */ | ||
176 | + | ||
177 | + /** | ||
178 | + * 进入运营跟进管理页面 | ||
179 | + * @return SupplierOperationsTrackPage | ||
180 | + */ | ||
181 | + public SupplierOperationsTrackPage goToSupplierOperationsTrack() { | ||
182 | + | ||
183 | + //点击 供应商管理 | ||
184 | + click(supplier); | ||
185 | + | ||
186 | + //点击 平台运营跟进管理 | ||
187 | + click(operationsTrack); | ||
188 | + | ||
189 | + //此时,系统会加载一个平台运营跟进管理页面,故在此初始化该页面并将driver传递过去 | ||
190 | + return new SupplierOperationsTrackPage(driver); | ||
191 | + | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * 进入原厂商品发布 | ||
196 | + * @return AddOriginalGoodsPage | ||
197 | + */ | ||
198 | + public AddOriginalGoodsPage tOriginalGoodsPage() { | ||
199 | + click(goodsManage); | ||
200 | + isElementExist(addOriginalGoods); | ||
201 | + click(addOriginalGoods); | ||
202 | + return new AddOriginalGoodsPage(driver); | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 进入商品发布管理 | ||
207 | + * @return GoodsRelesePage | ||
208 | + */ | ||
209 | + public GoodsRelesePage tGoodsRelesePage() { | ||
210 | + click(goodsManage); | ||
211 | + click(goodsPublish); | ||
212 | + return new GoodsRelesePage(driver); | ||
213 | + } | ||
214 | + | ||
215 | + /** | ||
216 | + * 进入原厂商品发布审核 | ||
217 | + * @return AuditOriginalGoodsPage | ||
218 | + */ | ||
219 | + public AuditOriginalGoodsPage toAuditOriginalGoodsPage() { | ||
220 | + mywait(logout); | ||
221 | + click(goodsManage); | ||
222 | + click(auditOriginal); | ||
223 | + return new AuditOriginalGoodsPage(driver); | ||
224 | + } | ||
225 | + | ||
226 | + /** | ||
227 | + * 进入商品库 | ||
228 | + * @return GoodsBankPage | ||
229 | + */ | ||
230 | + public GoodsBankPage toGoodsBankPage() { | ||
231 | + click(goodsManage); | ||
232 | + click(goodBank); | ||
233 | + return new GoodsBankPage(driver); | ||
234 | + } | ||
235 | + | ||
236 | + /** | ||
237 | + * 进入市场商品发布 | ||
238 | + * @return MarketGoodsRelesePage | ||
239 | + */ | ||
240 | + public MarketGoodsRelesePage toMarketGoodsRelesePage() { | ||
241 | + click(goodsManage); | ||
242 | + click(marketGoodsRelese); | ||
243 | + return new MarketGoodsRelesePage(driver); | ||
244 | + } | ||
245 | + /** | ||
246 | + * 进入市场商品发布审核 | ||
247 | + * @return AuditMarketGoodsPage | ||
248 | + */ | ||
249 | + public AuditMarketGoodsPage toAuditMarketGoodsPage() { | ||
250 | + click(goodsManage); | ||
251 | + click(auditMarket); | ||
252 | + return new AuditMarketGoodsPage(driver); | ||
253 | + } | ||
254 | + /** | ||
255 | + * 进入商品类目经理分配配置 | ||
256 | + * @return SkuCategoryManagerCongfigPage | ||
257 | + */ | ||
258 | + public SkuCategoryManagerCongfigPage toSkuCategoryManagerCongfig() { | ||
259 | + mywait(logout); | ||
260 | + click(buyerPlaneManage); | ||
261 | + click(skuManagerConfig); | ||
262 | + return new SkuCategoryManagerCongfigPage(driver); | ||
263 | + } | ||
264 | + /** | ||
265 | + * 进入团购设置 | ||
266 | + * @return GroupSettingPage | ||
267 | + */ | ||
268 | + public GroupSettingPage toGroupSettingPage() { | ||
269 | + getHome(); | ||
270 | + click(marketingManage); | ||
271 | + click(groupSetting); | ||
272 | + return new GroupSettingPage(driver); | ||
273 | + } | ||
274 | + /** | ||
275 | + * 进入团购控制 | ||
276 | + * @return GroupControlPage | ||
277 | + */ | ||
278 | + public GroupControlPage toGroupControlPage() { | ||
279 | +// getHome(); | ||
280 | + jsExecutorClick(essaIcon); | ||
281 | + click(marketingManage); | ||
282 | + click(groupControl); | ||
283 | + return new GroupControlPage(driver); | ||
284 | + } | ||
285 | + /** | ||
286 | + * 进入生成邀请码 | ||
287 | + * @return InvateCodePage | ||
288 | + */ | ||
289 | + public InvateCodePage toInvateCodePage() { | ||
290 | + click(buyerManage); | ||
291 | + moveHeightScroll("100"); | ||
292 | + click(inviteCode); | ||
293 | + return new InvateCodePage(driver); | ||
294 | + } | ||
295 | + /** | ||
296 | + * 进入成品询价任务列表 | ||
297 | + * @return ProductInquiryTask | ||
298 | + */ | ||
299 | + public ProductInquiryTaskPage toProductInquiryTask() { | ||
300 | + click(inquiryManage); | ||
301 | + click(productInquiryTask); | ||
302 | + return new ProductInquiryTaskPage(driver); | ||
303 | + } | ||
304 | + | ||
305 | + | ||
306 | + /** | ||
307 | + * 判断是否进入后台首页 | ||
308 | + * @return boolean | ||
309 | + */ | ||
310 | + public boolean isSucceed() { | ||
311 | + return isThisPage("退出", logout); | ||
312 | + } | ||
313 | + | ||
314 | + /** | ||
315 | + * 判断是否选中“供应商管理” | ||
316 | + * @return | ||
317 | + */ | ||
318 | + public boolean isSearchSuppliers() { | ||
319 | + return isElementExist(searchSuppliers); | ||
320 | + } | ||
321 | + | ||
322 | + /** | ||
323 | + *点击essa图标, 回到bpms后台首页 | ||
324 | + */ | ||
325 | + public void getHome() { | ||
326 | + forceWait(500); | ||
327 | + jsExecutorClick(essaIcon); | ||
328 | + forceWait(1000); | ||
329 | + } | ||
330 | + /** | ||
331 | + * 退出登录 | ||
332 | + */ | ||
333 | + public void logout() { | ||
334 | + click(logout); | ||
335 | + } | ||
336 | + | ||
337 | + /** | ||
338 | + * 点击退出,有弹框确认是否离开时,用这个 | ||
339 | + */ | ||
340 | + public void sureLogout() { | ||
341 | + click(logout); | ||
342 | + alert(true); | ||
343 | + forceWait(1000); | ||
344 | + } | ||
345 | + | ||
346 | + /** | ||
347 | + * 团购活动达成,类目经理采购计划单申请 | ||
348 | + * @return 询价待办申请页面 | ||
349 | + */ | ||
350 | + public NeedDealtApplyPage applyPurchasePlane() { | ||
351 | + mywait(firstNeedDealt); | ||
352 | + click(purchasePlaneProcess); | ||
353 | + forceWait(500); | ||
354 | + click(firstNeedDealt); | ||
355 | + switchWindow(); | ||
356 | + return new NeedDealtApplyPage(driver); | ||
357 | + } | ||
358 | + | ||
359 | + /** | ||
360 | + * 待办详情页 | ||
361 | + * @return 进入待办详情页 | ||
362 | + */ | ||
363 | + public NeedDealtApplyPage toNeedDealtDetailPage() { | ||
364 | + mywait(firstNeedDealt); | ||
365 | + sendKeys(searchText, Model.getSerialNum()); | ||
366 | + click(search); | ||
367 | + forceWait(1000); | ||
368 | + mywait(firstNeedDealt); | ||
369 | + click(firstNeedDealt); | ||
370 | +// switchWindow(); | ||
371 | + switchMoreWindow(); | ||
372 | + return new NeedDealtApplyPage(driver); | ||
373 | + } | ||
374 | + | ||
375 | + /** | ||
376 | + * 进入PO跟单列表页 | ||
377 | + * @return PO跟单列表页 | ||
378 | + */ | ||
379 | + public PODocumentaryListPage toPoDocumentaryListPage() { | ||
380 | + click(DocumentaryManage); | ||
381 | + click(PODocumentary); | ||
382 | + return new PODocumentaryListPage(driver); | ||
383 | + } | ||
384 | + | ||
385 | + /** | ||
386 | + * 进入收货通知页面 | ||
387 | + * @return 收货通知页面 | ||
388 | + */ | ||
389 | + public NoticeReceivePage toNoticeReceivePage() { | ||
390 | + click(StorageManage); | ||
391 | + click(NoticeReceive); | ||
392 | + return new NoticeReceivePage(driver); | ||
393 | + } | ||
394 | + | ||
395 | + /** | ||
396 | + * 进入收货任务管理 | ||
397 | + * @return 收货任务管理页面 | ||
398 | + */ | ||
399 | + public GoodsReceiveTaskPage toGoodsReceiveTaskPage() { | ||
400 | + click(StorageManage); | ||
401 | + click(goodsReceiveTask); | ||
402 | + return new GoodsReceiveTaskPage(driver); | ||
403 | + } | ||
404 | + /** | ||
405 | + * 大跟单进入第一个需要确认备选船期的待办页面 | ||
406 | + * @return 确认船期页面 | ||
407 | + */ | ||
408 | + public NeedDealtApplyPage toSailingDateConfirmPage() { | ||
409 | + click(confirmDailingDate); | ||
410 | + click(firstNeedDealt); | ||
411 | + switchMoreWindow(); | ||
412 | + return new NeedDealtApplyPage(driver); | ||
413 | + } | ||
414 | + | ||
415 | + /** | ||
416 | + * 登记备选船期待办 | ||
417 | + * @return 进入登记船务船期待办详情页面 | ||
418 | + */ | ||
419 | + public NeedDealtApplyPage toShippingMarkWait(){ | ||
420 | + mywait(firstNeedDealt); | ||
421 | + sendKeys(searchText,Model.getSerialNum()); | ||
422 | + click(search); | ||
423 | + forceWait(1000); | ||
424 | + mywait(firstNeedDealt); | ||
425 | + click(firstNeedDealt); | ||
426 | + switchMoreWindow(); | ||
427 | + return new NeedDealtApplyPage(driver); | ||
428 | + } | ||
429 | +} | ||
0 | \ No newline at end of file | 430 | \ No newline at end of file |
@@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
1 | +package com.essa.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *bpms登录页 | ||
12 | + */ | ||
13 | +public class LoginPage extends BasePage{ | ||
14 | + | ||
15 | + public LoginPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //账号输入框 | ||
24 | + @FindBy (xpath="//*[@id='username']") | ||
25 | + WebElement login_account; | ||
26 | + | ||
27 | + //密码输入框 | ||
28 | + @FindBy (xpath="//*[@id='password']") | ||
29 | + WebElement login_password; | ||
30 | + | ||
31 | + //登录按钮 | ||
32 | + @FindBy (xpath="//*[@id='subBtn']") | ||
33 | + WebElement login_submit; | ||
34 | + | ||
35 | + /* | ||
36 | + * 页面方法 | ||
37 | + */ | ||
38 | + | ||
39 | + /** | ||
40 | + * 1.输入帐号 | ||
41 | + * 2.输入密码 | ||
42 | + * 3.点击登录 | ||
43 | + * 4.将driver返回 | ||
44 | + * @param account | ||
45 | + * @param password | ||
46 | + * @return HomePage | ||
47 | + */ | ||
48 | + public HomePage login(String account,String password) { | ||
49 | + sendKeys(login_account, account); | ||
50 | + sendKeys(login_password, password); | ||
51 | + click(login_submit); | ||
52 | + return new HomePage(driver); | ||
53 | + } | ||
54 | +} |
src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java
0 → 100644
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +package com.essa.pageObject.PODocumentary; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | + | ||
5 | +import com.essa.framework.BasePage; | ||
6 | + | ||
7 | +public class POBoardPage extends BasePage { | ||
8 | + | ||
9 | + public POBoardPage(WebDriver driver) { | ||
10 | + super(driver); | ||
11 | + } | ||
12 | + | ||
13 | +} |
src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java
0 → 100644
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +package com.essa.pageObject.PODocumentary; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *PO跟单任务列表页面 | ||
12 | + */ | ||
13 | +public class PODocumentaryListPage extends BasePage { | ||
14 | + | ||
15 | + public PODocumentaryListPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + @FindBy (xpath = "//*[contains(text(),'高级查询')]") | ||
23 | + WebElement advancedQuery;//高级查询 | ||
24 | + | ||
25 | + @FindBy (xpath = "//*[contains(@placeholder,'请输入PO单号')]") | ||
26 | + WebElement OrderNo; | ||
27 | +} |
src/main/java/com/essa/pageObject/StorageManage/GoodsReceiveTaskPage.java
0 → 100644
@@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
1 | +package com.essa.pageObject.StorageManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * 收货任务管理页面 | ||
13 | + * @author Administrator | ||
14 | + * | ||
15 | + */ | ||
16 | +public class GoodsReceiveTaskPage extends BasePage { | ||
17 | + | ||
18 | + public GoodsReceiveTaskPage(WebDriver driver) { | ||
19 | + super(driver); | ||
20 | + } | ||
21 | + | ||
22 | + /* | ||
23 | + * 元素定位 | ||
24 | + */ | ||
25 | + @FindBy (xpath = "//*[@name='selectKey']") | ||
26 | + WebElement keyword;//关键字查询 | ||
27 | + | ||
28 | + @FindBy (xpath = "//button[contains(@ng-click,'search')]") | ||
29 | + WebElement search;//查询按钮 | ||
30 | + | ||
31 | + @FindBy (xpath = "//tbody/tr[1]") | ||
32 | + WebElement firstResult;//列表第一个结果 | ||
33 | + | ||
34 | + @FindBy (xpath = "//button[contains(text(),'处理')]") | ||
35 | + WebElement deal;//处理 | ||
36 | + | ||
37 | + /* | ||
38 | + * 页面方法 | ||
39 | + */ | ||
40 | + /** | ||
41 | + * 选择第一个筛选结果,点击处理 | ||
42 | + * @return PO收货任务处理页 | ||
43 | + */ | ||
44 | + public GoodsReceiveTaskPage dealReceive() { | ||
45 | + dynamicWait(By.xpath("//tbody/tr[1]")); | ||
46 | + sendKeys(keyword, Model.getPoNum()); | ||
47 | + click(search); | ||
48 | + dynamicWait(By.xpath("//div[@style='display: none;' and @id='mask']")); | ||
49 | + click(firstResult); | ||
50 | + click(deal); | ||
51 | + return new GoodsReceiveTaskPage(driver); | ||
52 | + } | ||
53 | +} |
src/main/java/com/essa/pageObject/StorageManage/NoticeReceivePage.java
0 → 100644
@@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
1 | +package com.essa.pageObject.StorageManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *收货通知页面 | ||
14 | + */ | ||
15 | +public class NoticeReceivePage extends BasePage { | ||
16 | + | ||
17 | + public NoticeReceivePage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + /* | ||
21 | + * 元素定位 | ||
22 | + */ | ||
23 | + | ||
24 | + @FindBy (xpath = "//input[@name='keyword']") | ||
25 | + WebElement keyword;//关键字查询 | ||
26 | + | ||
27 | + @FindBy (xpath = "//button[contains(@ng-click,'search')]") | ||
28 | + WebElement search;//查询按钮 | ||
29 | + | ||
30 | + @FindBy (xpath = "//td[@data-title=\"'PO装柜仓库'\"]//span[@class='ng-scope'][contains(text(),'设置')]") | ||
31 | + WebElement set;//PO装柜仓库的“设置” | ||
32 | + | ||
33 | + @FindBy (xpath = "//*[@ng-click='chooseWarehouse(warehouse)']/../li[1]") | ||
34 | + WebElement wareHouse;//仓库 | ||
35 | + | ||
36 | + @FindBy (xpath = "//*[@ng-click='chooseZone(zone)']/../li[1]") | ||
37 | + WebElement zone;//区位 | ||
38 | + | ||
39 | + @FindBy (xpath = "//*[@ng-click='chooseShelf(shelf)']/../li[1]") | ||
40 | + WebElement shelf;//货区 | ||
41 | + | ||
42 | + @FindBy (xpath = "//button[contains(text(),'确定')]") | ||
43 | + WebElement confirm;//确定 | ||
44 | + | ||
45 | + @FindBy (xpath ="//button[@data-bb-handler='confirm']") | ||
46 | + WebElement sysch;//是否同步提示框的确定按钮 | ||
47 | + | ||
48 | + @FindBy (xpath ="//button[@data-bb-handler='ok']") | ||
49 | + WebElement succeed;//设置成功的确定按钮 | ||
50 | + | ||
51 | + /* | ||
52 | + * 页面方法 | ||
53 | + */ | ||
54 | + | ||
55 | + /** | ||
56 | + * 设置装柜仓库 | ||
57 | + */ | ||
58 | + public void setWareHouse() { | ||
59 | + dynamicWait(By.xpath("//div[@style='display: none;' and @id='mask']")); | ||
60 | + sendKeys(keyword, Model.getPoNum()); | ||
61 | + click(search); | ||
62 | + dynamicWait(By.xpath("//div[@style='display: none;' and @id='mask']")); | ||
63 | + click(set); | ||
64 | + forceWait(500); | ||
65 | + click(wareHouse); | ||
66 | + click(zone); | ||
67 | + click(shelf); | ||
68 | + click(confirm); | ||
69 | + forceWait(1000); | ||
70 | + click(sysch); | ||
71 | + forceWait(1000); | ||
72 | + click(succeed); | ||
73 | + } | ||
74 | + | ||
75 | +} |
src/main/java/com/essa/pageObject/StorageManage/ReceiveTaskDealPage.java
0 → 100644
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +package com.essa.pageObject.StorageManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | + * PO收货任务处理页面 | ||
12 | + * @author Administrator | ||
13 | + * | ||
14 | + */ | ||
15 | +public class ReceiveTaskDealPage extends BasePage { | ||
16 | + | ||
17 | + public ReceiveTaskDealPage(WebDriver driver) { | ||
18 | + super(driver); | ||
19 | + } | ||
20 | + | ||
21 | + @FindBy (xpath = "//*[text()='全部完成收货']") | ||
22 | + WebElement allReceive;//全部收货完成 | ||
23 | + | ||
24 | + @FindBy (xpath = "//*[text()='确定']") | ||
25 | + WebElement confirm;//确定 | ||
26 | + | ||
27 | + /* | ||
28 | + * 页面方法 | ||
29 | + */ | ||
30 | + /** | ||
31 | + * 全部收货完成 | ||
32 | + * @return 收货任务管理页 | ||
33 | + */ | ||
34 | + public GoodsReceiveTaskPage allReceive() { | ||
35 | + forceWait(1000); | ||
36 | + dynamicWait(By.xpath("//div[@style='display: none;' and @id='mask']")); | ||
37 | + click(allReceive); | ||
38 | + forceWait(500); | ||
39 | + click(confirm); | ||
40 | + forceWait(1000); | ||
41 | + click(confirm); | ||
42 | + return new GoodsReceiveTaskPage(driver); | ||
43 | + } | ||
44 | +} |
src/main/java/com/essa/pageObject/SupplierOperationsTrackPage.java
0 → 100644
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +package com.essa.pageObject; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +public class SupplierOperationsTrackPage extends BasePage { | ||
10 | + public SupplierOperationsTrackPage(WebDriver driver) { | ||
11 | + super(driver); | ||
12 | + } | ||
13 | + | ||
14 | + /* | ||
15 | + * 元素定位 | ||
16 | + */ | ||
17 | + | ||
18 | + // 查询输入框 | ||
19 | + @FindBy(xpath = "//*[contains(text(),'关键字查询')]/../div/div/input") | ||
20 | + WebElement query; | ||
21 | + | ||
22 | + // 查询按钮 | ||
23 | + @FindBy(xpath = "//*[text()='查询']") | ||
24 | + WebElement search; | ||
25 | + | ||
26 | + // 综合实力更新 | ||
27 | + @FindBy(xpath = "//*/button[contains(text(),'综合实力更新')]") | ||
28 | + WebElement supplierStrength; | ||
29 | + | ||
30 | + // 第一条查询结果(用于确定是否查询完毕) | ||
31 | + @FindBy(xpath = "//*[@id='content-table']/tbody/tr[1]") | ||
32 | + WebElement firstResult; | ||
33 | + | ||
34 | + // 检查点:自主发布商品数 | ||
35 | + @FindBy(xpath = "//*[@id='content-table']/thead/tr/th[10]") | ||
36 | + WebElement checkPoint; | ||
37 | + | ||
38 | + /* | ||
39 | + * 页面方法 | ||
40 | + */ | ||
41 | + | ||
42 | + // 输入要查询的文本 | ||
43 | + public void searchText(String text) throws InterruptedException { | ||
44 | + | ||
45 | + // 输入要查询的供应商或者编号等,点击查询按钮 | ||
46 | + | ||
47 | + sendKeys(query, text); | ||
48 | + | ||
49 | + click(search); | ||
50 | + | ||
51 | + } | ||
52 | + | ||
53 | + // 检查是否进入平台运营跟进管理 | ||
54 | + public boolean isSucceed() { | ||
55 | + | ||
56 | + return isThisPage("自主发布商品数", checkPoint); | ||
57 | + | ||
58 | + } | ||
59 | + | ||
60 | + // 跳转到综合实力更新 | ||
61 | + public SupplierStrengthPage goToSupplierStrengthPage(String supplierName) throws InterruptedException { | ||
62 | + /* | ||
63 | + * 查询供应商,点击 综合实力更新,将driver传递至综合实力更新页面 | ||
64 | + */ | ||
65 | + searchText(supplierName); | ||
66 | + | ||
67 | + click(supplierStrength); | ||
68 | + | ||
69 | + | ||
70 | + return new SupplierStrengthPage(driver); | ||
71 | + | ||
72 | + } | ||
73 | + | ||
74 | + // 列表是否有查询结果,没有则等待 | ||
75 | + public void waitResult() throws InterruptedException { | ||
76 | + while(!(firstResult.isDisplayed())) | ||
77 | + Thread.sleep(1000); | ||
78 | + } | ||
79 | +} |
src/main/java/com/essa/pageObject/SupplierStrengthPage.java
0 → 100644
@@ -0,0 +1,307 @@ | @@ -0,0 +1,307 @@ | ||
1 | +package com.essa.pageObject; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import org.openqa.selenium.By; | ||
6 | +import org.openqa.selenium.WebDriver; | ||
7 | +import org.openqa.selenium.WebElement; | ||
8 | +import org.openqa.selenium.support.FindBy; | ||
9 | + | ||
10 | +import com.essa.framework.BasePage; | ||
11 | + | ||
12 | +public class SupplierStrengthPage extends BasePage{ | ||
13 | + public SupplierStrengthPage(WebDriver driver) { | ||
14 | + super(driver); | ||
15 | + } | ||
16 | + | ||
17 | + | ||
18 | + /* | ||
19 | + * 元素定位 | ||
20 | + */ | ||
21 | + | ||
22 | + //配合度 | ||
23 | + @FindBy (xpath="//*[contains(text(),'配合度')]/../div[1]/div/select") | ||
24 | + WebElement cooperateDegree; | ||
25 | + | ||
26 | + //主打产品定位 | ||
27 | + @FindBy (xpath="//*[@dict-check-list='supplier_main_product_location']/select") | ||
28 | + WebElement mainProduct; | ||
29 | + | ||
30 | + //是否有研发能力:否 | ||
31 | + @FindBy (xpath = "//*[contains(text(),'是否有研发能力')]/../div/label[2]") | ||
32 | + WebElement notDev; | ||
33 | + | ||
34 | + //是否研发能力:是 | ||
35 | + @FindBy (xpath = "//*[contains(text(),'是否有研发能力')]/../div/label[1]") | ||
36 | + WebElement isDev; | ||
37 | + | ||
38 | + //每个季度有新品推出 | ||
39 | + @FindBy (xpath = ".//*[@class='col-md-20']/div/label[1]/input") | ||
40 | + WebElement newGoodsEveryQuarter; | ||
41 | + | ||
42 | + //有配备工程师 | ||
43 | + @FindBy (xpath =".//*[@class='col-md-20']/div/label[2]/input") | ||
44 | + WebElement existsEngineer; | ||
45 | + | ||
46 | + //有产品研发团队 | ||
47 | + @FindBy (xpath = ".//*[@class='col-md-20']/div/label[3]/input") | ||
48 | + WebElement existsProductDev; | ||
49 | + | ||
50 | + //其他 | ||
51 | + @FindBy (xpath = ".//*[@class='col-md-20']/div/label[4]/input") | ||
52 | + WebElement others; | ||
53 | + | ||
54 | + //其他文本输入框 | ||
55 | + @FindBy (xpath = ".//*[@ng-model='ctrl.model.otherDevelopmentAbilityValue']") | ||
56 | + WebElement otherDevAbilValue; | ||
57 | + | ||
58 | + //是否有证书:是 | ||
59 | + @FindBy (xpath = ".//*[contains(text(),'是否有证书')]/../div/label[1]") | ||
60 | + WebElement isCertificate; | ||
61 | + | ||
62 | + //是否有证书:否 | ||
63 | + @FindBy (xpath =".//*[contains(text(),'是否有证书')]/../div/label[2]") | ||
64 | + WebElement notCertificate; | ||
65 | + | ||
66 | + //添加证书的“+” | ||
67 | + @FindBy (xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[1]/div/button[1]") | ||
68 | + WebElement addCertificate; | ||
69 | + | ||
70 | + /* | ||
71 | + * 由于这个是动态表格,表格行数会变化,必须自己写方法来定位元素 | ||
72 | + * 证书类型选择项,value值:0~8 0:BSCI,1:SA8000,2:ICTT…… | ||
73 | + */ | ||
74 | + public WebElement itemType(int i) { | ||
75 | + String xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[1]/table/tbody/tr["+i+"]/td[2]/div/select"; | ||
76 | + return driver.findElement(By.xpath(xpath)); | ||
77 | + } | ||
78 | + | ||
79 | + //证书编号文本框 | ||
80 | + public WebElement itemCode(int i) { | ||
81 | + String xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[1]/table/tbody/tr["+i+"]/td[3]/input"; | ||
82 | + return driver.findElement(By.xpath(xpath)); | ||
83 | + } | ||
84 | + | ||
85 | + //证书说明文本框 | ||
86 | + public WebElement itemDec(int i) { | ||
87 | + String xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[1]/table/tbody/tr["+i+"]/td[4]/input"; | ||
88 | + return driver.findElement(By.xpath(xpath)); | ||
89 | + } | ||
90 | + | ||
91 | + //证书图片,用于判断图片是否上传成功 | ||
92 | + public WebElement imge(int i) { | ||
93 | + String xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[2]/div[2]/div/div["+i+"]/div[1]/img"; | ||
94 | + return driver.findElement(By.xpath(xpath)); | ||
95 | + } | ||
96 | + | ||
97 | + //添加证书文件 | ||
98 | + public WebElement itemFile(int i) { | ||
99 | + String xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[2]/div[2]/div/div["+i+"]/div[4]"; | ||
100 | + return driver.findElement(By.xpath(xpath)); | ||
101 | + } | ||
102 | + | ||
103 | + //已添加证书下的证书集合 | ||
104 | + @FindBy (xpath = ".//*[@list='ctrl.model.supplierCertificationList']/div[1]/table/tbody/tr") | ||
105 | + List<WebElement> checkBoxes; | ||
106 | + | ||
107 | + //是否服务过大客户:是 | ||
108 | + @FindBy (xpath = ".//*[contains(text(),'是否服务过大客户')]/../div[1]/label[1]") | ||
109 | + WebElement isServLargeCus; | ||
110 | + | ||
111 | + //是否服务过大客户:否 | ||
112 | + @FindBy (xpath = ".//*[contains(text(),'是否服务过大客户')]/../div[1]/label[2]") | ||
113 | + WebElement notServLargeCus; | ||
114 | + | ||
115 | + //服务过的大客户数 | ||
116 | + @FindBy (xpath = ".//*[@list='ctrl.model.serviceLargeCustomerList']/div/table/tbody/tr") | ||
117 | + List<WebElement> customers; | ||
118 | + | ||
119 | + //大客户的“+” | ||
120 | + @FindBy (xpath = ".//*[@list='ctrl.model.serviceLargeCustomerList']/div/div/button[1]") | ||
121 | + WebElement addCustomer; | ||
122 | + | ||
123 | + //大客户名称文本框 | ||
124 | + public WebElement largeCusName(int i) { | ||
125 | + String xpath = ".//*[@list='ctrl.model.serviceLargeCustomerList']/div/table/tbody/tr["+i+"]/td[2]/input"; | ||
126 | + return driver.findElement(By.xpath(xpath)); | ||
127 | + } | ||
128 | + | ||
129 | + //备注文本框 | ||
130 | + public WebElement note(int i) { | ||
131 | + String xpath = ".//*[@list='ctrl.model.serviceLargeCustomerList']/div/table/tbody/tr["+i+"]/td[3]/input"; | ||
132 | + return driver.findElement(By.xpath(xpath)); | ||
133 | + } | ||
134 | + | ||
135 | + //确定按钮 | ||
136 | + @FindBy (xpath = "//*[text()='确定']") | ||
137 | + WebElement submit; | ||
138 | + | ||
139 | + //标签页名称 | ||
140 | + @FindBy (xpath ="//*/a[contains(text(),'综合实力评估')]") | ||
141 | + WebElement labelName; | ||
142 | + | ||
143 | + //提交完成后,操作成功的弹框关闭按钮 | ||
144 | + @FindBy (xpath="//*[@class='close']") | ||
145 | + WebElement alertClosed; | ||
146 | + | ||
147 | + //关闭页面 | ||
148 | + @FindBy(xpath = "//*[text()='综合实力评估']/../span") | ||
149 | + WebElement closed; | ||
150 | + | ||
151 | + | ||
152 | + /* | ||
153 | + * 方法 | ||
154 | + */ | ||
155 | + | ||
156 | + //选择配合度 | ||
157 | + public void selectCooperateDegree(String cooperateGrade) { | ||
158 | + | ||
159 | + //选择配合度:高、中、低 | ||
160 | + selectElement(cooperateDegree, cooperateGrade); | ||
161 | + | ||
162 | + } | ||
163 | + | ||
164 | + //是否有研发能力,参数可选 是/否 | ||
165 | + public void isDevAblity(String ablity) { | ||
166 | + if("是".equals(ablity)) | ||
167 | + click(isDev); | ||
168 | + else { | ||
169 | + click(notDev); | ||
170 | + } | ||
171 | + } | ||
172 | + | ||
173 | + // | ||
174 | + | ||
175 | + //提交编辑 | ||
176 | + public void submit() { | ||
177 | + moveHeightScroll("0"); | ||
178 | + click(submit); | ||
179 | + | ||
180 | + } | ||
181 | + | ||
182 | + //勾选每季度有新品推出 | ||
183 | + public void newProduct() { | ||
184 | + if(newGoodsEveryQuarter.isSelected());//判断是否已勾选 | ||
185 | + else { | ||
186 | + isElementExist(newGoodsEveryQuarter); | ||
187 | + click(newGoodsEveryQuarter); | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + //勾选有配备工程师 | ||
192 | + public void haveEngineer() { | ||
193 | + if(existsEngineer.isSelected()); | ||
194 | + else { | ||
195 | + isElementExist(existsEngineer); | ||
196 | + click(existsEngineer); | ||
197 | + } | ||
198 | + } | ||
199 | + | ||
200 | + //勾选有研发团队 | ||
201 | + public void haveTeam() { | ||
202 | + if (existsProductDev.isSelected()); | ||
203 | + else { | ||
204 | + isElementExist(existsProductDev); | ||
205 | + click(existsProductDev); | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + //勾选“其他” | ||
210 | + public void other() { | ||
211 | + if(others.isSelected()); | ||
212 | + else { | ||
213 | + click(others); | ||
214 | + isElementExist(otherDevAbilValue); | ||
215 | + sendKeys(otherDevAbilValue, "我们每天都有新品推出!"); | ||
216 | + } | ||
217 | + } | ||
218 | + | ||
219 | + | ||
220 | + //拖动滚动条,因为本页面如果数据量多,就看不到头部的关闭本页面的X | ||
221 | + public void moveScroll() { | ||
222 | + | ||
223 | + moveHeightScroll("100"); | ||
224 | + | ||
225 | + } | ||
226 | + | ||
227 | + //检查是否列表加载完成 | ||
228 | + public boolean isSucceed() throws InterruptedException { | ||
229 | + while(!(labelName.isDisplayed())) { | ||
230 | + Thread.sleep(1000); | ||
231 | + } | ||
232 | + return isElementExist(labelName); | ||
233 | + | ||
234 | + } | ||
235 | + | ||
236 | + //判断是否提交成功 | ||
237 | + public boolean isSubmit() { | ||
238 | + | ||
239 | + return isElementExist(alertClosed); | ||
240 | + | ||
241 | + } | ||
242 | + | ||
243 | + //关闭“操作成功”提示 | ||
244 | + public void alertClosed() { | ||
245 | + click(alertClosed); | ||
246 | + } | ||
247 | + | ||
248 | + /* | ||
249 | + * 添加证书逻辑: | ||
250 | + * 1.点击是否有证书:是 | ||
251 | + * 2.点击“+” | ||
252 | + * 3.统计已有x个证书 | ||
253 | + * 4.i=x | ||
254 | + * 5.选择证书类型WRAP,证书编号,证书说明,传证书图片 | ||
255 | + * 6.判断证书是否上传成功,不成功则等待 | ||
256 | + */ | ||
257 | + public void addCertification() throws Exception { | ||
258 | + click(isCertificate); | ||
259 | + isElementExist(addCertificate); | ||
260 | + click(addCertificate); | ||
261 | + | ||
262 | + List<WebElement> list= checkBoxes; | ||
263 | + int x = list.size(); | ||
264 | + | ||
265 | + selectElement(itemType(x), "WRAP"); | ||
266 | + sendKeys(itemCode(x), "20180331:"+x); | ||
267 | + sendKeys(itemDec(x), "证书说明:这是第"+x+"个证书"); | ||
268 | + click(itemFile(x)); | ||
269 | + uploadFile("E:\\pic\\证书.jpg"); | ||
270 | + | ||
271 | + //如果图片是系统默认的图片,则等待1秒 | ||
272 | + while("/img/nopic.jpg".equals(imge(x).getAttribute("ng-src"))) { | ||
273 | + Thread.sleep(1000); | ||
274 | + } | ||
275 | + } | ||
276 | + | ||
277 | + /* | ||
278 | + * 添加服务大客户记录 | ||
279 | + * 先把滚动条拉下来,不然找不到元素 | ||
280 | + * 1.是否服务过大客户,点击:是 | ||
281 | + * 2.点击“+” | ||
282 | + * 3.判断已有服务过的次数x,i=x | ||
283 | + * 4.写入大客户名称,备注 | ||
284 | + */ | ||
285 | + public void addSerLargeCus() { | ||
286 | + moveHeightScroll("0"); | ||
287 | + click(isServLargeCus); | ||
288 | + isElementExist(addCustomer); | ||
289 | + click(addCustomer); | ||
290 | + List<WebElement> list = customers; | ||
291 | + int x = list.size(); | ||
292 | + sendKeys(largeCusName(x), "第"+x+"大客户"); | ||
293 | + sendKeys(note(x), "这个是备注信息"+x); | ||
294 | + } | ||
295 | + | ||
296 | + //选择主打产品 | ||
297 | + public void selMainProduct(String degree) { | ||
298 | + selectElement(mainProduct, degree); | ||
299 | + } | ||
300 | + | ||
301 | + //关闭本页面 | ||
302 | + public void closed() { | ||
303 | + | ||
304 | + click(closed); | ||
305 | + | ||
306 | + } | ||
307 | +} |
src/main/java/com/essa/pageObject/buyPlaneManage/SkuCategoryManagerCongfigPage.java
0 → 100644
@@ -0,0 +1,84 @@ | @@ -0,0 +1,84 @@ | ||
1 | +package com.essa.pageObject.buyPlaneManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | +import com.essa.framework.Model; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author Administrator | ||
12 | + *商品类目经理管理配置页 | ||
13 | + */ | ||
14 | +public class SkuCategoryManagerCongfigPage extends BasePage { | ||
15 | + public SkuCategoryManagerCongfigPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + /* | ||
19 | + * 页面元素定位 | ||
20 | + */ | ||
21 | + | ||
22 | + //查询输入框 | ||
23 | + @FindBy (xpath="//*[@placeholder='请输入关键信息查询']") | ||
24 | + WebElement searchContent; | ||
25 | + | ||
26 | + //高级查询 | ||
27 | + @FindBy (xpath="//*[contains(text(),'高级查询')]") | ||
28 | + WebElement advancedQuery; | ||
29 | + | ||
30 | + //sku编号 | ||
31 | + @FindBy (xpath="//*[contains(text(),'SKU编号')]/../div/input") | ||
32 | + WebElement skuNoQuery; | ||
33 | + | ||
34 | + //高级查询按钮 | ||
35 | + @FindBy (xpath="//*[text()='查询']") | ||
36 | + WebElement query; | ||
37 | + | ||
38 | + //查询按钮 | ||
39 | + @FindBy (xpath="//*[@ng-click='search()']") | ||
40 | + WebElement search; | ||
41 | + | ||
42 | + //右下角分页的GO按钮,用作检查点,等待页面加载完成 | ||
43 | + @FindBy (xpath="//*[text()='GO']") | ||
44 | + WebElement checkPoint; | ||
45 | + | ||
46 | + //列表第一条数据的复选框 | ||
47 | + @FindBy (xpath="//*[@ng-table='tableParams']/tbody/tr[1]/td[1]/input") | ||
48 | + WebElement firstCheckBox; | ||
49 | + | ||
50 | + //分配类目经理 | ||
51 | + @FindBy (xpath="//*[text()='分配类目经理']") | ||
52 | + WebElement distribute; | ||
53 | + | ||
54 | + //选择类目经理 | ||
55 | + @FindBy (xpath="//*[@ng-model='mgrOpt']") | ||
56 | + WebElement selectManager; | ||
57 | + | ||
58 | + //确认类目经理 | ||
59 | + @FindBy(xpath="//*[text()='确认']") | ||
60 | + WebElement confirm; | ||
61 | + | ||
62 | + /* | ||
63 | + * 页面方法 | ||
64 | + */ | ||
65 | + | ||
66 | + /** | ||
67 | + * 商品分配类目经理 | ||
68 | + * @return SkuCategoryManagerCongfigPage | ||
69 | + */ | ||
70 | + public SkuCategoryManagerCongfigPage distributeManager() { | ||
71 | + forceWait(1000); | ||
72 | + mywait(advancedQuery); | ||
73 | + click(advancedQuery); | ||
74 | + sendKeys(skuNoQuery, Model.getSkuNo()); | ||
75 | + click(query); | ||
76 | + mywait(firstCheckBox); | ||
77 | + click(firstCheckBox); | ||
78 | + click(distribute); | ||
79 | + mywait(confirm); | ||
80 | + selectElement(selectManager, "林荣"); | ||
81 | + click(confirm); | ||
82 | + return new SkuCategoryManagerCongfigPage(driver); | ||
83 | + } | ||
84 | +} |
src/main/java/com/essa/pageObject/buyerManage/InvateCodePage.java
0 → 100644
@@ -0,0 +1,69 @@ | @@ -0,0 +1,69 @@ | ||
1 | +package com.essa.pageObject.buyerManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | +import com.essa.framework.Model; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author Administrator | ||
12 | + *邀请码生成页面 | ||
13 | + */ | ||
14 | +public class InvateCodePage extends BasePage { | ||
15 | + public InvateCodePage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + /* | ||
19 | + * 元素定位 | ||
20 | + */ | ||
21 | + | ||
22 | + //第一个业务员复选框 | ||
23 | + @FindBy(xpath ="//*[text()='选择人员']/../div/dl/dd[1]/b/input") | ||
24 | + WebElement firstCheckbox; | ||
25 | + | ||
26 | + //推广方式 | ||
27 | + @FindBy (xpath="//select[contains(@ng-change,'changeChannelList')]") | ||
28 | + WebElement spreadForm; | ||
29 | + | ||
30 | + //推广渠道 | ||
31 | + @FindBy (xpath="//select[@ng-model='parame.create.promoteChannelId']") | ||
32 | + WebElement spreadChannel; | ||
33 | + | ||
34 | + //生成 | ||
35 | + @FindBy (xpath="//button[contains(text(),'生成')]") | ||
36 | + WebElement create; | ||
37 | + | ||
38 | + //确认 | ||
39 | + @FindBy (xpath ="//*[text()='确认']") | ||
40 | + WebElement confirm; | ||
41 | + | ||
42 | + //关闭 | ||
43 | + @FindBy (xpath ="//*[text()='关闭']") | ||
44 | + WebElement close; | ||
45 | + | ||
46 | + //生成的邀请码 | ||
47 | + @FindBy (xpath="//tbody[@class='ng-scope']/tr[1]/td[5]") | ||
48 | + WebElement invateCode; | ||
49 | + | ||
50 | + /* | ||
51 | + * 页面方法 | ||
52 | + */ | ||
53 | + /** | ||
54 | + * 生成邀请码 | ||
55 | + */ | ||
56 | + public void generateCode() { | ||
57 | + mywait(firstCheckbox); | ||
58 | + click(firstCheckbox); | ||
59 | + selectElement(spreadForm, "搜索引擎"); | ||
60 | + selectElement(spreadChannel, "Google"); | ||
61 | + click(create); | ||
62 | + forceWait(500); | ||
63 | + click(confirm); | ||
64 | + forceWait(500); | ||
65 | + click(close); | ||
66 | + String code = invateCode.getText(); | ||
67 | + Model.setInvateCode(code); | ||
68 | + } | ||
69 | +} |
src/main/java/com/essa/pageObject/inquiryManage/ProductInquiryFeedbackPage.java
0 → 100644
@@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
1 | +package com.essa.pageObject.inquiryManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator 成品询价反馈页 | ||
13 | + */ | ||
14 | +public class ProductInquiryFeedbackPage extends BasePage { | ||
15 | + public ProductInquiryFeedbackPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + // 查询类型 | ||
23 | + @FindBy(xpath = "//*[@ng-change='changeSearchType()']") | ||
24 | + WebElement searchType; | ||
25 | + | ||
26 | + // 查询条件输入框 | ||
27 | + @FindBy(xpath = "//*[@placeholder='请输入查询条件']") | ||
28 | + WebElement searchText; | ||
29 | + | ||
30 | + // 查询按钮 | ||
31 | + @FindBy(xpath = "//button[@ng-click='getFeedbackDetailBySearchInfo()']") | ||
32 | + WebElement search; | ||
33 | + | ||
34 | + // 单箱金额 | ||
35 | + @FindBy(xpath = "//*[contains(text(),'单箱金额')]") | ||
36 | + WebElement singlePrice; | ||
37 | + | ||
38 | + // 待反馈任务 | ||
39 | + @FindBy(xpath = "//*[contains(text(),'待反馈任务')]") | ||
40 | + WebElement waitFeedback; | ||
41 | + | ||
42 | + // 提交审核 | ||
43 | + @FindBy(xpath = "//*[@ng-click='submitFeedback(1)']") | ||
44 | + WebElement submit; | ||
45 | + | ||
46 | + /* | ||
47 | + * 页面方法 | ||
48 | + */ | ||
49 | + /** | ||
50 | + * 提交询价任务 | ||
51 | + * | ||
52 | + * @return ProductInquiryTask | ||
53 | + */ | ||
54 | + public ProductInquiryTaskPage submit() { | ||
55 | + // 根据单箱价格是否为空来判断页面是否加载成功 | ||
56 | + for (int count = 0;"单箱金额:".equals(getText(singlePrice))&& count < 7;count++) { | ||
57 | + forceWait(1000); | ||
58 | + } | ||
59 | + selectElement(searchType, "商品编号"); | ||
60 | + sendKeys(searchText, Model.getSkuNo()); | ||
61 | + // 根据sku编号来判断是否加载出想要的sku信息 | ||
62 | + click(search); | ||
63 | +// boolean b = isVisibility(By.xpath("//*[contains(text(),'" + Model.getSkuNo() + "')]")); | ||
64 | +// while (!b) { | ||
65 | +// forceWait(1000); | ||
66 | +// } | ||
67 | + dynamicWait(By.xpath("//*[contains(text(),'" + Model.getSkuNo() + "')]")); | ||
68 | + click(waitFeedback); | ||
69 | + // 判断是否加载待反馈视图 | ||
70 | +// boolean b1 = isVisibility(By.xpath("//*[contains(text(),'询价要求完成时间')]")); | ||
71 | +// while (!b1) { | ||
72 | +// forceWait(1000); | ||
73 | +// } | ||
74 | + dynamicWait(By.xpath("//*[contains(text(),'询价要求完成时间')]")); | ||
75 | + moveHeightScroll("100"); | ||
76 | + click(submit); | ||
77 | + return new ProductInquiryTaskPage(driver); | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 根据PO单,询价 | ||
82 | + * @return | ||
83 | + */ | ||
84 | + public ProductInquiryTaskPage POsubmit() { | ||
85 | + // 根据单箱价格是否为空来判断页面是否加载成功 | ||
86 | + for (int count=0;"单箱金额:".equals(getText(singlePrice))&&count<7;count++) { | ||
87 | + forceWait(1000); | ||
88 | + } | ||
89 | + selectElement(searchType, "来源PO单/成品采购单号"); | ||
90 | + sendKeys(searchText, Model.getPoNum()); | ||
91 | + click(search); | ||
92 | +// while (!(isVisibility(By.xpath("//*[@id='mask' and @style='display: none;']")))) { | ||
93 | +// forceWait(1000); | ||
94 | +// } | ||
95 | + dynamicLoad(By.xpath("//*[@id='mask' and @style='display: none;']")); | ||
96 | + forceWait(1000); | ||
97 | + click(waitFeedback); | ||
98 | + dynamicWait(By.xpath("//*[contains(text(),'询价要求完成时间')]")); | ||
99 | + moveHeightScroll("100"); | ||
100 | + toSubmit(); | ||
101 | + return new ProductInquiryTaskPage(driver); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 如果【提交审核】在页面中存在,则一直点击,最多等7秒 | ||
106 | + */ | ||
107 | + private void toSubmit() { | ||
108 | + for (int count =0;isVisibility(By.xpath("//*[@ng-click='submitFeedback(1)']"))&&count<7;count++) { | ||
109 | + click(submit); | ||
110 | + forceWait(1000); | ||
111 | + } | ||
112 | + } | ||
113 | +} |
src/main/java/com/essa/pageObject/inquiryManage/ProductInquiryTaskPage.java
0 → 100644
@@ -0,0 +1,121 @@ | @@ -0,0 +1,121 @@ | ||
1 | +package com.essa.pageObject.inquiryManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator 成品询价任务列表 | ||
13 | + */ | ||
14 | +public class ProductInquiryTaskPage extends BasePage { | ||
15 | + public ProductInquiryTaskPage(WebDriver driver) { | ||
16 | + super(driver); | ||
17 | + } | ||
18 | + | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + // 高级查询 | ||
23 | + @FindBy(xpath = "//*[contains(text(),'高级查询')]") | ||
24 | + WebElement advancedQuery; | ||
25 | + | ||
26 | + // 商品编码查询 | ||
27 | + @FindBy(xpath = "//*[text()='商品编码']/../div/input") | ||
28 | + WebElement skuNoQuery; | ||
29 | + | ||
30 | + // 根据PO查询 | ||
31 | + @FindBy(xpath = "//*[text()='来源单号']/../div[1]/input") | ||
32 | + WebElement POQuery; | ||
33 | + | ||
34 | + // 高级查询-查询按钮 | ||
35 | + @FindBy(xpath = "//*[@name='advSearch']/div[12]/button[1]") | ||
36 | + WebElement search; | ||
37 | + | ||
38 | + // 列表第一行数据 | ||
39 | + @FindBy(xpath = "//*[@ng-table='tableParams1']/tbody/tr[1]") | ||
40 | + WebElement firstRow; | ||
41 | + | ||
42 | + // 询价反馈 | ||
43 | + @FindBy(xpath = "//*[contains(text(),'询价反馈')]") | ||
44 | + WebElement feedBack; | ||
45 | + | ||
46 | + // 暂无数据--用于检查是否已经成功 | ||
47 | + @FindBy(xpath = "//*[text()='暂无数据']") | ||
48 | + WebElement isSucceed; | ||
49 | + | ||
50 | + /* | ||
51 | + * 页面方法 | ||
52 | + */ | ||
53 | + /** | ||
54 | + * 查出要成品询价的商品,进入成品询价反馈页面 | ||
55 | + * | ||
56 | + * @return ProductInquiryFeedback | ||
57 | + */ | ||
58 | + public ProductInquiryFeedbackPage toFeedback() { | ||
59 | +// mywait(firstRow); | ||
60 | + click(advancedQuery); | ||
61 | + sendKeys(skuNoQuery, Model.getSkuNo()); | ||
62 | + click(search); | ||
63 | + mywait(firstRow); | ||
64 | + click(firstRow); | ||
65 | + click(feedBack); | ||
66 | + return new ProductInquiryFeedbackPage(driver); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 判断页面是否查询不到该商品 | ||
71 | + * | ||
72 | + * @return boolean | ||
73 | + */ | ||
74 | + public boolean isSucceed() { | ||
75 | + click(advancedQuery); | ||
76 | + sendKeys(skuNoQuery, Model.getSkuNo()); | ||
77 | + click(search); | ||
78 | + forceWait(1000); | ||
79 | + return isVisibility(By.xpath("//*[text()='暂无数据']")); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 判断根据po单查询,是否全部询价完成 | ||
84 | + * | ||
85 | + * @return boolean | ||
86 | + */ | ||
87 | + public boolean isPOSucceed() { | ||
88 | + forceWait(1000); | ||
89 | + return isVisibility(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * 根据PO单号查询询价 | ||
94 | + * | ||
95 | + * @return 询价反馈页面 | ||
96 | + */ | ||
97 | + public ProductInquiryFeedbackPage POtoFeedback() { | ||
98 | + dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | ||
99 | + click(advancedQuery); | ||
100 | + sendKeys(POQuery, Model.getPoNum()); | ||
101 | + click(search); | ||
102 | + dynamicWait(By.xpath("//*[@id='mask' and @style='display: none;']")); | ||
103 | +// dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | ||
104 | +// mywait(firstRow); | ||
105 | +// forceWait(2000); | ||
106 | + click(firstRow); | ||
107 | + click(feedBack); | ||
108 | + return new ProductInquiryFeedbackPage(driver); | ||
109 | + } | ||
110 | + | ||
111 | + /** | ||
112 | + * 如果列表中还存在待询价的单,循环方法,继续询价 | ||
113 | + * | ||
114 | + * @return | ||
115 | + */ | ||
116 | + public ProductInquiryFeedbackPage POcircle() { | ||
117 | + click(firstRow); | ||
118 | + click(feedBack); | ||
119 | + return new ProductInquiryFeedbackPage(driver); | ||
120 | + } | ||
121 | +} |
src/main/java/com/essa/pageObject/marketingManage/CollectBillControlPage.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.essa.pageObject.marketingManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | + | ||
5 | +import com.essa.framework.BasePage; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Administrator | ||
9 | + *集单控制 | ||
10 | + */ | ||
11 | +public class CollectBillControlPage extends BasePage { | ||
12 | + public CollectBillControlPage(WebDriver driver) { | ||
13 | + super(driver); | ||
14 | + } | ||
15 | +} |
src/main/java/com/essa/pageObject/marketingManage/CollectBillSettingPage.java
0 → 100644
@@ -0,0 +1,223 @@ | @@ -0,0 +1,223 @@ | ||
1 | +package com.essa.pageObject.marketingManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *集单设置 | ||
14 | + */ | ||
15 | +public class CollectBillSettingPage extends BasePage { | ||
16 | + public CollectBillSettingPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //添加商品-查询输入框 | ||
24 | + @FindBy (xpath = "//*[@name='keyword']") | ||
25 | + WebElement searchContent; | ||
26 | + | ||
27 | + //团购设置中的关键字输入框 | ||
28 | + @FindBy (xpath="//*[@ng-model='searchKeyword']") | ||
29 | + WebElement content; | ||
30 | + | ||
31 | + //查询按钮 | ||
32 | + @FindBy (xpath = "//button[@ng-click='gotoSearch()']") | ||
33 | + WebElement search; | ||
34 | + | ||
35 | + //添加商品 | ||
36 | + @FindBy (xpath = "//*[text()='添加商品']") | ||
37 | + WebElement addSku; | ||
38 | + | ||
39 | + //loading,判断是否加载完成 | ||
40 | + @FindBy (xpath="//*[@class='loading ng-scope']") | ||
41 | + WebElement loading; | ||
42 | + | ||
43 | + //查询列表中的第一个复选框 | ||
44 | + @FindBy (xpath = "//*[@class='table marketing-collectbill-products']/tbody/tr[1]/td[1]/input") | ||
45 | + WebElement firstCheckBox; | ||
46 | + | ||
47 | + //MOQ设置 | ||
48 | + @FindBy (xpath = "//*[text()='MOQ设置']") | ||
49 | + WebElement MOQSet; | ||
50 | + | ||
51 | + //阶梯价 | ||
52 | + @FindBy (xpath = "//*[text()='阶梯价']") | ||
53 | + WebElement setPrice; | ||
54 | + | ||
55 | + //配置主推市场 | ||
56 | + @FindBy (xpath = "//*[text()='配置主推市场']") | ||
57 | + WebElement mainMarket; | ||
58 | + | ||
59 | + //发布商品 | ||
60 | + @FindBy (xpath = "//*[text()='发布商品']") | ||
61 | + WebElement publishSku; | ||
62 | + | ||
63 | + //添加商品-查询按钮 | ||
64 | + @FindBy (xpath = "//*[@ng-click='search(false)']") | ||
65 | + WebElement addSkuSearch; | ||
66 | + | ||
67 | + //添加商品-展开商品信息 | ||
68 | + @FindBy (xpath = "//*[contains(@class,'fa fa-angle-double-dow')]") | ||
69 | + WebElement showSku; | ||
70 | + | ||
71 | + //添加商品-搜索结果复选框 | ||
72 | + @FindBy (xpath = "//*[@ng-repeat='list in item.skus']/tbody/tr[1]/td[1]/input") | ||
73 | + WebElement skuCheckbox; | ||
74 | + | ||
75 | + //确定按钮 | ||
76 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | ||
77 | + WebElement confirm; | ||
78 | + | ||
79 | + //活动成功MOQ | ||
80 | + @FindBy (xpath = "//*[@ng-model='activitySuccessMoq']") | ||
81 | + WebElement successMoq; | ||
82 | + | ||
83 | + //活动销售MOQ | ||
84 | + @FindBy (xpath = "//*[@ng-model='activitySaleMoq']") | ||
85 | + WebElement saleMoq; | ||
86 | + | ||
87 | + //成本价格 | ||
88 | + @FindBy (xpath = "//*[contains(text(),'成本')]") | ||
89 | + WebElement firstCost; | ||
90 | + | ||
91 | + //最低价 | ||
92 | + @FindBy (xpath = "//*[@ng-model='minPrice']") | ||
93 | + WebElement minPrice; | ||
94 | + | ||
95 | + //最高价 | ||
96 | + @FindBy (xpath = "//*[@ng-model='maxPrice']") | ||
97 | + WebElement maxPrice; | ||
98 | + | ||
99 | + //阶梯数 | ||
100 | + @FindBy (xpath = "//*[@ng-model='ladderCount']") | ||
101 | + WebElement ladderCount; | ||
102 | + | ||
103 | + //生成阶梯 | ||
104 | + @FindBy (xpath = "//*[text()='生成阶梯']") | ||
105 | + WebElement creatLadder; | ||
106 | + | ||
107 | + //可选区域-东欧 | ||
108 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[1]/input") | ||
109 | + WebElement easternEurope; | ||
110 | + | ||
111 | + //可选区域-南美 | ||
112 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[2]/input") | ||
113 | + WebElement southAmerican; | ||
114 | + | ||
115 | + //可选区域-欧美 | ||
116 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[3]/input") | ||
117 | + WebElement europeAndAmerica; | ||
118 | + | ||
119 | + //可选区域-东南亚 | ||
120 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[4]/input") | ||
121 | + WebElement southeastAsia; | ||
122 | + | ||
123 | + //可选区域-中东 | ||
124 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[5]/input") | ||
125 | + WebElement middleEast; | ||
126 | + | ||
127 | + /* | ||
128 | + * 页面方法 | ||
129 | + */ | ||
130 | + /** | ||
131 | + * 添加商品 | ||
132 | + */ | ||
133 | + public void addSku() { | ||
134 | + mywait(addSku); | ||
135 | + click(addSku); | ||
136 | + /*while (isVisibility(By.xpath("//*[@class='loading ng-scope']"))) { | ||
137 | + forceWait(1000); | ||
138 | + };*/ | ||
139 | + dynamicLoad(By.xpath("//*[@class='loading ng-scope']")); | ||
140 | + sendKeys(searchContent, Model.getSkuNo()); | ||
141 | + click(addSkuSearch); | ||
142 | + forceWait(1000); | ||
143 | + click(showSku); | ||
144 | + click(skuCheckbox); | ||
145 | + click(confirm); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 设置MOQ | ||
150 | + */ | ||
151 | + public void setMoq() { | ||
152 | + forceWait(1000); | ||
153 | + mywait(firstCheckBox); | ||
154 | + sendKeys(content, Model.getSkuNo()); | ||
155 | + click(search); | ||
156 | + mywait(firstCheckBox); | ||
157 | + click(firstCheckBox); | ||
158 | + click(MOQSet); | ||
159 | +//===================================================================此处要修改 | ||
160 | + sendKeys(successMoq, "150"); | ||
161 | + sendKeys(saleMoq, "15"); | ||
162 | + click(confirm); | ||
163 | + } | ||
164 | + /** | ||
165 | + * 设置阶梯价 | ||
166 | + */ | ||
167 | + public void setPrice() { | ||
168 | + forceWait(1000); | ||
169 | + click(setPrice); | ||
170 | + mywait(creatLadder); | ||
171 | + int firstCost = getFirstCost(); | ||
172 | + sendKeys(minPrice, firstCost+30+""); | ||
173 | + sendKeys(maxPrice, firstCost+100+""); | ||
174 | + sendKeys(ladderCount, "2"); | ||
175 | + click(creatLadder); | ||
176 | + forceWait(1000); | ||
177 | + click(confirm); | ||
178 | + } | ||
179 | + /** | ||
180 | + * 设置主推市场 | ||
181 | + */ | ||
182 | + public void setMarket() { | ||
183 | + forceWait(1000); | ||
184 | + click(mainMarket); | ||
185 | + mywait(easternEurope); | ||
186 | + click(easternEurope); | ||
187 | + click(southAmerican); | ||
188 | + click(easternEurope); | ||
189 | + click(southeastAsia); | ||
190 | + click(middleEast); | ||
191 | + forceWait(500); | ||
192 | + click(confirm); | ||
193 | + forceWait(1000); | ||
194 | + click(confirm); | ||
195 | + } | ||
196 | + | ||
197 | + /** | ||
198 | + * 组装以上操作 | ||
199 | + * 添加商品并发布团购 | ||
200 | + * @return GroupSettingPage | ||
201 | + */ | ||
202 | + public GroupSettingPage publishGroup() { | ||
203 | + addSku(); | ||
204 | + setMoq(); | ||
205 | + setPrice(); | ||
206 | + setMarket(); | ||
207 | + forceWait(1000); | ||
208 | + click(publishSku); | ||
209 | + forceWait(1000); | ||
210 | + click(confirm); | ||
211 | + return new GroupSettingPage(driver); | ||
212 | + } | ||
213 | + | ||
214 | + /** | ||
215 | + * 获取到商品的成本价 | ||
216 | + * @return price | ||
217 | + */ | ||
218 | + private int getFirstCost() { | ||
219 | + String p = partialStr(firstCost.getText(), "成本:¥"); | ||
220 | + int price = Integer.parseInt(p); | ||
221 | + return price; | ||
222 | + } | ||
223 | +} |
src/main/java/com/essa/pageObject/marketingManage/GroupControlPage.java
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +package com.essa.pageObject.marketingManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *团购控制 | ||
14 | + */ | ||
15 | +public class GroupControlPage extends BasePage { | ||
16 | + public GroupControlPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + /* | ||
20 | + * 页面元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //关键字查询输入 | ||
24 | + @FindBy (xpath = "//*[@ng-model='searchKeyword']") | ||
25 | + WebElement searchKeyword; | ||
26 | + | ||
27 | + //查询按钮 | ||
28 | + @FindBy (xpath = "//*[@ng-click='gotoSearch()']") | ||
29 | + WebElement search; | ||
30 | + | ||
31 | + /* | ||
32 | + * 页面方法 | ||
33 | + */ | ||
34 | + /** | ||
35 | + * 判断团购的商品是否发布成功 | ||
36 | + * @return boolean | ||
37 | + */ | ||
38 | + public boolean isSuccess() { | ||
39 | + mywait(searchKeyword); | ||
40 | + sendKeys(searchKeyword, Model.getSkuNo()); | ||
41 | + click(search); | ||
42 | + forceWait(1500); | ||
43 | + return isVisibility(By.xpath("//*[contains(text(),'"+Model.getSkuNo()+"')]")); | ||
44 | + } | ||
45 | +} |
src/main/java/com/essa/pageObject/marketingManage/GroupSettingPage.java
0 → 100644
@@ -0,0 +1,222 @@ | @@ -0,0 +1,222 @@ | ||
1 | +package com.essa.pageObject.marketingManage; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
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 | +import com.essa.framework.Model; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Administrator | ||
13 | + *团购设置 | ||
14 | + */ | ||
15 | +public class GroupSettingPage extends BasePage { | ||
16 | + public GroupSettingPage(WebDriver driver) { | ||
17 | + super(driver); | ||
18 | + } | ||
19 | + /* | ||
20 | + * 元素定位 | ||
21 | + */ | ||
22 | + | ||
23 | + //添加商品-查询输入框 | ||
24 | + @FindBy (xpath = "//*[@name='keyword']") | ||
25 | + WebElement searchContent; | ||
26 | + | ||
27 | + //团购设置中的关键字输入框 | ||
28 | + @FindBy (xpath="//*[@ng-model='searchKeyword']") | ||
29 | + WebElement content; | ||
30 | + | ||
31 | + //查询按钮 | ||
32 | + @FindBy (xpath = "//button[@ng-click='gotoSearch()']") | ||
33 | + WebElement search; | ||
34 | + | ||
35 | + //添加商品 | ||
36 | + @FindBy (xpath = "//*[text()='添加商品']") | ||
37 | + WebElement addSku; | ||
38 | + | ||
39 | + //loading,判断是否加载完成 | ||
40 | + @FindBy (xpath="//*[@class='loading ng-scope']") | ||
41 | + WebElement loading; | ||
42 | + | ||
43 | + //查询列表中的第一个复选框 | ||
44 | + @FindBy (xpath = "//*[@class='table marketing-collectbill-products']/tbody/tr[1]/td[1]/input") | ||
45 | + WebElement firstCheckBox; | ||
46 | + | ||
47 | + //MOQ设置 | ||
48 | + @FindBy (xpath = "//*[text()='MOQ设置']") | ||
49 | + WebElement MOQSet; | ||
50 | + | ||
51 | + //阶梯价 | ||
52 | + @FindBy (xpath = "//*[text()='阶梯价']") | ||
53 | + WebElement setPrice; | ||
54 | + | ||
55 | + //配置主推市场 | ||
56 | + @FindBy (xpath = "//*[text()='配置主推市场']") | ||
57 | + WebElement mainMarket; | ||
58 | + | ||
59 | + //发布商品 | ||
60 | + @FindBy (xpath = "//*[text()='发布商品']") | ||
61 | + WebElement publishSku; | ||
62 | + | ||
63 | + //添加商品-查询按钮 | ||
64 | + @FindBy (xpath = "//*[@ng-click='search(false)']") | ||
65 | + WebElement addSkuSearch; | ||
66 | + | ||
67 | + //添加商品-展开商品信息 | ||
68 | + @FindBy (xpath = "//*[contains(@class,'fa fa-angle-double-dow')]") | ||
69 | + WebElement showSku; | ||
70 | + | ||
71 | + //添加商品-搜索结果复选框 | ||
72 | + @FindBy (xpath = "//*[@ng-repeat='list in item.skus']/tbody/tr[1]/td[1]/input") | ||
73 | + WebElement skuCheckbox; | ||
74 | + | ||
75 | + //确定按钮 | ||
76 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | ||
77 | + WebElement confirm; | ||
78 | + | ||
79 | + //活动成功MOQ | ||
80 | + @FindBy (xpath = "//*[@ng-model='activitySuccessMoq']") | ||
81 | + WebElement successQoq; | ||
82 | + | ||
83 | + //活动销售MOQ | ||
84 | + @FindBy (xpath = "//*[@ng-model='activitySaleMoq']") | ||
85 | + WebElement saleQoq; | ||
86 | + | ||
87 | + //成本价格 | ||
88 | + @FindBy (xpath = "//*[contains(text(),'成本')]") | ||
89 | + WebElement firstCost; | ||
90 | + | ||
91 | + //最低价 | ||
92 | + @FindBy (xpath = "//*[@ng-model='minPrice']") | ||
93 | + WebElement minPrice; | ||
94 | + | ||
95 | + //最高价 | ||
96 | + @FindBy (xpath = "//*[@ng-model='maxPrice']") | ||
97 | + WebElement maxPrice; | ||
98 | + | ||
99 | + //阶梯数 | ||
100 | + @FindBy (xpath = "//*[@ng-model='ladderCount']") | ||
101 | + WebElement ladderCount; | ||
102 | + | ||
103 | + //生成阶梯 | ||
104 | + @FindBy (xpath = "//*[text()='生成阶梯']") | ||
105 | + WebElement creatLadder; | ||
106 | + | ||
107 | + //可选区域-东欧 | ||
108 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[1]/input") | ||
109 | + WebElement easternEurope; | ||
110 | + | ||
111 | + //可选区域-南美 | ||
112 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[2]/input") | ||
113 | + WebElement southAmerican; | ||
114 | + | ||
115 | + //可选区域-欧美 | ||
116 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[3]/input") | ||
117 | + WebElement europeAndAmerica; | ||
118 | + | ||
119 | + //可选区域-东南亚 | ||
120 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[4]/input") | ||
121 | + WebElement southeastAsia; | ||
122 | + | ||
123 | + //可选区域-中东 | ||
124 | + @FindBy (xpath = "//*[contains(text(),'可选择的市场区域')]/../dd/span[5]/input") | ||
125 | + WebElement middleEast; | ||
126 | + | ||
127 | + /* | ||
128 | + * 页面方法 | ||
129 | + */ | ||
130 | + /** | ||
131 | + * 添加商品 | ||
132 | + */ | ||
133 | + public void addSku() { | ||
134 | + mywait(addSku); | ||
135 | + click(addSku); | ||
136 | + /*while (isVisibility(By.xpath("//*[@class='loading ng-scope']"))) { | ||
137 | + forceWait(1000); | ||
138 | + };*/ | ||
139 | + dynamicLoad(By.xpath("//*[@class='loading ng-scope']")); | ||
140 | + sendKeys(searchContent, Model.getSkuNo()); | ||
141 | + click(addSkuSearch); | ||
142 | + forceWait(1000); | ||
143 | + click(showSku); | ||
144 | + click(skuCheckbox); | ||
145 | + click(confirm); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 设置MOQ | ||
150 | + */ | ||
151 | + public void setMoq() { | ||
152 | + forceWait(1000); | ||
153 | + mywait(firstCheckBox); | ||
154 | + sendKeys(content, Model.getSkuNo()); | ||
155 | + click(search); | ||
156 | + mywait(firstCheckBox); | ||
157 | + click(firstCheckBox); | ||
158 | + click(MOQSet); | ||
159 | + sendKeys(successQoq, "150"); | ||
160 | + sendKeys(saleQoq, "15"); | ||
161 | + click(confirm); | ||
162 | + } | ||
163 | + /** | ||
164 | + * 设置阶梯价 | ||
165 | + */ | ||
166 | + public void setPrice() { | ||
167 | + forceWait(1000); | ||
168 | + click(setPrice); | ||
169 | + mywait(creatLadder); | ||
170 | + int firstCost = getFirstCost(); | ||
171 | + sendKeys(minPrice, firstCost+30+""); | ||
172 | + sendKeys(maxPrice, firstCost+100+""); | ||
173 | + sendKeys(ladderCount, "2"); | ||
174 | + click(creatLadder); | ||
175 | + forceWait(1000); | ||
176 | + click(confirm); | ||
177 | + } | ||
178 | + /** | ||
179 | + * 设置主推市场 | ||
180 | + */ | ||
181 | + public void setMarket() { | ||
182 | + forceWait(1000); | ||
183 | + click(mainMarket); | ||
184 | + mywait(easternEurope); | ||
185 | + click(easternEurope); | ||
186 | + click(southAmerican); | ||
187 | + click(easternEurope); | ||
188 | + click(southeastAsia); | ||
189 | + click(middleEast); | ||
190 | + forceWait(500); | ||
191 | + click(confirm); | ||
192 | + forceWait(1000); | ||
193 | + click(confirm); | ||
194 | + } | ||
195 | + | ||
196 | + /** | ||
197 | + * 组装以上操作 | ||
198 | + * 添加商品并发布团购 | ||
199 | + * @return GroupSettingPage | ||
200 | + */ | ||
201 | + public GroupSettingPage publishGroup() { | ||
202 | + addSku(); | ||
203 | + setMoq(); | ||
204 | + setPrice(); | ||
205 | + setMarket(); | ||
206 | + forceWait(1000); | ||
207 | + click(publishSku); | ||
208 | + forceWait(1000); | ||
209 | + click(confirm); | ||
210 | + return new GroupSettingPage(driver); | ||
211 | + } | ||
212 | + | ||
213 | + /** | ||
214 | + * 获取到商品的成本价 | ||
215 | + * @return price | ||
216 | + */ | ||
217 | + private int getFirstCost() { | ||
218 | + String p = partialStr(firstCost.getText(), "成本:¥"); | ||
219 | + int price = Integer.parseInt(p); | ||
220 | + return price; | ||
221 | + } | ||
222 | +} |
src/main/java/com/essa/pageObject/needDealt/NeedDealtApplyPage.java
0 → 100644
@@ -0,0 +1,171 @@ | @@ -0,0 +1,171 @@ | ||
1 | +package com.essa.pageObject.needDealt; | ||
2 | + | ||
3 | +import org.openqa.selenium.By; | ||
4 | +import org.openqa.selenium.JavascriptExecutor; | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.WebElement; | ||
7 | +import org.openqa.selenium.support.FindBy; | ||
8 | + | ||
9 | +import com.essa.framework.BasePage; | ||
10 | +import com.essa.framework.Model; | ||
11 | +import com.essa.pageObject.HomePage; | ||
12 | + | ||
13 | +/** | ||
14 | + * 当团购活动成功时,类目经理采购计划单申请页面 | ||
15 | + * @author Administrator | ||
16 | + * | ||
17 | + */ | ||
18 | +public class NeedDealtApplyPage extends BasePage { | ||
19 | + | ||
20 | + public NeedDealtApplyPage(WebDriver driver) { | ||
21 | + super(driver); | ||
22 | + } | ||
23 | + | ||
24 | + /* | ||
25 | + * 元素定位 | ||
26 | + */ | ||
27 | + | ||
28 | + //提交询价 | ||
29 | + @FindBy (xpath ="//*[text()='提交询价']") | ||
30 | + WebElement submitInquiry; | ||
31 | + | ||
32 | + //待办工作--检查点 | ||
33 | + @FindBy (xpath = "//*[contains(text(),'待办工作')]") | ||
34 | + WebElement checkpoint; | ||
35 | + | ||
36 | + //流水号 | ||
37 | + @FindBy (xpath = "//*[contains(text(),'流水号:RW')]") | ||
38 | + WebElement serialNumber; | ||
39 | + | ||
40 | + //确认 | ||
41 | + @FindBy (xpath = "//*[text()='确认']") | ||
42 | + WebElement confirm; | ||
43 | + | ||
44 | + //送审核 | ||
45 | + @FindBy (xpath = "//*[text()='提交审核']") | ||
46 | + WebElement toAudit; | ||
47 | + | ||
48 | + //认领 | ||
49 | + @FindBy (xpath = "//*[text()='认领']") | ||
50 | + WebElement claim; | ||
51 | + | ||
52 | + //同意 | ||
53 | + @FindBy (xpath ="//*[text()='同意']") | ||
54 | + WebElement agree; | ||
55 | + | ||
56 | + //添加 | ||
57 | + @FindBy(xpath = "//*[text()='添加']" ) | ||
58 | + WebElement add; | ||
59 | + | ||
60 | + //船公司 | ||
61 | + @FindBy(xpath = "//input[@name='shipperCompany']") | ||
62 | + WebElement inputShipperCompany; | ||
63 | + | ||
64 | + //开船日期 | ||
65 | + @FindBy(xpath = "//input[@id='deliveryDate0']") | ||
66 | + WebElement inputShipperStartDate; | ||
67 | + | ||
68 | + //预计到港日期 | ||
69 | + @FindBy(xpath = "//input[@id='estimatedArrivalDate0']") | ||
70 | + WebElement inputShipperArriveDate; | ||
71 | + | ||
72 | + //提交 | ||
73 | + @FindBy(xpath = "//*[text()='提交']") | ||
74 | + WebElement submit; | ||
75 | + | ||
76 | + //暂存 | ||
77 | + @FindBy(xpath = "//*[text()='暂存']") | ||
78 | + WebElement save; | ||
79 | + | ||
80 | + | ||
81 | + /* | ||
82 | + * 页面方法 | ||
83 | + */ | ||
84 | + | ||
85 | + /** | ||
86 | + * 提交询价 | ||
87 | + * @return bmps首页 | ||
88 | + */ | ||
89 | + public HomePage submitInquiry() { | ||
90 | + mywait(checkpoint); | ||
91 | + forceWait(1000); | ||
92 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | ||
93 | + moveHeightScroll("100"); | ||
94 | + click(submitInquiry); | ||
95 | + forceWait(500); | ||
96 | + click(confirm); | ||
97 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | ||
98 | + return new HomePage(driver); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 类目经理修订,送审核 | ||
103 | + * @return bpms首页 | ||
104 | + */ | ||
105 | + public HomePage toAudit() { | ||
106 | + mywait(checkpoint); | ||
107 | + forceWait(1000); | ||
108 | + moveHeightScroll("100"); | ||
109 | + click(toAudit); | ||
110 | + forceWait(500); | ||
111 | + click(confirm); | ||
112 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | ||
113 | + return new HomePage(driver); | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * 财务审核计划申请 | ||
118 | + * @return | ||
119 | + */ | ||
120 | + public HomePage audit() { | ||
121 | + mywait(checkpoint); | ||
122 | + forceWait(1000); | ||
123 | + moveHeightScroll("100"); | ||
124 | + click(claim); | ||
125 | + mywait(checkpoint); | ||
126 | + moveHeightScroll("100"); | ||
127 | + click(agree); | ||
128 | + click(confirm); | ||
129 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | ||
130 | + return new HomePage(driver); | ||
131 | + } | ||
132 | + | ||
133 | + public HomePage confirmSailingDate() { | ||
134 | + mywait(checkpoint); | ||
135 | + forceWait(1000); | ||
136 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | ||
137 | + click(confirm); | ||
138 | + return new HomePage(driver); | ||
139 | + } | ||
140 | + | ||
141 | + /** | ||
142 | + * 认领船务登记船期待办 | ||
143 | + * @return 首页 | ||
144 | + */ | ||
145 | + public HomePage toClaimShippingMark(){ | ||
146 | + | ||
147 | + mywait(checkpoint); | ||
148 | + forceWait(5000); | ||
149 | + if(isVisibility(By.xpath("//*[text()='认领']"))){ | ||
150 | + moveHeightScroll("100"); | ||
151 | + click(claim); | ||
152 | + } | ||
153 | + forceWait(3000); | ||
154 | + mywait(checkpoint); | ||
155 | + click(add); | ||
156 | + sendKeys(inputShipperCompany,"essa"); | ||
157 | + //设置开船日期 | ||
158 | + jsExecutorRemoveAttribute(inputShipperStartDate,"readonly"); | ||
159 | + inputShipperStartDate.clear(); | ||
160 | + sendKeys(inputShipperStartDate,"10/25/2018"); | ||
161 | + //设置预计到港日期 | ||
162 | + jsExecutorRemoveAttribute(inputShipperArriveDate,"readonly"); | ||
163 | + inputShipperArriveDate.clear(); | ||
164 | + sendKeys(inputShipperArriveDate,"11/10/2018"); | ||
165 | + //提交 | ||
166 | + click(submit); | ||
167 | + return new HomePage(driver); | ||
168 | + } | ||
169 | + | ||
170 | + | ||
171 | +} |
src/main/java/com/essa/pageObject/productDev/AddProjectPage.java
0 → 100644
@@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
1 | +package com.essa.pageObject.productDev; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.WebElement; | ||
5 | +import org.openqa.selenium.support.FindBy; | ||
6 | + | ||
7 | +import com.essa.framework.BasePage; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Administrator | ||
11 | + *新增项目立项书 | ||
12 | + */ | ||
13 | +public class AddProjectPage extends BasePage { | ||
14 | + public AddProjectPage(WebDriver driver) { | ||
15 | + super(driver); | ||
16 | + } | ||
17 | + /* | ||
18 | + * 元素定位 | ||
19 | + */ | ||
20 | + //改版类型 | ||
21 | + @FindBy (xpath ="//*[@dic-list='改版类型']") | ||
22 | + WebElement revisonType; | ||
23 | + | ||
24 | + //项目名称 | ||
25 | + @FindBy (xpath ="//*[@ng-model='model.name']") | ||
26 | + WebElement projectName; | ||
27 | + | ||
28 | + //项目负责人 | ||
29 | + @FindBy (xpath ="//*[@ng-model='model.leaderId']/input") | ||
30 | + WebElement projectLeader; | ||
31 | + | ||
32 | + //项目负责人-林荣 | ||
33 | + @FindBy (xpath ="//*[@id='role-user-select-box']/ul/li[3]/span") | ||
34 | + WebElement linrong; | ||
35 | + | ||
36 | + //开发程度 | ||
37 | + @FindBy (xpath ="//*[@dic-list='开发程度']") | ||
38 | + WebElement devLevel; | ||
39 | + | ||
40 | + //开发系列 | ||
41 | + @FindBy (xpath ="//*[@ng-model='model.serialId']") | ||
42 | + WebElement devSerial; | ||
43 | + | ||
44 | + //团队成员-新增 | ||
45 | + @FindBy (xpath ="//button[text()='新增']") | ||
46 | + WebElement addMember; | ||
47 | + | ||
48 | + //任务处理人 -第一个 | ||
49 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[1]/td[2]/div/input") | ||
50 | + WebElement Transactor1; | ||
51 | + | ||
52 | + //处理人-linrong | ||
53 | + @FindBy (xpath ="//*[@id='role-user-select-box']/ul/li[3]/span") | ||
54 | + WebElement linrong1; | ||
55 | + | ||
56 | + //任务处理人 -第二个 | ||
57 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[2]/td[2]/div/input") | ||
58 | + WebElement Transactor2; | ||
59 | + | ||
60 | + //成员角色 -第一个 | ||
61 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[1]/td[3]/select") | ||
62 | + WebElement role1; | ||
63 | + | ||
64 | + //成员角色 -第二个 | ||
65 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[2]/td[3]/select") | ||
66 | + WebElement role2; | ||
67 | + | ||
68 | + //选择改版商品信息 | ||
69 | + @FindBy (xpath ="//*[text()='选择']") | ||
70 | + WebElement selectGoods; | ||
71 | + | ||
72 | + //保存 | ||
73 | + @FindBy (xpath ="//*[contains(text(),'保存')]") | ||
74 | + WebElement save; | ||
75 | +} |
@@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import java.util.Properties; | ||
4 | + | ||
5 | +import javax.activation.DataHandler; | ||
6 | +import javax.activation.DataSource; | ||
7 | +import javax.activation.FileDataSource; | ||
8 | +import javax.mail.BodyPart; | ||
9 | +import javax.mail.Message; | ||
10 | +import javax.mail.MessagingException; | ||
11 | +import javax.mail.Multipart; | ||
12 | +import javax.mail.PasswordAuthentication; | ||
13 | +import javax.mail.Session; | ||
14 | +import javax.mail.Transport; | ||
15 | +import javax.mail.internet.InternetAddress; | ||
16 | +import javax.mail.internet.MimeBodyPart; | ||
17 | +import javax.mail.internet.MimeMessage; | ||
18 | +import javax.mail.internet.MimeMultipart; | ||
19 | + | ||
20 | +public class SendEmail { | ||
21 | + | ||
22 | + public static void main(String[] args) { | ||
23 | + | ||
24 | + // 创建一个Property文件对象 | ||
25 | + Properties props = new Properties(); | ||
26 | + | ||
27 | + // 设置邮件服务器的信息,这里设置smtp主机名称 | ||
28 | + props.put("mail.smtp.host", "smtp.qq.com"); | ||
29 | + | ||
30 | + // 设置socket factory 的端口 | ||
31 | + props.put("mail.smtp.socketFactory.port", "465"); | ||
32 | + | ||
33 | + // 设置socket factory | ||
34 | + props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); | ||
35 | + | ||
36 | + // 设置需要身份验证 | ||
37 | + props.put("mail.smtp.auth", "true"); | ||
38 | + | ||
39 | + // 设置SMTP的端口,QQ的smtp端口是25 | ||
40 | + props.put("mail.smtp.port", "25"); | ||
41 | + | ||
42 | + // 身份验证实现 | ||
43 | + Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { | ||
44 | + | ||
45 | + protected PasswordAuthentication getPasswordAuthentication() { | ||
46 | + // 第二个参数,就是我QQ开启smtp的授权码 | ||
47 | + return new PasswordAuthentication("278953238@qq.com", "pfpzqcamljytbjec"); | ||
48 | + | ||
49 | + } | ||
50 | + | ||
51 | + }); | ||
52 | + | ||
53 | + try { | ||
54 | + | ||
55 | + // 创建一个MimeMessage类的实例对象 | ||
56 | + Message message = new MimeMessage(session); | ||
57 | + | ||
58 | + // 设置发件人邮箱地址 | ||
59 | + message.setFrom(new InternetAddress("278953238@qq.com")); | ||
60 | + | ||
61 | + // 设置收件人邮箱地址 | ||
62 | + message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("3289714863@qq.com")); | ||
63 | + | ||
64 | + // 设置邮件主题 | ||
65 | + message.setSubject("测试发送邮件"); | ||
66 | + | ||
67 | + // 创建一个MimeBodyPart的对象,以便添加内容 | ||
68 | + BodyPart messageBodyPart1 = new MimeBodyPart(); | ||
69 | + | ||
70 | + // 设置邮件正文内容 | ||
71 | + messageBodyPart1.setText("这个是邮件的正文部分"); | ||
72 | + | ||
73 | + // 创建另外一个MimeBodyPart对象,以便添加其他内容 | ||
74 | + MimeBodyPart messageBodyPart2 = new MimeBodyPart(); | ||
75 | + | ||
76 | + // 设置邮件中附件文件的路径 | ||
77 | + String filename = ".\\test-output\\emailable-report.html"; | ||
78 | + | ||
79 | + // 创建一个datasource对象,并传递文件 | ||
80 | + DataSource source = new FileDataSource(filename); | ||
81 | + | ||
82 | + // 设置handler | ||
83 | + messageBodyPart2.setDataHandler(new DataHandler(source)); | ||
84 | + | ||
85 | + // 加载文件 | ||
86 | + messageBodyPart2.setFileName(filename); | ||
87 | + | ||
88 | + // 创建一个MimeMultipart类的实例对象 | ||
89 | + Multipart multipart = new MimeMultipart(); | ||
90 | + | ||
91 | + // 添加正文1内容 | ||
92 | + multipart.addBodyPart(messageBodyPart1); | ||
93 | + | ||
94 | + // 添加正文2内容 | ||
95 | + multipart.addBodyPart(messageBodyPart2); | ||
96 | + | ||
97 | + // 设置内容 | ||
98 | + message.setContent(multipart); | ||
99 | + | ||
100 | + // 最终发送邮件 | ||
101 | + Transport.send(message); | ||
102 | + | ||
103 | + System.out.println("=====邮件已经发送====="); | ||
104 | + | ||
105 | + } catch (MessagingException e) { | ||
106 | + | ||
107 | + throw new RuntimeException(e); | ||
108 | + | ||
109 | + } | ||
110 | + | ||
111 | + } | ||
112 | + | ||
113 | +} |
@@ -0,0 +1,100 @@ | @@ -0,0 +1,100 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import org.testng.asserts.SoftAssert; | ||
9 | + | ||
10 | +import com.essa.framework.Model; | ||
11 | +import com.essa.pageObject.BaseTest; | ||
12 | +import com.essa.pageObject.HomePage; | ||
13 | +import com.essa.pageObject.inquiryManage.ProductInquiryFeedbackPage; | ||
14 | +import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage; | ||
15 | +import com.essa.pageObject.needDealt.NeedDealtApplyPage; | ||
16 | + | ||
17 | +public class TestActivity extends BaseTest{ | ||
18 | + public WebDriver driver; | ||
19 | +// private String manager; | ||
20 | + | ||
21 | + @BeforeClass | ||
22 | + public void setUp() { | ||
23 | + initsetUp(); | ||
24 | +// Model.setIsactivity(1); | ||
25 | +// Model.setManager("linrong"); | ||
26 | + } | ||
27 | + | ||
28 | + @AfterClass | ||
29 | + public void tearDown() { | ||
30 | + driver.quit(); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 活动商品已满足,类目经理走待办 | ||
35 | + */ | ||
36 | + @Test(description="采购计划单申请,送询价") | ||
37 | + public void TestActivityToPO() { | ||
38 | + this.driver = getDriver(); | ||
39 | +// this.manager = Model.getManager(); | ||
40 | + if (Model.getManager() == null) { | ||
41 | + System.out.println("获取类目经理失败了"); | ||
42 | + driver.quit(); | ||
43 | + } | ||
44 | + | ||
45 | + loginValid(Model.getManager()); | ||
46 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
47 | + homePage.applyPurchasePlane();//目前没办法查出待办流水号,只能点击第一个待办,此处后续有必要的话需要优化 | ||
48 | + NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class); | ||
49 | + needDealtApplyPage.submitInquiry(); | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * chenhong对成品询价,目前写死,暂不考虑义务商品 | ||
54 | + */ | ||
55 | + @Test(description="成品询价") | ||
56 | + public void productInquiry() { | ||
57 | + this.driver = getDriver(); | ||
58 | + loginValid("chenhong");//此处是汕头的商品,有可能出现义务的商品,则要用xingchangyong来操作 | ||
59 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
60 | + homePage.toProductInquiryTask(); | ||
61 | + ProductInquiryTaskPage productInquiryTask = PageFactory.initElements(driver, ProductInquiryTaskPage.class); | ||
62 | + productInquiryTask.toFeedback(); | ||
63 | + ProductInquiryFeedbackPage productInquiryFeedback = PageFactory.initElements(driver, | ||
64 | + ProductInquiryFeedbackPage.class); | ||
65 | + productInquiryFeedback.submit(); | ||
66 | + // 断言 | ||
67 | + SoftAssert softAssert = new SoftAssert(); | ||
68 | + softAssert.assertEquals(productInquiryTask.isSucceed(), true, "成品询价失败!"); | ||
69 | + softAssert.assertAll(); | ||
70 | + homePage.sureLogout(); | ||
71 | + | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * 类目经理对采购计划进行修订 | ||
76 | + */ | ||
77 | + @Test(description="采购计划修订") | ||
78 | + public void planeModify() { | ||
79 | + this.driver = getDriver(); | ||
80 | + loginValid(Model.getManager()); | ||
81 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
82 | + homePage.toNeedDealtDetailPage(); | ||
83 | + NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class); | ||
84 | + needDealtApplyPage.toAudit(); | ||
85 | + homePage.logout(); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 财务对采购计划进行审核 | ||
90 | + */ | ||
91 | + @Test(description="财务审核采购计划") | ||
92 | + public void TestAuditApply() { | ||
93 | + this.driver = getDriver(); | ||
94 | + loginValid("wangchaomang"); | ||
95 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
96 | + homePage.toNeedDealtDetailPage(); | ||
97 | + NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class); | ||
98 | + needDealtApplyPage.audit(); | ||
99 | + } | ||
100 | +} |
src/main/java/com/essa/testSuite/TestAddMarketGoods.java
0 → 100644
@@ -0,0 +1,86 @@ | @@ -0,0 +1,86 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.support.PageFactory; | ||
7 | +import org.testng.annotations.AfterClass; | ||
8 | +import org.testng.annotations.BeforeClass; | ||
9 | +import org.testng.annotations.Test; | ||
10 | +import org.testng.asserts.SoftAssert; | ||
11 | + | ||
12 | +import com.essa.framework.Model; | ||
13 | +import com.essa.pageObject.BaseTest; | ||
14 | +import com.essa.pageObject.HomePage; | ||
15 | +import com.essa.pageObject.GoodsManage.AddMarketGoodsPage; | ||
16 | +import com.essa.pageObject.GoodsManage.AuditMarketGoodsPage; | ||
17 | +import com.essa.pageObject.GoodsManage.AuditMarketOpreatePage; | ||
18 | +import com.essa.pageObject.GoodsManage.MarketGoodsRelesePage; | ||
19 | + | ||
20 | +/** | ||
21 | + * @author Administrator | ||
22 | + *测试用例:添加市场商品 | ||
23 | + */ | ||
24 | +public class TestAddMarketGoods extends BaseTest { | ||
25 | + | ||
26 | + WebDriver driver; | ||
27 | + | ||
28 | + @BeforeClass | ||
29 | + public void setUp() throws IOException { | ||
30 | + initsetUp(); | ||
31 | + loginValid("maomeixiang"); | ||
32 | + } | ||
33 | + /** | ||
34 | + * 进入市场商品发布页,选择对应的采购商 | ||
35 | + */ | ||
36 | + @Test(description="进入市场商品发布列表,选择采购商") | ||
37 | + public void toMarketGoodsRelesePage() { | ||
38 | + this.driver = getDriver(); | ||
39 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
40 | + homePage.toMarketGoodsRelesePage(); | ||
41 | + MarketGoodsRelesePage marketGoodsRelesePage = PageFactory.initElements(driver, MarketGoodsRelesePage.class); | ||
42 | + marketGoodsRelesePage.toAddMarketGoodsPage(); | ||
43 | + } | ||
44 | + /** | ||
45 | + * 市场商品建档 | ||
46 | + */ | ||
47 | + @Test(description="市场商品建档") | ||
48 | + public void addMarketGoods() { | ||
49 | + this.driver = getDriver(); | ||
50 | + AddMarketGoodsPage addMarketGoodsPage = PageFactory.initElements(driver, AddMarketGoodsPage.class); | ||
51 | + addMarketGoodsPage.addMarketGoods(); | ||
52 | + | ||
53 | + //断言是否建档成功,如果model中的skuNo不为null则成功 | ||
54 | + SoftAssert softAssert = new SoftAssert(); | ||
55 | + boolean actual = !(Model.getSkuNo().isEmpty()); | ||
56 | + softAssert.assertEquals(actual, true, "市场商品建档失败"); | ||
57 | + softAssert.assertAll(); | ||
58 | + | ||
59 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
60 | + homePage.getHome(); | ||
61 | + homePage.logout(); | ||
62 | + } | ||
63 | + /** | ||
64 | + * 对市场商品进行审核 | ||
65 | + */ | ||
66 | + @Test(description="市场商品审核") | ||
67 | + public void auditMarketGoods() { | ||
68 | + loginValid("xingchangyong"); | ||
69 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
70 | + homePage.toAuditMarketGoodsPage(); | ||
71 | + AuditMarketGoodsPage auditMarketGoodsPage = PageFactory.initElements(driver, AuditMarketGoodsPage.class); | ||
72 | + auditMarketGoodsPage.auditMarketGoods(); | ||
73 | + AuditMarketOpreatePage auditMarketOpreatePage = PageFactory.initElements(driver, AuditMarketOpreatePage.class); | ||
74 | + auditMarketOpreatePage.auditPass(); | ||
75 | + //断言是否审核成功 | ||
76 | + boolean actual = auditMarketGoodsPage.isSucceed(); | ||
77 | + SoftAssert softAssert = new SoftAssert(); | ||
78 | + softAssert.assertEquals(actual, false, "市场商品审核失败!"); | ||
79 | + softAssert.assertAll(); | ||
80 | + } | ||
81 | + | ||
82 | + @AfterClass | ||
83 | + public void tearDown() { | ||
84 | + driver.quit(); | ||
85 | + } | ||
86 | +} |
src/main/java/com/essa/testSuite/TestAddOriginalGoods.java
0 → 100644
@@ -0,0 +1,117 @@ | @@ -0,0 +1,117 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.support.PageFactory; | ||
7 | +import org.testng.annotations.AfterClass; | ||
8 | +import org.testng.annotations.BeforeClass; | ||
9 | +import org.testng.annotations.Test; | ||
10 | +import org.testng.asserts.SoftAssert; | ||
11 | + | ||
12 | +import com.essa.pageObject.BaseTest; | ||
13 | +import com.essa.pageObject.HomePage; | ||
14 | +import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | ||
15 | +import com.essa.pageObject.GoodsManage.AuditOriginalGoodsPage; | ||
16 | +import com.essa.pageObject.GoodsManage.AuditOriginalOpreatePage; | ||
17 | +import com.essa.pageObject.GoodsManage.GoodsBankPage; | ||
18 | +import com.essa.pageObject.GoodsManage.GoodsRelesePage; | ||
19 | +import com.essa.pageObject.GoodsManage.UpdatePicPage; | ||
20 | + | ||
21 | +/** | ||
22 | + * @author Administrator | ||
23 | + *测试用例:天机原厂商品 | ||
24 | + */ | ||
25 | +public class TestAddOriginalGoods extends BaseTest { | ||
26 | + | ||
27 | + WebDriver driver; | ||
28 | + | ||
29 | + @BeforeClass | ||
30 | + public void setUp() throws IOException { | ||
31 | + initsetUp(); | ||
32 | + loginValid("linxun"); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 商品建档 | ||
37 | + * | ||
38 | + * @throws InterruptedException | ||
39 | + */ | ||
40 | + @Test(description="原厂商品建档") | ||
41 | + public void toAddOriginalGoodsPage() throws InterruptedException { | ||
42 | + this.driver = getDriver(); | ||
43 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
44 | + homePage.tOriginalGoodsPage(); | ||
45 | + AddOriginalGoodsPage addOriginalGoodsPage = PageFactory.initElements(driver, AddOriginalGoodsPage.class); | ||
46 | + addOriginalGoodsPage.addOriginalGoods(); | ||
47 | + | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 更新商品图片 | ||
52 | + * | ||
53 | + * @throws Exception | ||
54 | + * @throws InterruptedException | ||
55 | + */ | ||
56 | + @Test(description="更新图片") | ||
57 | + public void updatePic() throws Exception { | ||
58 | + this.driver = getDriver(); | ||
59 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
60 | + homePage.tGoodsRelesePage(); | ||
61 | + GoodsRelesePage goodsRelesePage = PageFactory.initElements(driver, GoodsRelesePage.class); | ||
62 | + | ||
63 | + //断言上一步商品建档是否成功 | ||
64 | + boolean actual = goodsRelesePage.isAddOrignalSucceed(); | ||
65 | + SoftAssert assertion = new SoftAssert(); | ||
66 | + assertion.assertEquals(actual, true, "商品建档失败!"); | ||
67 | + assertion.assertAll(); | ||
68 | + | ||
69 | + goodsRelesePage.toUpDatePic(); | ||
70 | + UpdatePicPage updatePicPage = PageFactory.initElements(driver, UpdatePicPage.class); | ||
71 | + // 传入要上传的图片的本机地址 | ||
72 | +// updatePicPage.upDatePic("C:\\Users\\Administrator\\Pictures\\Camera Roll\\4.jpg"); | ||
73 | + updatePicPage.upDatePic(); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 审核原厂商品 | ||
78 | + */ | ||
79 | + @Test(description="原厂商品审核") | ||
80 | + public void auditOriginal() { | ||
81 | + this.driver = getDriver(); | ||
82 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
83 | + homePage.toAuditOriginalGoodsPage(); | ||
84 | + AuditOriginalGoodsPage auditOriginalGoodsPage = PageFactory.initElements(driver, AuditOriginalGoodsPage.class); | ||
85 | + // 断言上一步更新图片是否成功 | ||
86 | + boolean actual1 = auditOriginalGoodsPage.isSucceed(); | ||
87 | + SoftAssert assertion = new SoftAssert(); | ||
88 | + assertion.assertEquals(actual1, true, "更新图片失败!"); | ||
89 | + | ||
90 | + auditOriginalGoodsPage.toAuditOriginalSku(); | ||
91 | + AuditOriginalOpreatePage auditOriginalOpreatePage = PageFactory.initElements(driver, | ||
92 | + AuditOriginalOpreatePage.class); | ||
93 | + auditOriginalOpreatePage.auditPass(); | ||
94 | + | ||
95 | + // 断言是否审核成功,如果发布审核页面没有找到刚刚的商品,说明审核成功了 | ||
96 | + boolean actual = auditOriginalGoodsPage.isSucceed(); | ||
97 | + assertion.assertEquals(actual, false, "审核原厂商品时失败!"); | ||
98 | + assertion.assertAll(); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 获取新增的商品编号 | ||
103 | + */ | ||
104 | + @Test(description="去商品库获取添加的sku编号") | ||
105 | + public void getSkuNo() { | ||
106 | + this.driver = getDriver(); | ||
107 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
108 | + homePage.toGoodsBankPage(); | ||
109 | + GoodsBankPage goodsBankPage = PageFactory.initElements(driver, GoodsBankPage.class); | ||
110 | + goodsBankPage.getNo(); | ||
111 | + } | ||
112 | + | ||
113 | + @AfterClass | ||
114 | + public void tearDown() { | ||
115 | + driver.quit(); | ||
116 | + } | ||
117 | +} |
src/main/java/com/essa/testSuite/TestDevelopmentAbility.java
0 → 100644
@@ -0,0 +1,124 @@ | @@ -0,0 +1,124 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import static org.testng.Assert.assertEquals; | ||
4 | + | ||
5 | +import java.io.IOException; | ||
6 | + | ||
7 | +import org.openqa.selenium.WebDriver; | ||
8 | +import org.openqa.selenium.support.PageFactory; | ||
9 | +import org.testng.annotations.AfterClass; | ||
10 | +import org.testng.annotations.BeforeClass; | ||
11 | +import org.testng.annotations.DataProvider; | ||
12 | +import org.testng.annotations.Test; | ||
13 | +import org.testng.asserts.SoftAssert; | ||
14 | + | ||
15 | +import com.essa.pageObject.HomePage; | ||
16 | +import com.essa.pageObject.SupplierOperationsTrackPage; | ||
17 | +import com.essa.pageObject.SupplierStrengthPage; | ||
18 | +import com.essa.pageObject.BaseTest; | ||
19 | + | ||
20 | +public class TestDevelopmentAbility extends BaseTest { | ||
21 | + | ||
22 | + WebDriver driver; | ||
23 | + | ||
24 | + // 登录 | ||
25 | + @BeforeClass | ||
26 | + public void setUp() throws IOException { | ||
27 | + | ||
28 | + initsetUp(); | ||
29 | + | ||
30 | + loginValid("admin"); | ||
31 | + | ||
32 | + } | ||
33 | + | ||
34 | + // 切换到“供应商管理”菜单 | ||
35 | + @Test | ||
36 | + public void toSupplierOperationsTrack() { | ||
37 | + | ||
38 | + /* | ||
39 | + * 由于我们只能对一个driver进行操作,要先将driver获取 我们要操作的页面为HomePage,所以要初始化一个HomePage对象 | ||
40 | + * 调用进入平台运营管理,断言 | ||
41 | + */ | ||
42 | + this.driver = getDriver(); | ||
43 | + | ||
44 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
45 | + | ||
46 | + homePage.goToSupplierOperationsTrack(); | ||
47 | + | ||
48 | + assertEquals(homePage.isSearchSuppliers(), true, "切换到“供应商管理”菜单失败!"); | ||
49 | + | ||
50 | + } | ||
51 | + | ||
52 | + @Test(dataProvider = "suppliers", dependsOnMethods = { "toSupplierOperationsTrack" }) | ||
53 | + public void editDevelopmentAbility(String supplier) throws Exception { | ||
54 | + | ||
55 | + SupplierOperationsTrackPage sotp = | ||
56 | + PageFactory.initElements(driver, SupplierOperationsTrackPage.class); | ||
57 | + SoftAssert softAssert = new SoftAssert(); | ||
58 | + softAssert.assertEquals(sotp.isSucceed(), true, "进入平台运营跟进管理失败!"); | ||
59 | + | ||
60 | + sotp.goToSupplierStrengthPage(supplier); | ||
61 | + SupplierStrengthPage strengthPage = | ||
62 | + PageFactory.initElements(driver, SupplierStrengthPage.class); | ||
63 | + softAssert.assertEquals(strengthPage.isSucceed(), true, "进入实力评估页面失败!"); | ||
64 | + | ||
65 | + /* | ||
66 | + * 配合度选择“高”,主打产品:中高 | ||
67 | + * 是否研发能力选择“是”,勾选:每个季度有新品推出,有配备工程师,产品研发团队,其他 | ||
68 | + * 添加证书,服务过大客户 | ||
69 | + * 点击提交 | ||
70 | + */ | ||
71 | + | ||
72 | + strengthPage.selectCooperateDegree("高"); | ||
73 | + Thread.sleep(500); | ||
74 | + | ||
75 | + strengthPage.selMainProduct("中高"); | ||
76 | + Thread.sleep(500); | ||
77 | + | ||
78 | + strengthPage.isDevAblity("是"); | ||
79 | + strengthPage.newProduct(); | ||
80 | + strengthPage.haveEngineer(); | ||
81 | + strengthPage.haveTeam(); | ||
82 | + strengthPage.other(); | ||
83 | + | ||
84 | + strengthPage.addCertification(); | ||
85 | + strengthPage.addSerLargeCus(); | ||
86 | + | ||
87 | + strengthPage.submit(); | ||
88 | + Thread.sleep(1000); | ||
89 | + | ||
90 | + softAssert.assertEquals(strengthPage.isSubmit(), true, "提交失败!"); | ||
91 | + | ||
92 | + softAssert.assertAll(); | ||
93 | + | ||
94 | + strengthPage.alertClosed(); | ||
95 | + | ||
96 | + } | ||
97 | + | ||
98 | + | ||
99 | + // 读取excel表格 表格位置在data文件夹下 表格名称为“供应商”,读取的sheet名称为“供应商” | ||
100 | + @DataProvider(name = "suppliers") | ||
101 | + public Object[][] suppliersData() { | ||
102 | + | ||
103 | + try { | ||
104 | + | ||
105 | + return com.essa.framework.BasePage.readExcel(".\\src\\main\\resources", "data.xlsx", "供应商"); | ||
106 | + | ||
107 | + } catch (Exception e) { | ||
108 | + | ||
109 | + e.printStackTrace(); | ||
110 | + | ||
111 | + return null; | ||
112 | + | ||
113 | + } | ||
114 | + } | ||
115 | + | ||
116 | + // 测试完要清理,不占用资源 | ||
117 | + | ||
118 | + @AfterClass | ||
119 | + public void tearDown() { | ||
120 | + | ||
121 | + driver.quit(); | ||
122 | + | ||
123 | + } | ||
124 | +} |
src/main/java/com/essa/testSuite/TestGenrateCode.java
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.support.PageFactory; | ||
7 | +import org.testng.annotations.AfterClass; | ||
8 | +import org.testng.annotations.BeforeClass; | ||
9 | +import org.testng.annotations.Test; | ||
10 | + | ||
11 | +import com.essa.pageObject.BaseTest; | ||
12 | +import com.essa.pageObject.HomePage; | ||
13 | +import com.essa.pageObject.buyerManage.InvateCodePage; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author Administrator | ||
17 | + *测试用例:生成邀请码 | ||
18 | + */ | ||
19 | +public class TestGenrateCode extends BaseTest { | ||
20 | + | ||
21 | +WebDriver driver; | ||
22 | + | ||
23 | + @BeforeClass | ||
24 | + public void setUp() throws IOException { | ||
25 | + initsetUp(); | ||
26 | + loginValid("admin"); | ||
27 | + } | ||
28 | + | ||
29 | + @AfterClass | ||
30 | + public void tearDown() { | ||
31 | + driver.quit(); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * 生成邀请码 | ||
36 | + */ | ||
37 | + @Test(description="生成采购商注册邀请码") | ||
38 | + public void genrateCode() { | ||
39 | + this.driver = getDriver(); | ||
40 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
41 | + homePage.toInvateCodePage(); | ||
42 | + InvateCodePage invateCodePage = PageFactory.initElements(driver, InvateCodePage.class); | ||
43 | + invateCodePage.generateCode(); | ||
44 | + } | ||
45 | +} |
src/main/java/com/essa/testSuite/TestGroupPurchase.java
0 → 100644
@@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import org.testng.asserts.SoftAssert; | ||
9 | + | ||
10 | +import com.essa.pageObject.BaseTest; | ||
11 | +import com.essa.pageObject.HomePage; | ||
12 | +import com.essa.pageObject.buyPlaneManage.SkuCategoryManagerCongfigPage; | ||
13 | +import com.essa.pageObject.marketingManage.GroupControlPage; | ||
14 | +import com.essa.pageObject.marketingManage.GroupSettingPage; | ||
15 | + | ||
16 | +/** | ||
17 | + * @author Administrator | ||
18 | + *测试用例:发布团购 | ||
19 | + */ | ||
20 | +public class TestGroupPurchase extends BaseTest { | ||
21 | + | ||
22 | + WebDriver driver; | ||
23 | + | ||
24 | + @BeforeClass | ||
25 | + public void setUp() { | ||
26 | + initsetUp(); | ||
27 | + loginValid("linrong"); | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * 配置商品类目经理 | ||
32 | + */ | ||
33 | + @Test(description="配置商品类目经理") | ||
34 | + public void SkuCategoryManagerCongfig() { | ||
35 | + this.driver = getDriver(); | ||
36 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
37 | + homePage.toSkuCategoryManagerCongfig(); | ||
38 | + SkuCategoryManagerCongfigPage skuCategoryManagerCongfigPage = PageFactory.initElements(driver, | ||
39 | + SkuCategoryManagerCongfigPage.class); | ||
40 | + skuCategoryManagerCongfigPage.distributeManager(); | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * 发布团购商品 | ||
45 | + */ | ||
46 | + @Test(description="发布团购") | ||
47 | + public void publishGroupPurchase() { | ||
48 | + this.driver = getDriver(); | ||
49 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
50 | + homePage.toGroupSettingPage(); | ||
51 | + GroupSettingPage groupSettingPage = PageFactory.initElements(driver, GroupSettingPage.class); | ||
52 | + groupSettingPage.publishGroup(); | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * 进入团购控制,查找是否有发布成功,并进行断言 | ||
57 | + */ | ||
58 | + @Test(description="检查团购是否发布成功") | ||
59 | + public void isPublish() { | ||
60 | + this.driver = getDriver(); | ||
61 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
62 | + homePage.toGroupControlPage(); | ||
63 | + GroupControlPage groupControlPage = PageFactory.initElements(driver, GroupControlPage.class); | ||
64 | + boolean actual = groupControlPage.isSuccess(); | ||
65 | + SoftAssert softAssert = new SoftAssert(); | ||
66 | + softAssert.assertEquals(actual, true, "发布团购失败了!"); | ||
67 | + softAssert.assertAll(); | ||
68 | + } | ||
69 | + | ||
70 | + @AfterClass | ||
71 | + public void tearDown() { | ||
72 | + driver.quit(); | ||
73 | + } | ||
74 | + | ||
75 | +} |
@@ -0,0 +1,104 @@ | @@ -0,0 +1,104 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.openqa.selenium.WebDriver; | ||
6 | +import org.openqa.selenium.support.PageFactory; | ||
7 | +import org.testng.annotations.AfterClass; | ||
8 | +import org.testng.annotations.BeforeClass; | ||
9 | +import org.testng.annotations.DataProvider; | ||
10 | +import org.testng.annotations.Test; | ||
11 | +import org.testng.asserts.SoftAssert; | ||
12 | + | ||
13 | +import com.essa.framework.BrowserEngine; | ||
14 | +import com.essa.pageObject.HomePage; | ||
15 | +import com.essa.pageObject.LoginPage; | ||
16 | + | ||
17 | +/** | ||
18 | + * @author Administrator | ||
19 | + *测试用例:登录测试 | ||
20 | + */ | ||
21 | +public class TestLogin { | ||
22 | + WebDriver driver; | ||
23 | + | ||
24 | + /* | ||
25 | + * 调用浏览器,打开网页 | ||
26 | + * 执行任何测试之前都应执行这个步骤 | ||
27 | + * 后面我会把这个方法封装在pageObject.function里面 | ||
28 | + */ | ||
29 | + | ||
30 | + @BeforeClass | ||
31 | + public void setUp() throws IOException { | ||
32 | + | ||
33 | + BrowserEngine browserEngine = new BrowserEngine(); | ||
34 | + | ||
35 | + browserEngine.initConfigData(); | ||
36 | + | ||
37 | + driver = browserEngine.getBrowser(); | ||
38 | + | ||
39 | + } | ||
40 | + | ||
41 | + /* | ||
42 | + * 初始化(实例化)一个登录页面 | ||
43 | + * 做登录操作 | ||
44 | + * 登录完后会跳转到后台首页 | ||
45 | + * 故要初始化一个后台首页用于断言是否登录成功 | ||
46 | + * 这里登录成功的标识是有“退出”按钮 | ||
47 | + */ | ||
48 | + | ||
49 | + @Test(dataProvider="users") | ||
50 | + public void login(String account,String password) { | ||
51 | + | ||
52 | + LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); | ||
53 | + | ||
54 | + loginPage.login(account, password); | ||
55 | + | ||
56 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
57 | + | ||
58 | + /* | ||
59 | + * 软断言,即就算此用例失败,依然会继续执行 | ||
60 | + * 断言后,做退出登录操作 | ||
61 | + */ | ||
62 | + | ||
63 | + SoftAssert softAssert = new SoftAssert(); | ||
64 | + | ||
65 | + softAssert.assertEquals(homePage.isSucceed(), true, "登录失败!"); | ||
66 | + | ||
67 | + softAssert.assertAll(); | ||
68 | + | ||
69 | + homePage.logout(); | ||
70 | + | ||
71 | + } | ||
72 | + | ||
73 | + /* | ||
74 | + * 提供数据对象 | ||
75 | + * 此方法读取当前项目根目录下的data\\data.xlsx文件中的“users”工作表 | ||
76 | + */ | ||
77 | + | ||
78 | + @DataProvider(name="users") | ||
79 | + public Object[][] suppliersData() { | ||
80 | + | ||
81 | + try { | ||
82 | + | ||
83 | + return com.essa.framework.BasePage.readExcel(".\\src\\main\\resources", "data.xlsx", "users"); | ||
84 | + | ||
85 | + } catch (Exception e) { | ||
86 | + | ||
87 | + e.printStackTrace(); | ||
88 | + | ||
89 | + return null; | ||
90 | + | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + /* | ||
95 | + * 最后要做清理工作,避免占用资源 | ||
96 | + */ | ||
97 | + | ||
98 | + @AfterClass | ||
99 | + public void tearDown() { | ||
100 | + | ||
101 | + driver.quit(); | ||
102 | + | ||
103 | + } | ||
104 | +} |
src/main/java/com/essa/testSuite/TestNoticeReceiveAndLoad.java
0 → 100644
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import com.essa.pageObject.BaseTest; | ||
4 | +import org.openqa.selenium.WebDriver; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | + | ||
9 | +public class TestNoticeReceiveAndLoad extends BaseTest{ | ||
10 | + | ||
11 | + WebDriver driver; | ||
12 | + | ||
13 | + @BeforeClass | ||
14 | + public void setUp(){ | ||
15 | + initsetUp(); | ||
16 | + loginValid("chenyijie"); | ||
17 | + } | ||
18 | + | ||
19 | + @AfterClass | ||
20 | + public void tearDown(){ | ||
21 | + driver.quit(); | ||
22 | + } | ||
23 | + | ||
24 | + /** | ||
25 | + * 通知收货和通知装柜 | ||
26 | + */ | ||
27 | + @Test(description = "通知收货和通知装柜") | ||
28 | + public void NoticeReceiveAndLoad(){ | ||
29 | + this.driver = getDriver(); | ||
30 | + | ||
31 | + } | ||
32 | +} |
src/main/java/com/essa/testSuite/TestPOInquiry.java
0 → 100644
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | + | ||
9 | +import com.essa.pageObject.BaseTest; | ||
10 | +import com.essa.pageObject.HomePage; | ||
11 | +import com.essa.pageObject.inquiryManage.ProductInquiryFeedbackPage; | ||
12 | +import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage; | ||
13 | + | ||
14 | +public class TestPOInquiry extends BaseTest { | ||
15 | + | ||
16 | + WebDriver driver; | ||
17 | + | ||
18 | + @BeforeClass | ||
19 | + public void setUp() { | ||
20 | + initsetUp(); | ||
21 | + loginValid("chenhong"); | ||
22 | + } | ||
23 | + | ||
24 | + @AfterClass | ||
25 | + public void tearDown() { | ||
26 | + driver.quit(); | ||
27 | + } | ||
28 | + | ||
29 | + | ||
30 | + /** | ||
31 | + * po询价 | ||
32 | + */ | ||
33 | + @Test(description="根据PO单号,做询价操作") | ||
34 | + public void POInquiry() { | ||
35 | + this.driver = getDriver(); | ||
36 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
37 | + homePage.toProductInquiryTask(); | ||
38 | + ProductInquiryTaskPage productInquiryTask = PageFactory.initElements(driver, ProductInquiryTaskPage.class); | ||
39 | + ProductInquiryFeedbackPage productInquiryFeedbackPage = PageFactory.initElements(driver, | ||
40 | + ProductInquiryFeedbackPage.class); | ||
41 | + productInquiryTask.POtoFeedback(); | ||
42 | + productInquiryFeedbackPage.POsubmit(); | ||
43 | + | ||
44 | + //如果列表还有未询价,继续执行 | ||
45 | + while (productInquiryTask.isPOSucceed()) { | ||
46 | + productInquiryTask.POcircle(); | ||
47 | + productInquiryFeedbackPage.POsubmit(); | ||
48 | + } | ||
49 | + } | ||
50 | +} |
src/main/java/com/essa/testSuite/TestProductInquiry.java
0 → 100644
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | +import org.openqa.selenium.WebDriver; | ||
4 | +import org.openqa.selenium.support.PageFactory; | ||
5 | +import org.testng.annotations.AfterClass; | ||
6 | +import org.testng.annotations.BeforeClass; | ||
7 | +import org.testng.annotations.Test; | ||
8 | +import org.testng.asserts.SoftAssert; | ||
9 | + | ||
10 | +import com.essa.pageObject.BaseTest; | ||
11 | +import com.essa.pageObject.HomePage; | ||
12 | +import com.essa.pageObject.inquiryManage.ProductInquiryFeedbackPage; | ||
13 | +import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author Administrator 测试用例:成品询价 | ||
17 | + */ | ||
18 | +public class TestProductInquiry extends BaseTest { | ||
19 | + | ||
20 | + WebDriver driver; | ||
21 | + | ||
22 | + @BeforeClass | ||
23 | + public void setUp() { | ||
24 | + initsetUp(); | ||
25 | + loginValid("chenhong"); | ||
26 | + } | ||
27 | + | ||
28 | + @AfterClass | ||
29 | + public void tearDown() { | ||
30 | + driver.quit(); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 成品询价 | ||
35 | + */ | ||
36 | + @Test(description = "成品询价流程") | ||
37 | + public void productInquiry() { | ||
38 | + this.driver = getDriver(); | ||
39 | + HomePage homePage = PageFactory.initElements(driver, HomePage.class); | ||
40 | + homePage.toProductInquiryTask(); | ||
41 | + ProductInquiryTaskPage productInquiryTask = PageFactory.initElements(driver, ProductInquiryTaskPage.class); | ||
42 | + productInquiryTask.toFeedback(); | ||
43 | + ProductInquiryFeedbackPage productInquiryFeedback = PageFactory.initElements(driver, | ||
44 | + ProductInquiryFeedbackPage.class); | ||
45 | + productInquiryFeedback.submit(); | ||
46 | + // 断言 | ||
47 | + SoftAssert softAssert = new SoftAssert(); | ||
48 | + softAssert.assertEquals(productInquiryTask.isSucceed(), true, "成品询价失败!"); | ||
49 | + softAssert.assertAll(); | ||
50 | + } | ||
51 | +} |
src/main/java/com/essa/testSuite/TestShippingMark.java
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +package com.essa.testSuite; | ||
2 | + | ||
3 | + | ||
4 | +import com.essa.framework.BasePage; | ||
5 | +import com.essa.pageObject.BaseTest; | ||
6 | +import com.essa.pageObject.HomePage; | ||
7 | +import com.essa.pageObject.needDealt.NeedDealtApplyPage; | ||
8 | +import org.openqa.selenium.By; | ||
9 | +import org.openqa.selenium.WebDriver; | ||
10 | +import org.openqa.selenium.support.PageFactory; | ||
11 | +import org.testng.annotations.AfterClass; | ||
12 | +import org.testng.annotations.BeforeClass; | ||
13 | + | ||
14 | +/** | ||
15 | + * 测试用例:登记备选船期 | ||
16 | + */ | ||
17 | +public class TestShippingMark extends BaseTest{ | ||
18 | + | ||
19 | + WebDriver driver; | ||
20 | + | ||
21 | + @BeforeClass | ||
22 | + public void setUp(){ | ||
23 | + initsetUp(); | ||
24 | + loginValid("wangmiaodan"); | ||
25 | + } | ||
26 | + | ||
27 | + @AfterClass | ||
28 | + public void tearDown(){ | ||
29 | + driver.quit(); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 登记备选船期 | ||
34 | + */ | ||
35 | + @org.testng.annotations.Test(description = "登记备选船期待办") | ||
36 | + public void ShippingMarkWait(){ | ||
37 | + this.driver = getDriver(); | ||
38 | + | ||
39 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | ||
40 | + homePage.toShippingMarkWait(); | ||
41 | + NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver,NeedDealtApplyPage.class); | ||
42 | + needDealtApplyPage.toClaimShippingMark(); | ||
43 | + homePage.logout(); | ||
44 | + } | ||
45 | +} |
@@ -0,0 +1,701 @@ | @@ -0,0 +1,701 @@ | ||
1 | +package swing; | ||
2 | + | ||
3 | +import java.awt.EventQueue; | ||
4 | + | ||
5 | +import javax.swing.JFrame; | ||
6 | +import javax.swing.ButtonGroup; | ||
7 | +import javax.swing.JButton; | ||
8 | +import java.awt.event.ActionListener; | ||
9 | +import java.io.BufferedReader; | ||
10 | +import java.io.File; | ||
11 | +import java.io.FileInputStream; | ||
12 | +import java.io.FileNotFoundException; | ||
13 | +import java.io.FileOutputStream; | ||
14 | +import java.io.IOException; | ||
15 | +import java.io.InputStream; | ||
16 | +import java.io.InputStreamReader; | ||
17 | +import java.io.RandomAccessFile; | ||
18 | +import java.io.StringReader; | ||
19 | +import java.text.SimpleDateFormat; | ||
20 | +import java.util.ArrayList; | ||
21 | +import java.util.Date; | ||
22 | +import java.util.List; | ||
23 | +import java.util.Properties; | ||
24 | +import java.util.concurrent.Executors; | ||
25 | +import java.util.concurrent.ScheduledExecutorService; | ||
26 | +import java.util.concurrent.TimeUnit; | ||
27 | +import java.awt.event.ActionEvent; | ||
28 | +import javax.swing.JTextField; | ||
29 | + | ||
30 | +import org.apache.xmlbeans.impl.xb.xsdschema.Public; | ||
31 | +import org.jdom.Document; | ||
32 | +import org.jdom.Element; | ||
33 | +import org.jdom.JDOMException; | ||
34 | +import org.jdom.input.SAXBuilder; | ||
35 | +import org.jdom.output.XMLOutputter; | ||
36 | +import org.testng.TestNG; | ||
37 | + | ||
38 | +import com.essa.framework.BrowserEngine; | ||
39 | +import com.essa.framework.Logger; | ||
40 | +import com.essa.framework.Model; | ||
41 | +import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | ||
42 | +import com.essa.pageObject.GoodsManage.GoodsBankPage; | ||
43 | +import com.essa.pageObject.GoodsManage.UpdatePicPage; | ||
44 | + | ||
45 | +import javax.swing.JLabel; | ||
46 | +import javax.swing.JRadioButton; | ||
47 | +import javax.swing.JComboBox; | ||
48 | +import javax.swing.JFileChooser; | ||
49 | +import javax.swing.JScrollPane; | ||
50 | +import javax.swing.JTextArea; | ||
51 | + | ||
52 | +import java.awt.Color; | ||
53 | +import javax.swing.DefaultComboBoxModel; | ||
54 | +import javax.swing.ImageIcon; | ||
55 | +import java.awt.Toolkit; | ||
56 | +import java.awt.BorderLayout; | ||
57 | +import java.awt.Choice; | ||
58 | +import java.awt.Font; | ||
59 | +import java.awt.Graphics; | ||
60 | + | ||
61 | +import javax.swing.JList; | ||
62 | +import javax.swing.JMenuBar; | ||
63 | +import javax.swing.JTextPane; | ||
64 | +import java.awt.event.InputMethodListener; | ||
65 | +import java.awt.event.InputMethodEvent; | ||
66 | +import java.beans.VetoableChangeListener; | ||
67 | +import java.beans.PropertyChangeEvent; | ||
68 | +import javax.swing.JPanel; | ||
69 | +import java.beans.PropertyChangeListener; | ||
70 | +import java.awt.event.MouseAdapter; | ||
71 | +import java.awt.event.MouseEvent; | ||
72 | +import javax.swing.UIManager; | ||
73 | +import java.awt.TextField; | ||
74 | +import java.awt.Panel; | ||
75 | +import javax.swing.JScrollBar; | ||
76 | +import javax.swing.ScrollPaneConstants; | ||
77 | +import javax.swing.SwingWorker; | ||
78 | +import javax.swing.border.LineBorder; | ||
79 | + | ||
80 | +/** | ||
81 | + * @author Administrator 图形化 | ||
82 | + */ | ||
83 | +public class SwingMain { | ||
84 | + | ||
85 | + private JFrame frmvBy; | ||
86 | + private JTextField supplierName; | ||
87 | + private JTextField buyerNo2; | ||
88 | + public static String no; | ||
89 | + private JTextField account; | ||
90 | + private JTextArea SkuNo; | ||
91 | + private JTextField password; | ||
92 | + private JTextField registerAccount; | ||
93 | + private JTextArea ja; | ||
94 | + private JTextField po; | ||
95 | + | ||
96 | + private String buyerAccount;//采购商账号,存储于配置文件中,记录上一次使用的账号 | ||
97 | + private String supplier;//供应商 | ||
98 | + private String buyerNo;//采购商编号 | ||
99 | + | ||
100 | + /** | ||
101 | + * Launch the application. | ||
102 | + */ | ||
103 | + public static void main(String[] args) { | ||
104 | + EventQueue.invokeLater(new Runnable() { | ||
105 | + public void run() { | ||
106 | + try { | ||
107 | + SwingMain window = new SwingMain(); | ||
108 | + window.frmvBy.setVisible(true); | ||
109 | + } catch (Exception e) { | ||
110 | + e.printStackTrace(); | ||
111 | + } | ||
112 | + } | ||
113 | + }); | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * Create the application. | ||
118 | + */ | ||
119 | + public SwingMain() { | ||
120 | + | ||
121 | + initData(); | ||
122 | + initialize(); | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 读取data.xml文件保存的用户使用的数据,用于读取该用户上一次输入的数据 | ||
127 | + * @throws JDOMException | ||
128 | + * @throws IOException | ||
129 | + */ | ||
130 | + public void initData() { | ||
131 | + try { | ||
132 | + SAXBuilder builder = new SAXBuilder(); | ||
133 | + Document document = builder.build(new File(".\\resources\\data.xml")); | ||
134 | + Element root = document.getRootElement(); | ||
135 | + Element element = root.getChild("data"); | ||
136 | + this.buyerAccount = element.getChildText("buyerAccount"); | ||
137 | + this.supplier = element.getChildText("supplier"); | ||
138 | + this.buyerNo = element.getChildText("buyerNo"); | ||
139 | + } catch (Exception e) { | ||
140 | + e.printStackTrace(); | ||
141 | + } | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * 将用户输入过的数据保存在data.xml文件中 | ||
146 | + * @param key 字段名 | ||
147 | + * @param value 参数值 | ||
148 | + * @throws JDOMException | ||
149 | + * @throws IOException | ||
150 | + */ | ||
151 | + public void setData(String key,String value) { | ||
152 | + try { | ||
153 | + SAXBuilder builder = new SAXBuilder(); | ||
154 | + Document document = builder.build(new File(".\\resources\\data.xml")); | ||
155 | + Element root = document.getRootElement(); | ||
156 | + Element element = root.getChild("data"); | ||
157 | + element.getChild(key).setText(value); | ||
158 | + XMLOutputter XMLOut = new XMLOutputter(); | ||
159 | + XMLOut.output(document,new FileOutputStream(".\\resources\\data.xml")); | ||
160 | + } catch (Exception e) { | ||
161 | + e.printStackTrace(); | ||
162 | + } | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * 获取当前时间 | ||
167 | + * @return | ||
168 | + */ | ||
169 | + public String getCurrentTime() { | ||
170 | + SimpleDateFormat format = new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss] "); | ||
171 | + Date today = new Date(); | ||
172 | + String time = format.format(today); | ||
173 | + return time; | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * frame初始化. | ||
178 | + */ | ||
179 | + private void initialize() { | ||
180 | + frmvBy = new JFrame("ESSA自动化测试工具v1.0.0"); | ||
181 | + frmvBy.getContentPane().setBackground(UIManager.getColor("Button.background")); | ||
182 | + frmvBy.setTitle("ESSA自动化测试工具v1.0.1"); | ||
183 | + frmvBy.setIconImage(Toolkit.getDefaultToolkit().getImage(SwingMain.class.getResource("/swing/icon.png"))); | ||
184 | + frmvBy.getContentPane().setEnabled(false); | ||
185 | + frmvBy.setResizable(false); | ||
186 | + frmvBy.setBackground(UIManager.getColor("Button.background")); | ||
187 | + frmvBy.setForeground(Color.LIGHT_GRAY); | ||
188 | + frmvBy.setBounds(650, 350, 526, 467); | ||
189 | + frmvBy.setSize(686, 405); | ||
190 | + frmvBy.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
191 | + frmvBy.getContentPane().setLayout(null); | ||
192 | + | ||
193 | + //日志 | ||
194 | + JScrollPane jsp; | ||
195 | + ja = new JTextArea(); | ||
196 | + jsp = new JScrollPane(ja); | ||
197 | + jsp.setBounds(22, 186, 631, 134); | ||
198 | + frmvBy.getContentPane().add(jsp); | ||
199 | + | ||
200 | + ja.setEditable(false); | ||
201 | + ja.setWrapStyleWord(true); | ||
202 | + ja.setLineWrap(true); | ||
203 | + ja.setFont(new Font("微软雅黑", Font.PLAIN, 13)); | ||
204 | + ja.append(getCurrentTime() + "默认选择场景:新增原厂商品\r\n"); | ||
205 | + | ||
206 | + //操作环境选择 | ||
207 | + JLabel label = new JLabel("操作环境:"); | ||
208 | + label.setBounds(24, 53, 78, 15); | ||
209 | + label.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
210 | + frmvBy.getContentPane().add(label); | ||
211 | + | ||
212 | + //加入到购物车场景 | ||
213 | + final JPanel ToCart = new JPanel(); | ||
214 | + ToCart.setBounds(231, 42, 230, 128); | ||
215 | + ToCart.setVisible(false); | ||
216 | + frmvBy.getContentPane().add(ToCart); | ||
217 | + ToCart.setLayout(null); | ||
218 | + | ||
219 | + //可视化操作选项 | ||
220 | + JLabel label_1 = new JLabel("可视化操作:"); | ||
221 | + label_1.setBounds(10, 119, 88, 15); | ||
222 | + label_1.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
223 | + frmvBy.getContentPane().add(label_1); | ||
224 | + | ||
225 | + //可视化 | ||
226 | + JRadioButton view = new JRadioButton("是"); | ||
227 | + view.setBounds(103, 115, 42, 23); | ||
228 | + view.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
229 | + view.setSelected(true); | ||
230 | + frmvBy.getContentPane().add(view); | ||
231 | + | ||
232 | + //无头浏览器 | ||
233 | + JRadioButton notView = new JRadioButton("否"); | ||
234 | + notView.setBounds(160, 115, 44, 23); | ||
235 | + notView.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
236 | + notView.setEnabled(false); | ||
237 | + frmvBy.getContentPane().add(notView); | ||
238 | + | ||
239 | + ButtonGroup group = new ButtonGroup(); | ||
240 | + group.add(view); | ||
241 | + group.add(notView); | ||
242 | + | ||
243 | + //po询价场景 | ||
244 | + final JPanel POInquiry = new JPanel(); | ||
245 | + POInquiry.setBounds(231, 42, 234, 134); | ||
246 | + frmvBy.getContentPane().add(POInquiry); | ||
247 | + POInquiry.setVisible(false); | ||
248 | + POInquiry.setLayout(null); | ||
249 | + | ||
250 | + // po单号字段 | ||
251 | + JLabel POnum = new JLabel("PO单号:"); | ||
252 | + POnum.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
253 | + POnum.setBounds(25, 5, 68, 25); | ||
254 | + POInquiry.add(POnum); | ||
255 | + | ||
256 | + // po单号文本值 | ||
257 | + po = new JTextField(); | ||
258 | + po.setBounds(90, 6, 110, 25); | ||
259 | + POInquiry.add(po); | ||
260 | + po.setColumns(10); | ||
261 | + | ||
262 | + //必填文本 | ||
263 | + JLabel lblNewLabel = new JLabel("*必填"); | ||
264 | + lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
265 | + lblNewLabel.setForeground(Color.RED); | ||
266 | + lblNewLabel.setBounds(200, 10, 44, 15); | ||
267 | + POInquiry.add(lblNewLabel); | ||
268 | + | ||
269 | + //右侧流程介绍文本 | ||
270 | + final JLabel process = new JLabel(); | ||
271 | + process.setBounds(474, 25, 179, 170); | ||
272 | + process.setForeground(Color.GRAY); | ||
273 | + process.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
274 | + process.setText( | ||
275 | + "<html><body>新增原厂商品场景流程:<br>1.商品建档<br>2.更新商品图片<br>3.审核商品<br>4.检查商品库,验证是否新增成功<br>PS:以上均由账号(linxun)操作<br><br></body></html>"); | ||
276 | + frmvBy.getContentPane().add(process); | ||
277 | + | ||
278 | + //操作场景 | ||
279 | + JLabel label_2 = new JLabel("操作场景:"); | ||
280 | + label_2.setBounds(24, 87, 78, 15); | ||
281 | + label_2.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
282 | + frmvBy.getContentPane().add(label_2); | ||
283 | + | ||
284 | + //新增原厂商品场景 | ||
285 | + final JPanel addOriginal = new JPanel(); | ||
286 | + addOriginal.setBounds(231, 37, 234, 134); | ||
287 | + addOriginal.setVisible(true); | ||
288 | + frmvBy.getContentPane().add(addOriginal); | ||
289 | + addOriginal.setLayout(null); | ||
290 | + | ||
291 | + //场景选择,插入对应的值,并打印在日志上 | ||
292 | + final JComboBox selectSystem = new JComboBox<String>(); | ||
293 | + selectSystem.setBounds(102, 51, 114, 20); | ||
294 | + selectSystem.addActionListener(new ActionListener() { | ||
295 | + public void actionPerformed(ActionEvent e) { | ||
296 | + if ("SIT".equals((String) selectSystem.getSelectedItem())) { | ||
297 | + Model.setEnv("SIT"); | ||
298 | + ja.append(getCurrentTime() + "已选择环境:SIT\r\n"); | ||
299 | + } else if ("DIT".equals((String) selectSystem.getSelectedItem())) { | ||
300 | + Model.setEnv("DIT"); | ||
301 | + ja.append(getCurrentTime() + "已选择环境:DIT\r\n"); | ||
302 | + } else if ("HOTFIX".equals((String) selectSystem.getSelectedItem())) { | ||
303 | + Model.setEnv("HOTFIX"); | ||
304 | + ja.append(getCurrentTime() + "已选择环境:HOTFIX\r\n"); | ||
305 | + } else if ("UAT".equals((String) selectSystem.getSelectedItem())) { | ||
306 | + Model.setEnv("UAT"); | ||
307 | + ja.append(getCurrentTime() + "已选择环境:UAT\r\n"); | ||
308 | + } | ||
309 | + } | ||
310 | + }); | ||
311 | + selectSystem.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
312 | + selectSystem.addItem("SIT"); | ||
313 | + selectSystem.addItem("HOTFIX"); | ||
314 | + selectSystem.addItem("UAT"); | ||
315 | + selectSystem.addItem("DIT"); | ||
316 | + frmvBy.getContentPane().add(selectSystem); | ||
317 | + | ||
318 | + //添加市场商品 | ||
319 | + final JPanel addMarket = new JPanel(); | ||
320 | + addMarket.setBounds(0, 67, 230, 46); | ||
321 | + addOriginal.add(addMarket); | ||
322 | + addMarket.setVisible(false); | ||
323 | + addMarket.setLayout(null); | ||
324 | + | ||
325 | + //采购商注册 | ||
326 | + final JPanel register = new JPanel(); | ||
327 | + register.setBounds(231, 42, 224, 134); | ||
328 | + frmvBy.getContentPane().add(register); | ||
329 | + | ||
330 | + //浏览器选择 | ||
331 | + final JComboBox browser = new JComboBox(); | ||
332 | + browser.setEnabled(false); | ||
333 | + browser.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
334 | + browser.setBounds(102, 147, 114, 20); | ||
335 | + browser.setModel(new DefaultComboBoxModel(new String[] { "Chrome", "Firefox", "IE" })); | ||
336 | + frmvBy.getContentPane().add(browser); | ||
337 | + | ||
338 | + //场景选择,根据随选场景做对应的交互 | ||
339 | + final JComboBox selectScene = new JComboBox(); | ||
340 | + selectScene.setBounds(102, 85, 114, 20); | ||
341 | + selectScene.setForeground(Color.BLACK); | ||
342 | + selectScene.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
343 | + selectScene.addActionListener(new ActionListener() { | ||
344 | + public void actionPerformed(ActionEvent e) { | ||
345 | + //此处为默认将所有的场景视图先隐藏,后续根据所选场景显示对应的视图 | ||
346 | + addOriginal.setVisible(false); | ||
347 | + addMarket.setVisible(false); | ||
348 | + ToCart.setVisible(false); | ||
349 | + POInquiry.setVisible(false); | ||
350 | + register.setVisible(false); | ||
351 | + if ("新增原厂商品".equals((String) selectScene.getSelectedItem())) { | ||
352 | + process.setText( | ||
353 | + "<html><body>新增原厂商品场景流程:<br>1.商品建档<br>2.更新商品图片<br>3.审核商品<br>4.检查商品库,验证是否新增成功<br>PS:以上均由账号(linxun)操作<br><br></body></html>"); | ||
354 | + addOriginal.setVisible(true); | ||
355 | + ja.append(getCurrentTime() + "已选择场景:新增原厂商品\r\n"); | ||
356 | + } else if ("新增市场商品".equals((String) selectScene.getSelectedItem())) { | ||
357 | + process.setText("<html><body>新增市场商品场景流程:<br>" + "1.指定采购商编号(默认:RUS00833)<br>" | ||
358 | + + "2.使用账号(maomeixiang)对指定采购商进行市场商品建档并选择审核人为\"邢昌勇\"<br>" | ||
359 | + + "3.使用账号(xingchangyong)对市场商品审核<br></body></html>"); | ||
360 | + addOriginal.setVisible(true); | ||
361 | + addMarket.setVisible(true); | ||
362 | + ja.append(getCurrentTime() + "已选择场景:新增市场商品\r\n"); | ||
363 | + } else if ("发布团购".equals((String) selectScene.getSelectedItem())) { | ||
364 | + ja.append(getCurrentTime() + "已选择场景:发布团购,运行过程中将会打开关闭浏览器2次!\r\n"); | ||
365 | + process.setText( | ||
366 | + "<html><body>发布团购场景流程:<br><font color=\"red\">1.先执行新增原厂商品流程,生成一个原厂SKU</font><br>2.使用账号(linrong)为新增的SKU分配类目经理<br>3.团购设置中添加该SKU,并发布团购,验证团购发布结果</body></html>"); | ||
367 | + addOriginal.setVisible(true); | ||
368 | + } else if ("采购商注册".equals((String) selectScene.getSelectedItem())) { | ||
369 | + register.setVisible(true); | ||
370 | + ja.append(getCurrentTime() + "已选择场景:采购商注册,运行过程中将会打开关闭浏览器2次!\r\n"); | ||
371 | + process.setText( | ||
372 | + "<html><body>采购商注册流程:<br>1.使用账号(admin)在bpms后台生成一个邀请码<br>2.采购商平台填写注册信息,并填入上一步生成的邀请码<br>PS:新账号密码默认为:essa123<br><br><br></body></html>"); | ||
373 | + } else if ("添加SKU至购物车".equals((String) selectScene.getSelectedItem())) { | ||
374 | + ToCart.setVisible(true); | ||
375 | + ja.append(getCurrentTime() + "已选择场景:添加SKU至购物车\r\n"); | ||
376 | + process.setText( | ||
377 | + "<html><body>添加SKU至购物车流程:<br>1.Buyer平台根据填入的采购<br>商信息进行登录操作<br>2.若未填写商品编号,将从数<br>据库随机查出一个符合要求的<br>sku添加至购物车<br><br><br></body></html>"); | ||
378 | + } else if ("成品询价".equals((String) selectScene.getSelectedItem())) { | ||
379 | + ToCart.setVisible(true); | ||
380 | + ja.append(getCurrentTime() + "已选择场景:成品询价,将重启浏览器多次\r\n"); | ||
381 | + process.setText( | ||
382 | + "<html><body>成品询价流程:<br>1.Buyer平台根据填入的采购<br>商信息加入sku,若未填写sku<br>编号,将随机从数据库获取符<br>合要求的sku<br>2.bpms后台登录账号(chenhong)对该sku进行成<br>品询价审核<br></body></html>"); | ||
383 | + } else if ("生成PO".equals((String) selectScene.getSelectedItem())) { | ||
384 | + ToCart.setVisible(true); | ||
385 | + ja.append(getCurrentTime() + "已选择场景:生成PO,将重启浏览器多次\r\n"); | ||
386 | + process.setText( | ||
387 | + "<html><body>生成PO流程:<br>1.采购商平台加入商品至购物车<br>2.bpms后台登录账号(chenhong)对该sku进行成品询价审核<br>3.再次登录采购商平台,进行拼柜、设置唛头、贴纸和提交PO操作</body></html>"); | ||
388 | + } else if ("PO询价".equals((String) selectScene.getSelectedItem())) { | ||
389 | + POInquiry.setVisible(true); | ||
390 | + ja.append(getCurrentTime() + "已选择场景:PO询价\r\n"); | ||
391 | + process.setText("<html><body>PO询价使用介绍:<br>1.填入需要询价的PO单号<br>2.工具将对该PO单号循环进行询价,直到所有商品均询价完成<br>3.如果运行过程中出现询价异常等弹框,手工关闭弹窗后脚本仍会继续执行之后的操作</body></html>"); | ||
392 | + } | ||
393 | + } | ||
394 | + }); | ||
395 | + selectScene.setModel( | ||
396 | + new DefaultComboBoxModel(new String[] { "新增原厂商品", "新增市场商品", "发布团购", "采购商注册", "成品询价", "生成PO", "PO询价" })); | ||
397 | + frmvBy.getContentPane().add(selectScene); | ||
398 | + | ||
399 | + JLabel label_3 = new JLabel("供应商名称:"); | ||
400 | + label_3.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
401 | + label_3.setBounds(9, 15, 91, 15); | ||
402 | + addOriginal.add(label_3); | ||
403 | + | ||
404 | + //供应商名称 | ||
405 | + supplierName = new JTextField(); | ||
406 | + supplierName.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
407 | + supplierName.setForeground(Color.BLACK); | ||
408 | + supplierName.setBounds(92, 10, 114, 25); | ||
409 | + addOriginal.add(supplierName); | ||
410 | + supplierName.setText(supplier); | ||
411 | + supplierName.setColumns(10); | ||
412 | + | ||
413 | + //选择图片 | ||
414 | + JButton button = new JButton("选择图片"); | ||
415 | + button.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
416 | + button.setBounds(91, 44, 91, 23); | ||
417 | + addOriginal.add(button); | ||
418 | + | ||
419 | + JLabel lblSku = new JLabel("商品图片:"); | ||
420 | + lblSku.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
421 | + lblSku.setBounds(22, 48, 70, 15); | ||
422 | + addOriginal.add(lblSku); | ||
423 | + | ||
424 | + final JLabel label_7 = new JLabel("*必填"); | ||
425 | + label_7.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
426 | + label_7.setBounds(192, 48, 42, 15); | ||
427 | + addOriginal.add(label_7); | ||
428 | + label_7.setForeground(Color.RED); | ||
429 | + | ||
430 | + //图片地址 | ||
431 | + final JLabel picPath = new JLabel(""); | ||
432 | + picPath.setVisible(false); | ||
433 | + addOriginal.add(picPath); | ||
434 | + | ||
435 | + JLabel label_5 = new JLabel("采购商编号:"); | ||
436 | + label_5.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
437 | + label_5.setBounds(8, 15, 86, 15); | ||
438 | + addMarket.add(label_5); | ||
439 | + | ||
440 | + //采购商编号 | ||
441 | + buyerNo2 = new JTextField(); | ||
442 | + buyerNo2.setBounds(93, 11, 114, 25); | ||
443 | + addMarket.add(buyerNo2); | ||
444 | + buyerNo2.setFont(new Font("宋体", Font.PLAIN, 14)); | ||
445 | + buyerNo2.setText(buyerNo); | ||
446 | + buyerNo2.setColumns(10); | ||
447 | + | ||
448 | + //选择图片按钮 | ||
449 | + button.addActionListener(new ActionListener() { | ||
450 | + public void actionPerformed(ActionEvent e) { | ||
451 | + JFileChooser jf = new JFileChooser(); | ||
452 | + jf.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); | ||
453 | + jf.showDialog(new JLabel(), "选择图片"); | ||
454 | + File file = jf.getSelectedFile(); | ||
455 | + String s = null; | ||
456 | + try { | ||
457 | + s = file.getAbsolutePath(); | ||
458 | + } catch (NullPointerException exception) { | ||
459 | + } | ||
460 | + if (s == "" || s == null) { | ||
461 | + ja.append(getCurrentTime() + "您未选择图片,请选择图片\r\n"); | ||
462 | + } else { | ||
463 | + ja.append(getCurrentTime() + "选择的图片为:" + s + "\r\n"); | ||
464 | + picPath.setText(s); | ||
465 | + label_7.setText("已选"); | ||
466 | + } | ||
467 | + } | ||
468 | + }); | ||
469 | + | ||
470 | + JLabel label_4 = new JLabel("浏览器:"); | ||
471 | + label_4.setBounds(38, 149, 62, 15); | ||
472 | + label_4.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
473 | + frmvBy.getContentPane().add(label_4); | ||
474 | + | ||
475 | + //开始按钮 | ||
476 | + JButton btnNewButton = new JButton("开 始"); | ||
477 | + btnNewButton.setBounds(551, 325, 101, 35); | ||
478 | + frmvBy.getContentPane().add(btnNewButton); | ||
479 | + btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 17)); | ||
480 | + | ||
481 | + JLabel lblEssav = new JLabel("ESSA自动化测试工具 V1.0.1"); | ||
482 | + lblEssav.setBounds(225, 10, 228, 29); | ||
483 | + lblEssav.setFont(new Font("微软雅黑", Font.BOLD, 16)); | ||
484 | + frmvBy.getContentPane().add(lblEssav); | ||
485 | + | ||
486 | + JLabel lblwindowsjdkbug = new JLabel( | ||
487 | + "<html><body>提示:1.建议使用版本号为68.0的Chrome浏览器<br> 2.由于部分操作会用到鼠标事件,若运行时手动切换界面可能会导致运行出错</body></html>"); | ||
488 | + lblwindowsjdkbug.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
489 | + lblwindowsjdkbug.setBounds(25, 323, 456, 40); | ||
490 | + frmvBy.getContentPane().add(lblwindowsjdkbug); | ||
491 | + | ||
492 | + JLabel Account = new JLabel("采购商账号:"); | ||
493 | + Account.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
494 | + Account.setBounds(9, 10, 88, 15); | ||
495 | + ToCart.add(Account); | ||
496 | + | ||
497 | + JLabel Password = new JLabel("密码:"); | ||
498 | + Password.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
499 | + Password.setBounds(50, 41, 65, 15); | ||
500 | + ToCart.add(Password); | ||
501 | + | ||
502 | + JLabel No = new JLabel("商品编号:"); | ||
503 | + No.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
504 | + No.setBounds(22, 100, 88, 15); | ||
505 | + ToCart.add(No); | ||
506 | + | ||
507 | + account = new JTextField(); | ||
508 | + account.setText(buyerAccount); | ||
509 | + account.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
510 | + account.setBounds(92, 4, 130, 25); | ||
511 | + ToCart.add(account); | ||
512 | + account.setColumns(10); | ||
513 | + | ||
514 | + password = new JTextField(); | ||
515 | + password.setText("essa123"); | ||
516 | + password.setToolTipText(""); | ||
517 | + password.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
518 | + password.setBounds(92, 37, 130, 25); | ||
519 | + ToCart.add(password); | ||
520 | + password.setColumns(10); | ||
521 | + | ||
522 | + //sku编号 | ||
523 | + SkuNo = new JTextArea(); | ||
524 | + SkuNo.setText("选填,勿填活动商品"); | ||
525 | + SkuNo.setForeground(Color.LIGHT_GRAY); | ||
526 | + SkuNo.setFont(new Font("微软雅黑", Font.PLAIN, 12)); | ||
527 | + SkuNo.setLineWrap(true); | ||
528 | + SkuNo.addMouseListener(new MouseAdapter() { | ||
529 | + @Override | ||
530 | + public void mouseClicked(MouseEvent e) { | ||
531 | + if (SkuNo.getText().equals("选填,勿填活动商品") || SkuNo.getText().equals("选填,勿填非活动商品") ) { | ||
532 | + SkuNo.setForeground(Color.black); | ||
533 | + SkuNo.setText(""); | ||
534 | + } | ||
535 | + } | ||
536 | + }); | ||
537 | + SkuNo.setBounds(92, 100, 130, 25); | ||
538 | + SkuNo.setBorder(new LineBorder(new Color(127,157,185), 1, false)); | ||
539 | + ToCart.add(SkuNo); | ||
540 | + SkuNo.setColumns(10); | ||
541 | + | ||
542 | + //商品类型 | ||
543 | + JLabel kind = new JLabel("商品类型:"); | ||
544 | + kind.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
545 | + kind.setBounds(22, 75, 70, 15); | ||
546 | + ToCart.add(kind); | ||
547 | + | ||
548 | + //非活动商品 | ||
549 | + JRadioButton notActivity = new JRadioButton("非活动"); | ||
550 | + notActivity.addActionListener(new ActionListener() { | ||
551 | + public void actionPerformed(ActionEvent arg0) { | ||
552 | + Model.setIsactivity(0); | ||
553 | + SkuNo.setText("选填,勿填活动商品"); | ||
554 | + } | ||
555 | + }); | ||
556 | + notActivity.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
557 | + notActivity.setBounds(92, 71, 70, 23); | ||
558 | + ToCart.add(notActivity); | ||
559 | + | ||
560 | + //活动商品 | ||
561 | + JRadioButton isActivity = new JRadioButton("活动"); | ||
562 | + isActivity.addActionListener(new ActionListener() { | ||
563 | + public void actionPerformed(ActionEvent e) { | ||
564 | + Model.setIsactivity(1); | ||
565 | + SkuNo.setText("选填,勿填非活动商品"); | ||
566 | + } | ||
567 | + }); | ||
568 | + isActivity.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
569 | + isActivity.setBounds(165, 71, 64, 23); | ||
570 | + ToCart.add(isActivity); | ||
571 | + | ||
572 | + //活动和非活动单选 | ||
573 | + ButtonGroup group1 = new ButtonGroup(); | ||
574 | + group1.add(notActivity); | ||
575 | + group1.add(isActivity); | ||
576 | + notActivity.setSelected(true); | ||
577 | + | ||
578 | + JLabel RegisterAccount = new JLabel("采购商邮箱:"); | ||
579 | + register.add(RegisterAccount); | ||
580 | + RegisterAccount.setFont(new Font("微软雅黑", Font.PLAIN, 14)); | ||
581 | + | ||
582 | + registerAccount = new JTextField(); | ||
583 | + registerAccount.setForeground(Color.LIGHT_GRAY); | ||
584 | + registerAccount.setText("若不填写将自动生成"); | ||
585 | + registerAccount.addMouseListener(new MouseAdapter() { | ||
586 | + @Override | ||
587 | + public void mouseClicked(MouseEvent e) { | ||
588 | + if (registerAccount.getText().equals("若不填写将自动生成")) { | ||
589 | + registerAccount.setForeground(Color.black); | ||
590 | + registerAccount.setText(""); | ||
591 | + } | ||
592 | + } | ||
593 | + }); | ||
594 | + register.add(registerAccount); | ||
595 | + registerAccount.setFont(new Font("微软雅黑", Font.PLAIN, 13)); | ||
596 | + registerAccount.setColumns(10); | ||
597 | + | ||
598 | + btnNewButton.addActionListener(new ActionListener() { | ||
599 | + public void actionPerformed(ActionEvent e) { | ||
600 | + SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {// 加入线程 | ||
601 | + | ||
602 | + @Override | ||
603 | + protected Void doInBackground() throws Exception { | ||
604 | + String Environment = (String) selectSystem.getSelectedItem(); | ||
605 | + String Scene = (String) selectScene.getSelectedItem(); | ||
606 | + String Browser = (String) browser.getSelectedItem(); | ||
607 | + //记录用户输入的数据,下次读取 | ||
608 | + setData("supplier", supplierName.getText()); | ||
609 | + setData("buyerNo", buyerNo2.getText()); | ||
610 | + setData("buyerAccount", account.getText()); | ||
611 | + ja.append(getCurrentTime() + "程序正在启动中……切勿双击【开始】\r\n"); | ||
612 | + BrowserEngine.setInit(Environment, Browser); | ||
613 | + TestNG testNG = new TestNG(); | ||
614 | + List<String> suites = new ArrayList<String>(); | ||
615 | + if (Scene == "新增原厂商品") { | ||
616 | + AddOriginalGoodsPage.setSupplierName(supplierName.getText()); | ||
617 | + UpdatePicPage.setPicPath(picPath.getText()); | ||
618 | + suites.add(".\\resources\\suites\\addOriginalGoods.xml");// 图形界面 | ||
619 | + } else if (Scene == "新增市场商品") { | ||
620 | + Model.setBuyerNo(buyerNo2.getText()); | ||
621 | + Model.setPicPath(picPath.getText()); | ||
622 | + Model.setSupplierName(supplierName.getText()); | ||
623 | + suites.add(".\\resources\\suites\\addMarketGoods.xml");// 图形界面 | ||
624 | + } else if (Scene == "发布团购") { | ||
625 | + AddOriginalGoodsPage.setSupplierName(supplierName.getText()); | ||
626 | + UpdatePicPage.setPicPath(picPath.getText()); | ||
627 | + suites.add(".\\resources\\suites\\publishGroupPurchase.xml");// 图形界面 | ||
628 | + } else if (Scene == "采购商注册") { | ||
629 | + if (!(registerAccount.getText().equals("") | ||
630 | + || registerAccount.getText().equals("若不填写将自动生成"))) { | ||
631 | + Model.setEmail(registerAccount.getText()); | ||
632 | + } | ||
633 | + suites.add(".\\resources\\suites\\buyerRegister.xml");// 图形界面 | ||
634 | + } else if (Scene == "添加SKU至购物车") {// 暂时舍弃 | ||
635 | + Model.setBuyerAccount(account.getText()); | ||
636 | + Model.setBuyerPassword(password.getText()); | ||
637 | + Model.setSkuNo(SkuNo.getText()); | ||
638 | + suites.add(".\\resources\\suites\\addSkuToCart.xml"); | ||
639 | + } else if (Scene == "成品询价") { | ||
640 | + Model.setBuyerAccount(account.getText()); | ||
641 | + Model.setBuyerPassword(password.getText()); | ||
642 | + Model.setSkuNo(SkuNo.getText()); | ||
643 | + if (Model.getIsactivity() == 1) { | ||
644 | + suites.add(".\\resources\\suites\\activityInquiry.xml"); | ||
645 | + }else { | ||
646 | + suites.add(".\\resources\\suites\\productInquiry.xml"); | ||
647 | + } | ||
648 | + } else if (Scene == "生成PO") { | ||
649 | + Model.setBuyerAccount(account.getText()); | ||
650 | + Model.setBuyerPassword(password.getText()); | ||
651 | + Model.setSkuNo(SkuNo.getText()); | ||
652 | + if (Model.getIsactivity() == 1) { | ||
653 | + suites.add(".\\resources\\suites\\activitySendPO.xml"); | ||
654 | + }else { | ||
655 | + suites.add(".\\resources\\suites\\sendPO.xml"); | ||
656 | + } | ||
657 | + } else if (Scene == "PO询价") { | ||
658 | + Model.setPoNum(po.getText()); | ||
659 | + suites.add(".\\resources\\suites\\POInquiry.xml"); | ||
660 | + } | ||
661 | + testNG.setTestSuites(suites); | ||
662 | + testNG.run(); | ||
663 | + ja.append(getCurrentTime() + "=======" + Scene + "场景,执行完毕!=======\r\n"); | ||
664 | + if (Scene == "新增原厂商品" || Scene == "新增市场商品" || Scene == "发布团购") { | ||
665 | + no = Model.getSkuNo(); | ||
666 | + if (no != null) { | ||
667 | + ja.append(getCurrentTime() + "SKU商品编号:" + no + "\r\n"); | ||
668 | + } else { | ||
669 | + ja.append(getCurrentTime() | ||
670 | + + "程序执行失败了!\r\n你可查看目录中test-output/index.html的测试报告,或者查看Log中的执行日志检查原因\r\n"); | ||
671 | + } | ||
672 | + } else if (Scene == "采购商注册") { | ||
673 | + String code = Model.getInvateCode(); | ||
674 | + String email = Model.getEmail(); | ||
675 | + if (code != null && email != null) { | ||
676 | + ja.append(getCurrentTime() + "生成的邀请码:" + Model.getInvateCode() + "\r\n"); | ||
677 | + ja.append(getCurrentTime() + "新采购商邮箱:" + Model.getEmail() + "\r\n"); | ||
678 | + } else { | ||
679 | + ja.append(getCurrentTime() | ||
680 | + + "程序执行失败了!\r\n你可以分析目录中test-output/index.html的测试报告,或者查看目录中Log文件夹生成的执行日志\r\n"); | ||
681 | + } | ||
682 | + } else if (Scene == "添加SKU至购物车") { | ||
683 | + ja.append(getCurrentTime() + "所选采购商账号:" + Model.getBuyerAccount() + "\r\n"); | ||
684 | + ja.append(getCurrentTime() + "添加的SKU编号为:" + Model.getSkuNo() + "\r\n"); | ||
685 | + } else if (Scene == "成品询价") { | ||
686 | + ja.append(getCurrentTime() + "采购商账号:" + Model.getBuyerAccount() + "\r\n"); | ||
687 | + ja.append(getCurrentTime() + "SKU编号:" + Model.getSkuNo() + "\r\n"); | ||
688 | + } else if (Scene == "生成PO") { | ||
689 | + ja.append(getCurrentTime() + "采购商账号:" + Model.getBuyerAccount() + "\r\n"); | ||
690 | + ja.append(getCurrentTime() + "PO单号:" + Model.getPoNum() + "\r\n"); | ||
691 | + } | ||
692 | + return null; | ||
693 | + } | ||
694 | + }; | ||
695 | + worker.execute(); | ||
696 | + | ||
697 | + } | ||
698 | + }); | ||
699 | + | ||
700 | + } | ||
701 | +} |
15.6 KB
No preview for this file type
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +#browserName=FireFox | ||
2 | +#browserName=IE | ||
3 | +browserName=Chrome | ||
4 | + | ||
5 | +SIT=http://bpms.sit.gz.essa | ||
6 | +BSIT=http://en.portalsit.cn | ||
7 | + | ||
8 | +HOTFIX=http://bpms.hotfix.gz.essa | ||
9 | +BHOTFIX=http://en.portalhotfix.cn | ||
10 | + | ||
11 | +UAT=http://bpms.spstoys.com:7291 | ||
12 | +BUAT=http://en.spstoys.com:889 | ||
13 | + | ||
14 | +DIT=http://bpms.dit.gz.essa | ||
15 | +BDIT=http://en.portaldit.cn | ||
16 | + |
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="PO询价"> | ||
4 | + <listeners> | ||
5 | + <!-- 设置监听,测试完毕后会发送测试报告至qq邮箱 | ||
6 | + <listener class-name="com.essa.framework.ListenerSuite"/> | ||
7 | + --> | ||
8 | + </listeners> | ||
9 | + <test name="POInquiry"> | ||
10 | + <classes> | ||
11 | + <class name="com.essa.testSuite.TestPOInquiry"> | ||
12 | + <methods> | ||
13 | + <include name="POInquiry"/> | ||
14 | + </methods> | ||
15 | + </class> | ||
16 | + </classes> | ||
17 | + </test> | ||
18 | + | ||
19 | +<!-- <test name="login"> | ||
20 | + <classes> | ||
21 | + 选择要执行的测试类 | ||
22 | + <class name="com.essa.testSuite.Test_Login"> | ||
23 | + </class> | ||
24 | + </classes> | ||
25 | + </test> --> | ||
26 | + | ||
27 | + <!-- | ||
28 | + <test name="编辑综合实力评估"> | ||
29 | + <classes> | ||
30 | + <class name="com.essa.testSuite.Test_Development_Ability"> | ||
31 | + <methods> | ||
32 | + <include name="editDevelopmentAbility"/> | ||
33 | + <include name="toSupplierOperationsTrack"/> 切换到供应商管理菜单 | ||
34 | + </methods> | ||
35 | + </class> | ||
36 | + </classes> | ||
37 | + </test> | ||
38 | + --> | ||
39 | +</suite> | ||
40 | + |
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="活动商品询价"> | ||
4 | + <test name="addActivity"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <!-- 将活动商品加入购物车 --> | ||
8 | + <methods> | ||
9 | + <include name="addSku" /> | ||
10 | + </methods> | ||
11 | + </class> | ||
12 | + </classes> | ||
13 | + </test> | ||
14 | + <test name="planApply"> | ||
15 | + <classes> | ||
16 | + <!-- 活动达成,类目经理送询价 --> | ||
17 | + <class name="com.essa.testSuite.TestActivity"> | ||
18 | + <methods> | ||
19 | + <include name="TestActivityToPO" /> | ||
20 | + </methods> | ||
21 | + </class> | ||
22 | + </classes> | ||
23 | + </test> | ||
24 | + <test name="confirmBuy"> | ||
25 | + <!-- 采购商确认采购 --> | ||
26 | + <classes> | ||
27 | + <class name="com.buyer.testSuite.TestConfirmBuy"> | ||
28 | + <methods> | ||
29 | + <include name="confirmBuy" /> | ||
30 | + </methods> | ||
31 | + </class> | ||
32 | + </classes> | ||
33 | + </test> | ||
34 | + <test name="ActivityInquiry"> | ||
35 | + <classes> | ||
36 | + <!-- bpms成品询价,类目经理修订采购计划,财务审核计划 --> | ||
37 | + <class name="com.essa.testSuite.TestActivity"> | ||
38 | + <methods> | ||
39 | + <include name="productInquiry" /> | ||
40 | + <include name="planeModify" /> | ||
41 | + <include name="TestAuditApply" /> | ||
42 | + </methods> | ||
43 | + </class> | ||
44 | + </classes> | ||
45 | + </test> | ||
46 | +</suite> | ||
47 | + |
@@ -0,0 +1,58 @@ | @@ -0,0 +1,58 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="活动商品生成PO"> | ||
4 | + <test name="addActivity"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <!-- 将活动商品加入购物车 --> | ||
8 | + <methods> | ||
9 | + <include name="addSku" /> | ||
10 | + </methods> | ||
11 | + </class> | ||
12 | + </classes> | ||
13 | + </test> | ||
14 | + <test name="planApply"> | ||
15 | + <classes> | ||
16 | + <!-- 活动达成,类目经理送询价 --> | ||
17 | + <class name="com.essa.testSuite.TestActivity"> | ||
18 | + <methods> | ||
19 | + <include name="TestActivityToPO" /> | ||
20 | + </methods> | ||
21 | + </class> | ||
22 | + </classes> | ||
23 | + </test> | ||
24 | + <test name="confirmBuy"> | ||
25 | + <!-- 采购商确认采购 --> | ||
26 | + <classes> | ||
27 | + <class name="com.buyer.testSuite.TestConfirmBuy"> | ||
28 | + <methods> | ||
29 | + <include name="confirmBuy" /> | ||
30 | + </methods> | ||
31 | + </class> | ||
32 | + </classes> | ||
33 | + </test> | ||
34 | + <test name="ActivityInquiry"> | ||
35 | + <classes> | ||
36 | + <!-- bpms成品询价,类目经理修订采购计划,财务审核计划 --> | ||
37 | + <class name="com.essa.testSuite.TestActivity"> | ||
38 | + <methods> | ||
39 | + <include name="productInquiry" /> | ||
40 | + <include name="planeModify" /> | ||
41 | + <include name="TestAuditApply" /> | ||
42 | + </methods> | ||
43 | + </class> | ||
44 | + </classes> | ||
45 | + </test> | ||
46 | + <test name="ActivityToPO"> | ||
47 | + <classes> | ||
48 | + <!-- 采购商平台将该活动商品拼柜,生成po单 --> | ||
49 | + <class name="com.buyer.testSuite.TestSendPO"> | ||
50 | + <methods> | ||
51 | + <include name="conslidation" /> | ||
52 | + <include name="sendPO" /> | ||
53 | + </methods> | ||
54 | + </class> | ||
55 | + </classes> | ||
56 | + </test> | ||
57 | +</suite> | ||
58 | + |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="新增市场商品"> | ||
4 | + <test name="addMarketGoods"> | ||
5 | + <classes> | ||
6 | + <class name="com.essa.testSuite.TestAddMarketGoods"> | ||
7 | + <methods> | ||
8 | + <include name="toMarketGoodsRelesePage"/> | ||
9 | + <include name="addMarketGoods"/> | ||
10 | + <include name="auditMarketGoods"/> | ||
11 | + </methods> | ||
12 | + </class> | ||
13 | + </classes> | ||
14 | + </test> | ||
15 | +</suite> | ||
16 | + |
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="新增原厂商品"> | ||
4 | + <listeners> | ||
5 | + <!-- 设置监听,测试完毕后会发送测试报告至qq邮箱 | ||
6 | + <listener class-name="com.essa.framework.ListenerSuite"/> | ||
7 | + --> | ||
8 | + </listeners> | ||
9 | + <test name="addOriginalGoods"> | ||
10 | + <classes> | ||
11 | + <class name="com.essa.testSuite.TestAddOriginalGoods"> | ||
12 | + <methods> | ||
13 | + <include name="toAddOriginalGoodsPage"/> | ||
14 | + <include name="toGoodsRelesePage"/> | ||
15 | + <include name="updatePic"/> | ||
16 | + <include name="auditOriginal"/> | ||
17 | + <include name="getSkuNo"/> | ||
18 | + </methods> | ||
19 | + </class> | ||
20 | + </classes> | ||
21 | + </test> | ||
22 | + | ||
23 | +<!-- <test name="login"> | ||
24 | + <classes> | ||
25 | + 选择要执行的测试类 | ||
26 | + <class name="com.essa.testSuite.Test_Login"> | ||
27 | + </class> | ||
28 | + </classes> | ||
29 | + </test> --> | ||
30 | + | ||
31 | + <!-- | ||
32 | + <test name="编辑综合实力评估"> | ||
33 | + <classes> | ||
34 | + <class name="com.essa.testSuite.Test_Development_Ability"> | ||
35 | + <methods> | ||
36 | + <include name="editDevelopmentAbility"/> | ||
37 | + <include name="toSupplierOperationsTrack"/> 切换到供应商管理菜单 | ||
38 | + </methods> | ||
39 | + </class> | ||
40 | + </classes> | ||
41 | + </test> | ||
42 | + --> | ||
43 | +</suite> | ||
44 | + |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="添加SKU到购物车"> | ||
4 | + <test name="buyerRegister"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <methods> | ||
8 | + <include name="keywordToCart"/> | ||
9 | + </methods> | ||
10 | + </class> | ||
11 | + </classes> | ||
12 | + </test> | ||
13 | +</suite> | ||
14 | + |
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="采购商注册"> | ||
4 | + <test name="buyerRegister"> | ||
5 | + <classes> | ||
6 | + <class name="com.essa.testSuite.TestGenrateCode"> | ||
7 | + <methods> | ||
8 | + <include name="genrateCode"/> | ||
9 | + </methods> | ||
10 | + </class> | ||
11 | + <class name="com.buyer.testSuite.TestRegister"> | ||
12 | + <methods> | ||
13 | + <include name="register"/> | ||
14 | + </methods> | ||
15 | + </class> | ||
16 | + </classes> | ||
17 | + </test> | ||
18 | +</suite> | ||
19 | + |
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="成品询价"> | ||
4 | + <test name="productInquiry"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <methods> | ||
8 | + <include name="keywordToCart"/> | ||
9 | + </methods> | ||
10 | + </class> | ||
11 | + <class name="com.essa.testSuite.TestProductInquiry"> | ||
12 | + <methods> | ||
13 | + <include name="productInquiry"/> | ||
14 | + </methods> | ||
15 | + </class> | ||
16 | + </classes> | ||
17 | + </test> | ||
18 | +</suite> | ||
19 | + |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="发布团购商品"> | ||
4 | + <test name="publishGroupPurchase"> | ||
5 | + <classes> | ||
6 | + <class name="com.essa.testSuite.TestAddOriginalGoods"> | ||
7 | + <methods> | ||
8 | + <include name="toAddOriginalGoodsPage"/> | ||
9 | + <include name="updatePic"/> | ||
10 | + <include name="auditOriginal"/> | ||
11 | + <include name="getSkuNo"/> | ||
12 | + </methods> | ||
13 | + </class> | ||
14 | + <class name="com.essa.testSuite.TestGroupPurchase"> | ||
15 | + <methods> | ||
16 | + <include name="SkuCategoryManagerCongfig"/> | ||
17 | + <include name="publishGroupPurchase"/> | ||
18 | + <include name="isPublish"/> | ||
19 | + </methods> | ||
20 | + </class> | ||
21 | + </classes> | ||
22 | + </test> | ||
23 | +</suite> | ||
24 | + |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="提交PO"> | ||
4 | + <test name="sendPO"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <methods> | ||
8 | + <include name="addSku"/> | ||
9 | + </methods> | ||
10 | + </class> | ||
11 | + <class name="com.essa.testSuite.TestProductInquiry"> | ||
12 | + <methods> | ||
13 | + <include name="productInquiry"/> | ||
14 | + </methods> | ||
15 | + </class> | ||
16 | + <class name="com.buyer.testSuite.TestSendPO"> | ||
17 | + <methods> | ||
18 | + <include name="conslidation"/> | ||
19 | + <include name="sendPO"/> | ||
20 | + </methods> | ||
21 | + </class> | ||
22 | + </classes> | ||
23 | + </test> | ||
24 | +</suite> | ||
25 | + |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
3 | +<suite name="提交PO-活动商品"> | ||
4 | + <test name="sendActivityPO"> | ||
5 | + <classes> | ||
6 | + <class name="com.buyer.testSuite.TestAddToCart"> | ||
7 | + <methods> | ||
8 | + <include name="addSku"/> | ||
9 | + </methods> | ||
10 | + </class> | ||
11 | + <class name="com.buyer.testSuite.TestSendPO"> | ||
12 | + <methods> | ||
13 | + <include name="conslidation"/> | ||
14 | + <include name="sendPO"/> | ||
15 | + </methods> | ||
16 | + </class> | ||
17 | + </classes> | ||
18 | + </test> | ||
19 | +</suite> | ||
20 | + |