Compare View
Commits (49)
-
Yb See merge request !1
-
# Conflicts: # src/main/java/com/essa/pageObject/HomePage.java
-
# Conflicts: # src/main/java/com/essa/pageObject/HomePage.java
-
# Conflicts: # src/main/java/com/essa/pageObject/HomePage.java
-
Dev master See merge request !2
Showing
355 changed files
Show diff stats
Too many changes.
To preserve performance only 100 of 355 files are displayed.
.classpath deleted
... | ... | @@ -1,31 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<classpath> | |
3 | - <classpathentry kind="src" output="target/classes" path="src/main/java"> | |
4 | - <attributes> | |
5 | - <attribute name="optional" value="true"/> | |
6 | - <attribute name="maven.pomderived" value="true"/> | |
7 | - </attributes> | |
8 | - </classpathentry> | |
9 | - <classpathentry kind="src" output="target/test-classes" path="src/test/java"> | |
10 | - <attributes> | |
11 | - <attribute name="optional" value="true"/> | |
12 | - <attribute name="maven.pomderived" value="true"/> | |
13 | - </attributes> | |
14 | - </classpathentry> | |
15 | - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> | |
16 | - <attributes> | |
17 | - <attribute name="maven.pomderived" value="true"/> | |
18 | - </attributes> | |
19 | - </classpathentry> | |
20 | - <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | |
21 | - <attributes> | |
22 | - <attribute name="maven.pomderived" value="true"/> | |
23 | - </attributes> | |
24 | - </classpathentry> | |
25 | - <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | |
26 | - <attributes> | |
27 | - <attribute name="maven.pomderived" value="true"/> | |
28 | - </attributes> | |
29 | - </classpathentry> | |
30 | - <classpathentry kind="output" path="target/classes"/> | |
31 | -</classpath> |
.project deleted
... | ... | @@ -1,23 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<projectDescription> | |
3 | - <name>demo</name> | |
4 | - <comment></comment> | |
5 | - <projects> | |
6 | - </projects> | |
7 | - <buildSpec> | |
8 | - <buildCommand> | |
9 | - <name>org.eclipse.jdt.core.javabuilder</name> | |
10 | - <arguments> | |
11 | - </arguments> | |
12 | - </buildCommand> | |
13 | - <buildCommand> | |
14 | - <name>org.eclipse.m2e.core.maven2Builder</name> | |
15 | - <arguments> | |
16 | - </arguments> | |
17 | - </buildCommand> | |
18 | - </buildSpec> | |
19 | - <natures> | |
20 | - <nature>org.eclipse.jdt.core.javanature</nature> | |
21 | - <nature>org.eclipse.m2e.core.maven2Nature</nature> | |
22 | - </natures> | |
23 | -</projectDescription> |
.settings/org.eclipse.core.resources.prefs deleted
.settings/org.eclipse.jdt.core.prefs deleted
.settings/org.eclipse.m2e.core.prefs deleted
Log/Screenshots/20180831_153604截图.png deleted
84.8 KB
Log/Screenshots/20180831_170604截图.png deleted
105 KB
... | ... | @@ -0,0 +1,59 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |
3 | + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | |
4 | + <output url="file://$MODULE_DIR$/target/classes" /> | |
5 | + <output-test url="file://$MODULE_DIR$/target/test-classes" /> | |
6 | + <content url="file://$MODULE_DIR$"> | |
7 | + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | |
8 | + <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | |
9 | + <excludeFolder url="file://$MODULE_DIR$/target" /> | |
10 | + </content> | |
11 | + <orderEntry type="inheritedJdk" /> | |
12 | + <orderEntry type="sourceFolder" forTests="false" /> | |
13 | + <orderEntry type="library" name="Maven: org.testng:testng:6.14.3" level="project" /> | |
14 | + <orderEntry type="library" name="Maven: com.beust:jcommander:1.72" level="project" /> | |
15 | + <orderEntry type="library" name="Maven: org.apache-extras.beanshell:bsh:2.0b6" level="project" /> | |
16 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-java:3.11.0" level="project" /> | |
17 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-api:3.11.0" level="project" /> | |
18 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-edge-driver:3.11.0" level="project" /> | |
19 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-opera-driver:3.11.0" level="project" /> | |
20 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-remote-driver:3.11.0" level="project" /> | |
21 | + <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.9" level="project" /> | |
22 | + <orderEntry type="library" name="Maven: org.apache.commons:commons-exec:1.3" level="project" /> | |
23 | + <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" /> | |
24 | + <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" /> | |
25 | + <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" /> | |
26 | + <orderEntry type="library" name="Maven: com.google.guava:guava:23.6-jre" level="project" /> | |
27 | + <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" /> | |
28 | + <orderEntry type="library" name="Maven: org.checkerframework:checker-compat-qual:2.0.0" level="project" /> | |
29 | + <orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.1.3" level="project" /> | |
30 | + <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" /> | |
31 | + <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.14" level="project" /> | |
32 | + <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.3" level="project" /> | |
33 | + <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" /> | |
34 | + <orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.9.1" level="project" /> | |
35 | + <orderEntry type="library" name="Maven: com.squareup.okio:okio:1.13.0" level="project" /> | |
36 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-firefox-driver:3.11.0" level="project" /> | |
37 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-chrome-driver:3.11.0" level="project" /> | |
38 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-safari-driver:3.11.0" level="project" /> | |
39 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-ie-driver:3.11.0" level="project" /> | |
40 | + <orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-support:2.46.0" level="project" /> | |
41 | + <orderEntry type="library" name="Maven: javax.mail:mail:1.4" level="project" /> | |
42 | + <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" /> | |
43 | + <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" /> | |
44 | + <orderEntry type="library" name="Maven: org.apache.poi:poi:3.14" level="project" /> | |
45 | + <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.14" level="project" /> | |
46 | + <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.03" level="project" /> | |
47 | + <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.14" level="project" /> | |
48 | + <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" /> | |
49 | + <orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" /> | |
50 | + <orderEntry type="library" name="Maven: commons-io:commons-io:1.3.2" level="project" /> | |
51 | + <orderEntry type="library" name="Maven: mysql:mysql-connector-java:6.0.6" level="project" /> | |
52 | + <orderEntry type="library" name="Maven: org.dbunit:dbunit:2.5.4" level="project" /> | |
53 | + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" /> | |
54 | + <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" /> | |
55 | + <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> | |
56 | + <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" /> | |
57 | + <orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" /> | |
58 | + </component> | |
59 | +</module> | |
0 | 60 | \ No newline at end of file | ... | ... |
pom.xml
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
1 | 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" |
2 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
3 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
4 | - <modelVersion>4.0.0</modelVersion> | |
5 | - | |
6 | - <groupId>com.essatest</groupId> | |
7 | - <artifactId>essa</artifactId> | |
8 | - <version>0.0.1-SNAPSHOT</version> | |
9 | - <packaging>jar</packaging> | |
10 | - | |
11 | - <name>essa</name> | |
12 | - <url>http://maven.apache.org</url> | |
13 | - | |
14 | - <properties> | |
15 | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
16 | - </properties> | |
17 | - | |
18 | - <dependencies> | |
19 | - | |
20 | - <dependency> | |
21 | - <groupId>org.testng</groupId> | |
22 | - <artifactId>testng</artifactId> | |
23 | - <version>6.14.3</version> | |
24 | - <!-- <scope>test</scope> --> | |
25 | - </dependency> | |
26 | - | |
27 | - <dependency> | |
28 | - <groupId>org.seleniumhq.selenium</groupId> | |
29 | - <artifactId>selenium-java</artifactId> | |
30 | - <version>3.11.0</version> | |
31 | - </dependency> | |
32 | - | |
33 | - | |
34 | - <dependency> | |
35 | - <groupId>org.seleniumhq.selenium</groupId> | |
36 | - <artifactId>selenium-firefox-driver</artifactId> | |
37 | - <version>3.11.0</version> | |
38 | - </dependency> | |
39 | - | |
40 | - <dependency> | |
41 | - <groupId>org.seleniumhq.selenium</groupId> | |
42 | - <artifactId>selenium-chrome-driver</artifactId> | |
43 | - <version>3.11.0</version> | |
44 | - </dependency> | |
45 | - | |
46 | - <dependency> | |
47 | - <groupId>org.seleniumhq.selenium</groupId> | |
48 | - <artifactId>selenium-safari-driver</artifactId> | |
49 | - <version>3.11.0</version> | |
50 | - </dependency> | |
51 | - | |
52 | - <dependency> | |
53 | - <groupId>org.seleniumhq.selenium</groupId> | |
54 | - <artifactId>selenium-ie-driver</artifactId> | |
55 | - <version>3.11.0</version> | |
56 | - </dependency> | |
57 | - | |
58 | - | |
59 | - <dependency> | |
60 | - <groupId>org.seleniumhq.selenium</groupId> | |
61 | - <artifactId>selenium-support</artifactId> | |
62 | - <version>2.46.0</version> | |
63 | - </dependency> | |
64 | - | |
65 | - <dependency> | |
66 | - <groupId>javax.mail</groupId> | |
67 | - <artifactId>mail</artifactId> | |
68 | - <version>1.4</version> | |
69 | - </dependency> | |
70 | - | |
71 | - <dependency> | |
72 | - <groupId>org.apache.commons</groupId> | |
73 | - <artifactId>commons-collections4</artifactId> | |
74 | - <version>4.1</version> | |
75 | - </dependency> | |
76 | - | |
77 | - <dependency> | |
78 | - <groupId>org.apache.poi</groupId> | |
79 | - <artifactId>poi</artifactId> | |
80 | - <version>3.14</version> | |
81 | - </dependency> | |
82 | - | |
83 | - <dependency> | |
84 | - <groupId>org.apache.poi</groupId> | |
85 | - <artifactId>poi-ooxml</artifactId> | |
86 | - <version>3.14</version> | |
87 | - </dependency> | |
88 | - | |
89 | - <dependency> | |
90 | - <groupId>org.apache.poi</groupId> | |
91 | - <artifactId>poi-ooxml-schemas</artifactId> | |
92 | - <version>3.14</version> | |
93 | - </dependency> | |
94 | - | |
95 | - <dependency> | |
96 | - <groupId>org.apache.commons</groupId> | |
97 | - <artifactId>commons-io</artifactId> | |
98 | - <version>1.3.2</version> | |
99 | - </dependency> | |
100 | - | |
101 | - <dependency> | |
102 | - <groupId>mysql</groupId> | |
103 | - <artifactId>mysql-connector-java</artifactId> | |
104 | - <version>6.0.6</version> | |
105 | - </dependency> | |
106 | - <dependency> | |
107 | - <groupId>org.dbunit</groupId> | |
108 | - <artifactId>dbunit</artifactId> | |
109 | - <version>2.5.4</version> | |
110 | - </dependency> | |
111 | - <dependency> | |
112 | - <groupId>jdom</groupId> | |
113 | - <artifactId>jdom</artifactId> | |
114 | - <version>1.0</version> | |
115 | - </dependency> | |
116 | - </dependencies> | |
117 | - | |
118 | - <build> | |
119 | - <plugins> | |
120 | - <plugin> | |
121 | - <groupId>org.apache.maven.plugins</groupId> | |
122 | - <artifactId>maven-surefire-plugin</artifactId> | |
123 | - <version>2.7.1</version> | |
124 | - <configuration> | |
125 | - <!--<testFailureIgnore>true</testFailureIgnore> --> | |
126 | - <suiteXmlFiles> | |
127 | - <suiteXmlFile>resources/suites/testng.xml</suiteXmlFile> | |
128 | - <!--此处testng.xml即为要运行的testng.xml文件 --> | |
129 | - </suiteXmlFiles> | |
130 | - </configuration> | |
131 | - </plugin> | |
132 | - </plugins> | |
133 | - </build> | |
134 | - | |
135 | -</project> | |
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 | + <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version> | |
18 | + <jdk.version>1.8</jdk.version> | |
19 | + </properties> | |
20 | + | |
21 | + <dependencies> | |
22 | + | |
23 | + <dependency> | |
24 | + <groupId>org.testng</groupId> | |
25 | + <artifactId>testng</artifactId> | |
26 | + <version>6.14.3</version> | |
27 | + <!-- <scope>test</scope> --> | |
28 | + </dependency> | |
29 | + | |
30 | + <dependency> | |
31 | + <groupId>org.seleniumhq.selenium</groupId> | |
32 | + <artifactId>selenium-java</artifactId> | |
33 | + <version>3.11.0</version> | |
34 | + </dependency> | |
35 | + | |
36 | + | |
37 | + <dependency> | |
38 | + <groupId>org.seleniumhq.selenium</groupId> | |
39 | + <artifactId>selenium-firefox-driver</artifactId> | |
40 | + <version>3.11.0</version> | |
41 | + </dependency> | |
42 | + | |
43 | + <dependency> | |
44 | + <groupId>org.seleniumhq.selenium</groupId> | |
45 | + <artifactId>selenium-chrome-driver</artifactId> | |
46 | + <version>3.11.0</version> | |
47 | + </dependency> | |
48 | + | |
49 | + <dependency> | |
50 | + <groupId>org.seleniumhq.selenium</groupId> | |
51 | + <artifactId>selenium-safari-driver</artifactId> | |
52 | + <version>3.11.0</version> | |
53 | + </dependency> | |
54 | + | |
55 | + <dependency> | |
56 | + <groupId>org.seleniumhq.selenium</groupId> | |
57 | + <artifactId>selenium-ie-driver</artifactId> | |
58 | + <version>3.11.0</version> | |
59 | + </dependency> | |
60 | + | |
61 | + | |
62 | + <dependency> | |
63 | + <groupId>org.seleniumhq.selenium</groupId> | |
64 | + <artifactId>selenium-support</artifactId> | |
65 | + <version>2.46.0</version> | |
66 | + </dependency> | |
67 | + | |
68 | + <dependency> | |
69 | + <groupId>javax.mail</groupId> | |
70 | + <artifactId>mail</artifactId> | |
71 | + <version>1.4</version> | |
72 | + </dependency> | |
73 | + | |
74 | + <dependency> | |
75 | + <groupId>org.apache.commons</groupId> | |
76 | + <artifactId>commons-collections4</artifactId> | |
77 | + <version>4.1</version> | |
78 | + </dependency> | |
79 | + | |
80 | + <dependency> | |
81 | + <groupId>org.apache.poi</groupId> | |
82 | + <artifactId>poi</artifactId> | |
83 | + <version>3.14</version> | |
84 | + </dependency> | |
85 | + | |
86 | + <dependency> | |
87 | + <groupId>org.apache.poi</groupId> | |
88 | + <artifactId>poi-ooxml</artifactId> | |
89 | + <version>3.14</version> | |
90 | + </dependency> | |
91 | + | |
92 | + <dependency> | |
93 | + <groupId>org.apache.poi</groupId> | |
94 | + <artifactId>poi-ooxml-schemas</artifactId> | |
95 | + <version>3.14</version> | |
96 | + </dependency> | |
97 | + | |
98 | + <dependency> | |
99 | + <groupId>org.apache.commons</groupId> | |
100 | + <artifactId>commons-io</artifactId> | |
101 | + <version>1.3.2</version> | |
102 | + </dependency> | |
103 | + | |
104 | + <dependency> | |
105 | + <groupId>mysql</groupId> | |
106 | + <artifactId>mysql-connector-java</artifactId> | |
107 | + <version>6.0.6</version> | |
108 | + </dependency> | |
109 | + <dependency> | |
110 | + <groupId>org.dbunit</groupId> | |
111 | + <artifactId>dbunit</artifactId> | |
112 | + <version>2.5.4</version> | |
113 | + </dependency> | |
114 | + <dependency> | |
115 | + <groupId>jdom</groupId> | |
116 | + <artifactId>jdom</artifactId> | |
117 | + <version>1.0</version> | |
118 | + </dependency> | |
119 | + </dependencies> | |
120 | + | |
121 | + <build> | |
122 | + <plugins> | |
123 | + <plugin> | |
124 | + <groupId>org.apache.maven.plugins</groupId> | |
125 | + <artifactId>maven-compiler-plugin</artifactId> | |
126 | + <version>${maven-compiler-plugin.version}</version> | |
127 | + <configuration> | |
128 | + <encoding>utf-8</encoding> | |
129 | + <source>${jdk.version}</source> | |
130 | + <target>${jdk.version}</target> | |
131 | + <meminitial>128m</meminitial> | |
132 | + <maxmem>512m</maxmem> | |
133 | + </configuration> | |
134 | + </plugin> | |
135 | + <plugin> | |
136 | + <groupId>org.apache.maven.plugins</groupId> | |
137 | + <artifactId>maven-surefire-plugin</artifactId> | |
138 | + <version>2.7.1</version> | |
139 | + <configuration> | |
140 | + <!--<testFailureIgnore>true</testFailureIgnore> --> | |
141 | + <suiteXmlFiles> | |
142 | + <suiteXmlFile>resources/suites/testng.xml</suiteXmlFile> | |
143 | + <!--此处testng.xml即为要运行的testng.xml文件 --> | |
144 | + </suiteXmlFiles> | |
145 | + </configuration> | |
146 | + </plugin> | |
147 | + </plugins> | |
148 | + </build> | |
149 | + | |
150 | +</project> | |
136 | 151 | \ No newline at end of file | ... | ... |
resources/config.properties deleted
... | ... | @@ -1,16 +0,0 @@ |
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 | - |
src/test/java/com/buyer/pageObject/AssetManagementPage.java renamed to src/main/java/com/buyer/pageObject/AssetManagementPage.java
1 | -package com.buyer.pageObject; | |
2 | - | |
3 | -import org.openqa.selenium.WebDriver; | |
4 | - | |
5 | -import com.essa.framework.BasePage; | |
6 | - | |
7 | -public class AssetManagementPage extends BasePage { | |
8 | - public AssetManagementPage(WebDriver driver) { | |
9 | - super(driver); | |
10 | - } | |
11 | -} | |
1 | +package com.buyer.pageObject; | |
2 | + | |
3 | +import org.openqa.selenium.WebDriver; | |
4 | + | |
5 | +import com.essa.framework.BasePage; | |
6 | + | |
7 | +public class AssetManagementPage extends BasePage { | |
8 | + public AssetManagementPage(WebDriver driver) { | |
9 | + super(driver); | |
10 | + } | |
11 | +} | ... | ... |
src/test/java/com/buyer/pageObject/BuyerLoginPage.java renamed to src/main/java/com/buyer/pageObject/BuyerLoginPage.java
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 | -} | |
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/test/java/com/buyer/pageObject/ConslidationPage.java renamed to src/main/java/com/buyer/pageObject/ConslidationPage.java
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 | -} | |
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()='FCL']") | |
33 | + WebElement FCL; | |
34 | + | |
35 | + //选择40HQ | |
36 | + @FindBy (xpath = "//*[text()='40HQ']/..") | |
37 | + WebElement hq40; | |
38 | + | |
39 | + //确认 | |
40 | + @FindBy (xpath="//button[text()='OK']") | |
41 | + WebElement ok; | |
42 | + | |
43 | + //查询输入框 | |
44 | + @FindBy (xpath="//*[@id='left-search']/div/input") | |
45 | + WebElement searchText; | |
46 | + | |
47 | + //查询按钮 | |
48 | + @FindBy (xpath="//*[@id='left-search']/div/span") | |
49 | + WebElement search; | |
50 | + | |
51 | + //左边列表第一个复选框 | |
52 | + @FindBy (xpath="//*[@id='left-product-list']/div[1]/div/div[2]/div/ul/li[1]/input") | |
53 | + WebElement leftFirstCheckbox; | |
54 | + | |
55 | + //中间加入右边的箭头 | |
56 | + @FindBy (xpath="//*[@id='icon-pi-right-big']") | |
57 | + WebElement add; | |
58 | + | |
59 | + //右边的第一个复选框 | |
60 | + @FindBy (xpath="//*[@id='right-product-list']/div/div/div[2]/div/ul/li[1]/input") | |
61 | + WebElement rightFirstCheckbox; | |
62 | + | |
63 | + //下一步,设置贴纸 | |
64 | + @FindBy (xpath="//*[@id='next']") | |
65 | + WebElement next; | |
66 | + | |
67 | + //确认弹框-可能会提示价格不一致 | |
68 | + @FindBy (xpath ="//a[text()='OK']") | |
69 | + WebElement ok2; | |
70 | + | |
71 | + /** | |
72 | + * 开始拼柜 | |
73 | + * @return SettingMarkerPage | |
74 | + */ | |
75 | + public SettingMarksPage conslidation() { | |
76 | + //是否有操作提示弹框 | |
77 | + if(isVisibility(By.xpath("//*[@class='close']"))) { | |
78 | + click(close); | |
79 | + } | |
80 | + forceWait(1000); | |
81 | + //是否有选择货柜 | |
82 | + if(isVisibility(By.xpath("//button[text()='Bulk cargo']"))) { | |
83 | +// click(bulkCargo); | |
84 | + click(FCL); | |
85 | + click(hq40); | |
86 | + click(ok); | |
87 | + forceWait(1000); | |
88 | + } | |
89 | + sendKeys(searchText, Model.getSkuNo()); | |
90 | + click(search); | |
91 | + click(leftFirstCheckbox); | |
92 | + click(add); | |
93 | + //是否有加入到暂存柜 | |
94 | + dynamicWait(By.xpath("//*[@id='right-product-list']/div/div/div[2]/div/ul/li[1]/input")); | |
95 | + forceWait(2000); | |
96 | + moveHeightScroll("100"); | |
97 | + forceWait(1000); | |
98 | + click(next); | |
99 | + //如果提示价格变化,确认弹框 | |
100 | + if(isVisibility(By.xpath("//a[text()='OK']"))) { | |
101 | + click(ok2); | |
102 | + forceWait(1000); | |
103 | + click(next); | |
104 | + } | |
105 | + return new SettingMarksPage(driver); | |
106 | + } | |
107 | +} | ... | ... |
src/test/java/com/buyer/pageObject/IndexPage.java renamed to src/main/java/com/buyer/pageObject/IndexPage.java
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 | -} | |
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 LEFT JOIN prd_goods g on c.id = g.category_id LEFT JOIN prd_goods_sku s on s.goods_id = g.id where find_in_set(5,REPLACE(c.path,'.',',')) AND s.`no` > 200120000\n" + | |
94 | + "AND s.id NOT IN (SELECT g.sku_id FROM sale_group_buy g) AND s.id NOT IN (SELECT t.sku_id FROM sale_shopping_cart t) AND s.src = 1 AND s.`status` = 2 AND s.is_stop_product = 0 AND s.is_delete = 0 \n" + | |
95 | + "AND g.is_category_error = 0 AND G.is_attribute_error = 0 AND G.is_option_error = 0 AND G.is_spec_error = 0 limit 1;"; | |
96 | + Model.setSkuNo(DBSqlSearch(sql, "no")); | |
97 | + }else if (Model.getIsactivity()==1 &&(("选填,勿填非活动商品").equals(Model.getSkuNo())||("").equals(Model.getSkuNo()))) { | |
98 | + //活动商品 | |
99 | + String sql = "SELECT s.id,s.`no` from prd_category c LEFT JOIN prd_goods g on c.id = g.category_id LEFT JOIN prd_goods_sku s on s.goods_id = g.id LEFT JOIN sale_group_buy a on a.sku_id = s.id \n" + | |
100 | + "where s.`no` > 200000000 AND s.id NOT IN (SELECT t.sku_id FROM sale_shopping_cart t) AND a.`status` = 20 and s.src = 1 AND g.is_category_error = 0 AND G.is_attribute_error = 0 AND G.is_option_error = 0 AND G.is_spec_error = 0 limit 1;"; | |
101 | + Model.setSkuNo(DBSqlSearch(sql, "no")); | |
102 | + } | |
103 | +// System.out.println(Model.getSkuNo()); | |
104 | + sendKeys(searchText, Model.getSkuNo()); | |
105 | + click(searchButton); | |
106 | + return new KeywordResultPage(driver); | |
107 | + } | |
108 | + | |
109 | + /** | |
110 | + * 断言是否注册成功,根据是否有绑定手机号的弹窗来判断 | |
111 | + * @return boolean | |
112 | + */ | |
113 | + public boolean isSucceed() { | |
114 | + return isVisibility(By.xpath("//*[contains(@class,'layui-layer-close1')]")); | |
115 | + } | |
116 | +} | ... | ... |
src/test/java/com/buyer/pageObject/KeywordResultPage.java renamed to src/main/java/com/buyer/pageObject/KeywordResultPage.java
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 | -} | |
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/test/java/com/buyer/pageObject/MyOrderPage.java renamed to src/main/java/com/buyer/pageObject/MyOrderPage.java
1 | -package com.buyer.pageObject; | |
2 | - | |
3 | -import org.openqa.selenium.WebDriver; | |
4 | - | |
5 | -import com.essa.framework.BasePage; | |
6 | - | |
7 | -public class MyOrderPage extends BasePage { | |
8 | - public MyOrderPage(WebDriver driver) { | |
9 | - super(driver); | |
10 | - } | |
11 | -} | |
1 | +package com.buyer.pageObject; | |
2 | + | |
3 | +import org.openqa.selenium.WebDriver; | |
4 | + | |
5 | +import com.essa.framework.BasePage; | |
6 | + | |
7 | +public class MyOrderPage extends BasePage { | |
8 | + public MyOrderPage(WebDriver driver) { | |
9 | + super(driver); | |
10 | + } | |
11 | +} | ... | ... |
src/test/java/com/buyer/pageObject/OrderPreviewPage.java renamed to src/main/java/com/buyer/pageObject/OrderPreviewPage.java
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 | -} | |
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/test/java/com/buyer/pageObject/PayDepositPage.java renamed to src/main/java/com/buyer/pageObject/PayDepositPage.java
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 | -} | |
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 ="//button[@class='btn btn-primary queding']") | |
30 | + WebElement ok; | |
31 | + | |
32 | + //其他支付模式 | |
33 | + @FindBy (xpath = "//button[@class='btn btn-primary btn-sm loading']") | |
34 | + WebElement confirm; | |
35 | + | |
36 | + //po单号 | |
37 | + @FindBy (xpath ="//*[contains(text(),'PO number:')]/../../td[2]/span") | |
38 | + WebElement poNum; | |
39 | + | |
40 | + //免定金的确认 | |
41 | + @FindBy (xpath = "//*[@ng-click='submit()']") | |
42 | + WebElement submit; | |
43 | + | |
44 | + /** | |
45 | + * 查看资金详情 | |
46 | + * @return AssetManagementPage | |
47 | + */ | |
48 | + public AssetManagementPage toAssetManagementPage() { | |
49 | + | |
50 | + click(FundDetail); | |
51 | + return new AssetManagementPage(driver); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 确认PO:单柜比例 | |
56 | + * @return MyOrderPage | |
57 | + */ | |
58 | + public MyOrderPage confirm() { | |
59 | + click(ok); | |
60 | + if(isVisibility(By.xpath("//button[@class='btn btn-primary btn-sm loading']"))){ | |
61 | + click(confirm); | |
62 | + } | |
63 | + return new MyOrderPage(driver); | |
64 | + } | |
65 | + | |
66 | + | |
67 | + /** | |
68 | + *确认PO操作方法 | |
69 | + * @param | |
70 | + * @return | |
71 | + */ | |
72 | + public void operate() { | |
73 | + dynamicWait(By.xpath("//*[contains(text(),'PO information')]")); | |
74 | + Model.setPoNum(poNum.getText()); | |
75 | + | |
76 | + if (isVisibility(By.xpath("//button[@class='submit-payment-deposit-button btn btn-primary']"))) { | |
77 | + //如果是可用资金不足,跳转到资金管理 | |
78 | + toAssetManagementPage(); | |
79 | + }else if (isVisibility(By.xpath("//*[@ng-click='submit()']"))) { | |
80 | + //免定金模式,确认po,跳转到我的订单列表 | |
81 | + click(submit); | |
82 | + }else { | |
83 | + //单柜比例定金 | |
84 | + confirm(); | |
85 | + } | |
86 | + forceWait(2000); | |
87 | + } | |
88 | +} | ... | ... |
src/test/java/com/buyer/pageObject/RegisterPage.java renamed to src/main/java/com/buyer/pageObject/RegisterPage.java
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 | -} | |
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/test/java/com/buyer/pageObject/SettingMarksPage.java renamed to src/main/java/com/buyer/pageObject/SettingMarksPage.java
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 | -} | |
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 = "//ul[@class='list']/li[2]") | |
25 | + WebElement firstMarks; | |
26 | + | |
27 | + //下一步 | |
28 | + @FindBy (xpath ="//*[text()='Next step']") | |
29 | + WebElement next; | |
30 | + | |
31 | + //弹框提示-确定 | |
32 | + @FindBy (xpath ="//*[text()='OK']") | |
33 | + WebElement ok; | |
34 | + | |
35 | + /** | |
36 | + * 设置唛头:不应用唛头 | |
37 | + * @return SettingStickerPage | |
38 | + */ | |
39 | + public SettingStickerPage setMarks() { | |
40 | + /*while(!(isVisibility(By.xpath("//*[@title='No shipping marks for these products']")))) { | |
41 | + forceWait(1000); | |
42 | + }*/ | |
43 | + dynamicWait(By.xpath("//*[@title='No shipping marks for these products']")); | |
44 | + if(isVisibility(By.xpath("//ul[@class='list']/li[2]"))){ | |
45 | + click(firstMarks); | |
46 | + } | |
47 | + click(noNeedMarks); | |
48 | + click(next); | |
49 | + forceWait(500); | |
50 | + click(ok); | |
51 | + return new SettingStickerPage(driver); | |
52 | + } | |
53 | +} | ... | ... |
src/test/java/com/buyer/pageObject/SettingStickerPage.java renamed to src/main/java/com/buyer/pageObject/SettingStickerPage.java
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 | -} | |
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 = "//ul[@class='list']/li[2]") | |
24 | + WebElement firstSticker; | |
25 | + | |
26 | + //下一步 | |
27 | + @FindBy (xpath ="//*[text()='Next step']") | |
28 | + WebElement next; | |
29 | + | |
30 | + //弹框提示-确定 | |
31 | + @FindBy (xpath ="//*[text()='OK']") | |
32 | + WebElement ok; | |
33 | + | |
34 | + /** | |
35 | + * 设置贴纸:不应用贴纸 | |
36 | + * @return OrderPreviewPage | |
37 | + */ | |
38 | + public OrderPreviewPage setSticker() { | |
39 | + dynamicWait(By.xpath("//*[@title='No stickers for these products']")); | |
40 | + if (isVisibility(By.xpath("//ul[@class='list']/li[2]"))){ | |
41 | + click(firstSticker); | |
42 | + } | |
43 | + click(noNeedSticker); | |
44 | + click(next); | |
45 | + click(ok); | |
46 | + return new OrderPreviewPage(driver); | |
47 | + } | |
48 | +} | ... | ... |
src/test/java/com/buyer/pageObject/ShoppingCartPage.java renamed to src/main/java/com/buyer/pageObject/ShoppingCartPage.java
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 | -} | |
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/test/java/com/buyer/testSuite/TestAddToCart.java renamed to src/main/java/com/buyer/testSuite/TestAddToCart.java
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 | -} | |
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 | + } | |
28 | + @AfterClass | |
29 | + public void tearDown() { | |
30 | + driver.quit(); | |
31 | + } | |
32 | + | |
33 | + /** | |
34 | + * 关键字查询,并将搜到的结果加入购物车 | |
35 | + */ | |
36 | + @Test(description="关键字搜索,并将sku加入购物车",groups= {"first"}) | |
37 | + public void keywordToCart() { | |
38 | + this.driver = getDriver(); | |
39 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | |
40 | + indexPage.keywordSearch(); | |
41 | + KeywordResultPage keywordResultPage = PageFactory.initElements(driver, KeywordResultPage.class); | |
42 | + keywordResultPage.addToCart(); | |
43 | + //断言 | |
44 | + ShoppingCartPage shoppingCartPage = PageFactory.initElements(driver, ShoppingCartPage.class); | |
45 | + boolean actual = shoppingCartPage.isSucceed(); | |
46 | + SoftAssert softAssert = new SoftAssert(); | |
47 | + softAssert.assertEquals(actual, true, "加入购物车失败!"); | |
48 | + softAssert.assertAll(); | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * 关键字查询,加入购物车,但不进入购物车,防止提示有人正在操作 | |
53 | + */ | |
54 | + @Test(description="将sku加入购物车") | |
55 | + public void addSku() { | |
56 | + this.driver = getDriver(); | |
57 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | |
58 | + indexPage.keywordSearch(); | |
59 | + KeywordResultPage keywordResultPage = PageFactory.initElements(driver, KeywordResultPage.class); | |
60 | + keywordResultPage.addSku(); | |
61 | + } | |
62 | +} | ... | ... |
src/main/java/com/buyer/testSuite/TestConfirmBuy.java
0 → 100644
... | ... | @@ -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/test/java/com/buyer/testSuite/TestRegister.java renamed to src/main/java/com/buyer/testSuite/TestRegister.java
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 | -} | |
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 | +} | ... | ... |
src/test/java/com/buyer/testSuite/TestSendPO.java renamed to src/main/java/com/buyer/testSuite/TestSendPO.java
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 | -} | |
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 | +} | ... | ... |
src/test/java/com/essa/framework/BasePage.java renamed to src/main/java/com/essa/framework/BasePage.java
... | ... | @@ -74,7 +74,6 @@ public class BasePage { |
74 | 74 | } catch (Exception e) { |
75 | 75 | Logger.Output(LogType.LogTypeName.ERROR, element.toString()+"元素不存在"); |
76 | 76 | } |
77 | - | |
78 | 77 | } |
79 | 78 | |
80 | 79 | /** |
... | ... | @@ -267,7 +266,7 @@ public class BasePage { |
267 | 266 | |
268 | 267 | /** |
269 | 268 | * 元素在页面上是否可见 |
270 | - * @param element | |
269 | + * @param | |
271 | 270 | * @return |
272 | 271 | */ |
273 | 272 | protected boolean isVisibility(By by) { |
... | ... | @@ -435,7 +434,7 @@ public class BasePage { |
435 | 434 | Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null); |
436 | 435 | // 新建一个Robot类的对象 |
437 | 436 | Robot robot = new Robot(); |
438 | - Thread.sleep(1000); | |
437 | + Thread.sleep(2000); | |
439 | 438 | |
440 | 439 | // 按下回车 |
441 | 440 | robot.keyPress(KeyEvent.VK_ENTER); |
... | ... | @@ -483,7 +482,24 @@ public class BasePage { |
483 | 482 | Logger.Output(LogType.LogTypeName.INFO, "返回切片后的字符串"); |
484 | 483 | return search_need; |
485 | 484 | } |
486 | - | |
485 | + | |
486 | + /** | |
487 | + * 字符串切片 | |
488 | + * @param element 需要被操作的元素 | |
489 | + * @param begin 从这个字符开始切 | |
490 | + * @param end 到这个字符结尾 | |
491 | + * @return | |
492 | + */ | |
493 | + protected String partiaStr(WebElement element,int begin,int end){ | |
494 | + String Str = element.getText(); | |
495 | + System.out.print("获取所需切片的字符串:"); | |
496 | + // 对字符串切片,保留begin之后,end之前的字符串 | |
497 | + System.out.println(Str.subSequence(begin,end)); | |
498 | + // 把切片值作为结果并返回 | |
499 | + String search_need = (String) Str.subSequence(begin,end); | |
500 | + return search_need; | |
501 | + } | |
502 | + | |
487 | 503 | /** |
488 | 504 | * 复写切片,仅在本页面作为截断日志文本后面带的一堆字符串 |
489 | 505 | * @param string |
... | ... | @@ -494,7 +510,7 @@ public class BasePage { |
494 | 510 | String st1 = string.split(begin)[1]; |
495 | 511 | return st1; |
496 | 512 | } |
497 | - | |
513 | + | |
498 | 514 | /**要的元素是否存在,最多5秒 |
499 | 515 | * @param element |
500 | 516 | */ |
... | ... | @@ -504,6 +520,16 @@ public class BasePage { |
504 | 520 | // Logger.Output(LogType.LogTypeName.INFO, "等待元素在页面上加载可见,最多5秒"); |
505 | 521 | wait.until(ExpectedConditions.visibilityOf(element)); |
506 | 522 | } |
523 | + | |
524 | + /**要的元素是否存在,传递元素表达式,最多5秒 | |
525 | + * @param | |
526 | + */ | |
527 | + protected void mywait(By by) { | |
528 | + | |
529 | + WebDriverWait wait = new WebDriverWait(driver, 7); | |
530 | +// Logger.Output(LogType.LogTypeName.INFO, "等待元素在页面上加载可见,最多5秒"); | |
531 | + wait.until(ExpectedConditions.visibilityOf(driver.findElement(by))); | |
532 | + } | |
507 | 533 | |
508 | 534 | /** |
509 | 535 | * 设立检查点,判断页面是否是我们要的 |
... | ... | @@ -649,21 +675,43 @@ public class BasePage { |
649 | 675 | * @param by |
650 | 676 | */ |
651 | 677 | protected void dynamicWait(By by) { |
652 | - for(int count=0;count<7&&!(isVisibility(by));count++) { | |
653 | - forceWait(1000); | |
678 | + for(int count=0;count<14&&!(isVisibility(by));count++) { | |
679 | + try { | |
680 | + Thread.sleep(500); | |
681 | + } catch (Exception e) { | |
682 | + Logger.Output(LogType.LogTypeName.ERROR, "强行等待失败"); | |
683 | + } | |
654 | 684 | } |
655 | 685 | } |
686 | +// /** | |
687 | +// * bpms动态等待,指的是我们后台系统那个加载的圈圈 | |
688 | +// */ | |
689 | +// protected void dynamicWait() { | |
690 | +// dynamicWait(By.xpath("//*[@name='tailDeliveryDay']")); | |
691 | +// } | |
656 | 692 | |
657 | 693 | /** |
658 | 694 | * 与上面的方法相反,如果元素存在,等待直到元素不存在,最长7秒 |
659 | 695 | * @param by |
660 | 696 | */ |
661 | 697 | protected void dynamicLoad(By by) { |
662 | - for(int count=0;count<7&&isVisibility(by);count++) { | |
663 | - forceWait(1000); | |
698 | + for(int count=0;count<14&&isVisibility(by);count++) { | |
699 | + try { | |
700 | + Thread.sleep(500); | |
701 | + } catch (Exception e) { | |
702 | + Logger.Output(LogType.LogTypeName.ERROR, "强行等待失败"); | |
703 | + } | |
664 | 704 | } |
665 | 705 | } |
666 | 706 | /** |
707 | + * 我们bpms的加载等待的那个圈圈,这个加载圈消失意味着加载完成 | |
708 | + * @param | |
709 | + * @return | |
710 | + */ | |
711 | + protected void dynamicLoad(){ | |
712 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
713 | + } | |
714 | + /** | |
667 | 715 | * 连接数据库查询数据 |
668 | 716 | * @param sql 查询sql |
669 | 717 | * @param field 需要的字段,这个方法只支持一个字段查询 |
... | ... | @@ -683,6 +731,27 @@ public class BasePage { |
683 | 731 | } |
684 | 732 | return null; |
685 | 733 | } |
734 | + | |
735 | + /** | |
736 | + *粘贴方法 | |
737 | + * @param content 要粘贴的文本 | |
738 | + * @return | |
739 | + */ | |
740 | + protected void paste(String content){ | |
741 | + StringSelection stringSelection = new StringSelection(content); | |
742 | + Toolkit.getDefaultToolkit().getSystemClipboard() | |
743 | + .setContents(stringSelection, null); | |
744 | + Robot robot = null; | |
745 | + try { | |
746 | + robot = new Robot(); | |
747 | + } catch (Exception e1) { | |
748 | + e1.printStackTrace(); | |
749 | + } | |
750 | + robot.keyPress(KeyEvent.VK_CONTROL); | |
751 | + robot.keyPress(KeyEvent.VK_V); | |
752 | + robot.keyRelease(KeyEvent.VK_V); | |
753 | + robot.keyRelease(KeyEvent.VK_CONTROL); | |
754 | + } | |
686 | 755 | |
687 | 756 | /** |
688 | 757 | * 获取当前系统时间,得到格式化时间字符串 |
... | ... | @@ -696,5 +765,5 @@ public class BasePage { |
696 | 765 | |
697 | 766 | return df.format(date); |
698 | 767 | |
699 | - } | |
768 | + } | |
700 | 769 | } |
701 | 770 | \ No newline at end of file | ... | ... |
src/test/java/com/essa/framework/BrowserEngine.java renamed to src/main/java/com/essa/framework/BrowserEngine.java
1 | 1 | package com.essa.framework; |
2 | 2 | |
3 | -import java.io.FileInputStream; | |
4 | -import java.io.IOException; | |
5 | -import java.io.InputStream; | |
6 | -import java.util.Properties; | |
7 | -import java.util.concurrent.TimeUnit; | |
8 | - | |
9 | 3 | import org.openqa.selenium.WebDriver; |
10 | 4 | import org.openqa.selenium.chrome.ChromeDriver; |
11 | 5 | import org.openqa.selenium.firefox.FirefoxDriver; |
... | ... | @@ -13,38 +7,22 @@ import org.openqa.selenium.ie.InternetExplorerDriver; |
13 | 7 | import org.openqa.selenium.remote.CapabilityType; |
14 | 8 | import org.openqa.selenium.remote.DesiredCapabilities; |
15 | 9 | |
10 | +import java.util.concurrent.TimeUnit; | |
11 | + | |
16 | 12 | public class BrowserEngine { |
17 | 13 | |
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 | - InputStream ips = new FileInputStream(".\\resources\\config.properties"); | |
28 | - p.load(ips); | |
29 | - Logger.Output(LogType.LogTypeName.INFO, "开始从配置文件中选择浏览器"); | |
30 | - browserName=p.getProperty("browserName");//使用jframe要注释 | |
31 | - Logger.Output(LogType.LogTypeName.INFO, "所选择的浏览器类型为: "+ browserName); | |
32 | - if (env1=="DIT") { | |
33 | - serverURL = p.getProperty("DIT"); | |
34 | - buyerURL = p.getProperty("BDIT"); | |
35 | - }else if (env1 =="HOTFIX") { | |
36 | - serverURL = p.getProperty("HOTFIX"); | |
37 | - buyerURL = p.getProperty("BHOTFIX"); | |
38 | - }else if (env1 == "UAT") { | |
39 | - serverURL = p.getProperty("UAT"); | |
40 | - buyerURL = p.getProperty("BUAT"); | |
41 | - }else { | |
42 | - serverURL = p.getProperty("SIT"); | |
43 | - buyerURL = p.getProperty("BSIT"); | |
44 | - } | |
45 | - Logger.Output(LogType.LogTypeName.INFO, "所测试的环境为:"+ env1); | |
46 | - Model.setEnv(env1);//我也不知道为什么执行完上面的代码后,env会变为sit | |
47 | - ips.close(); | |
14 | + private static BrowserEnum browserEnum; | |
15 | + private WebDriver driver; | |
16 | + private static EnvEnum env1; | |
17 | + | |
18 | + private ConfigProperties configProperties; | |
19 | + | |
20 | + public void initConfigData() { | |
21 | + //有些地方是没有设置初始化环境直接调用这个方法的,所以默认是sit | |
22 | + env1 = null == env1 ? EnvEnum.SIT : env1; | |
23 | + configProperties = ConfigProperties.getConfig(env1); | |
24 | + browserEnum = BrowserEnum.fromCode(configProperties.getBrowserName()); | |
25 | + Model.setEnv(env1.getCode());//我也不知道为什么执行完上面的代码后,env会变为sit | |
48 | 26 | } |
49 | 27 | /** |
50 | 28 | * bpms环境初始化 |
... | ... | @@ -52,35 +30,37 @@ public class BrowserEngine { |
52 | 30 | * @param browser |
53 | 31 | */ |
54 | 32 | public static void setInit(String environment,String browser) { |
55 | - browserName = browser; | |
56 | - env1 = environment; | |
33 | + browserEnum = BrowserEnum.fromCode(browser); | |
34 | + env1 = EnvEnum.fromCode(environment); | |
57 | 35 | } |
58 | 36 | |
59 | 37 | /** |
60 | 38 | * bpms获取地址方法 |
61 | 39 | * @return |
62 | 40 | */ |
63 | - public WebDriver getBrowser(){ | |
64 | - | |
65 | - if(browserName.equalsIgnoreCase("Firefox")){ | |
66 | - System.setProperty("webdriver.gecko.driver", ".\\resources\\geckodriver.exe"); | |
67 | - driver = new FirefoxDriver(); | |
68 | - Logger.Output(LogType.LogTypeName.INFO, "正在启动FireFox浏览器"); | |
69 | - } | |
70 | - else if(browserName.equals("Chrome")){ | |
71 | - System.setProperty("webdriver.chrome.driver", ".\\resources\\chromedriver.exe"); //图形界面 | |
72 | - driver= new ChromeDriver(); | |
73 | - Logger.Output(LogType.LogTypeName.INFO, "正在启动Chrome浏览器"); | |
74 | - }else if(browserName.equalsIgnoreCase("IE")){ | |
75 | - System.setProperty("webdriver.ie.driver", ".\\src\\main\resources\\IEDriverServer.exe"); | |
76 | - driver= new InternetExplorerDriver(); | |
77 | - Logger.Output(LogType.LogTypeName.INFO, "正在启动IE浏览器"); | |
41 | + private WebDriver getBrowser(BrowserEnum browser,String url,int waitTime){ | |
42 | + System.setProperty(browser.getExeName(), SystemConstant.RESOURCE_PATH + browser.getDriver()); | |
43 | + //根据浏览器类型,初始化对应的驱动 | |
44 | + switch(browser) { | |
45 | + case Firefox:{ | |
46 | + driver = new FirefoxDriver(); | |
47 | + break; | |
48 | + } | |
49 | + case Chrome: { | |
50 | + driver = new ChromeDriver(); | |
51 | + break; | |
52 | + } | |
53 | + case IE: { | |
54 | + driver = new InternetExplorerDriver(); | |
55 | + } | |
78 | 56 | } |
79 | - driver.manage().window().maximize(); | |
57 | + | |
58 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动" + browser.getCode() +"浏览器"); | |
59 | + driver.manage().window().maximize(); | |
80 | 60 | Logger.Output(LogType.LogTypeName.INFO, "窗口最大化"); |
81 | - driver.get(serverURL); | |
82 | - Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ serverURL); | |
83 | - callWait(5); | |
61 | + driver.get(url); | |
62 | + Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ url); | |
63 | + callWait(waitTime); | |
84 | 64 | return driver; |
85 | 65 | } |
86 | 66 | |
... | ... | @@ -89,7 +69,7 @@ public class BrowserEngine { |
89 | 69 | * @return |
90 | 70 | */ |
91 | 71 | public WebDriver buyerGetBrowser() { |
92 | - if (browserName.equals("Chrome")) { | |
72 | + /*if (browserName.equals("Chrome")) { | |
93 | 73 | System.setProperty("webdriver.chrome.driver", ".\\resources\\chromedriver.exe"); //图形界面 |
94 | 74 | driver= new ChromeDriver(); |
95 | 75 | Logger.Output(LogType.LogTypeName.INFO, "正在启动Chrome浏览器"); |
... | ... | @@ -102,8 +82,33 @@ public class BrowserEngine { |
102 | 82 | Logger.Output(LogType.LogTypeName.INFO, "窗口最大化"); |
103 | 83 | driver.get(buyerURL); |
104 | 84 | Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ buyerURL); |
105 | - callWait(5); | |
106 | - return driver; | |
85 | + callWait(5); */ | |
86 | + return getBrowser(browserEnum,configProperties.getBuyerURL(),5); | |
87 | +// return driver; | |
88 | + } | |
89 | + | |
90 | + public WebDriver getBrowser() { | |
91 | + /*if(browserName.equalsIgnoreCase("Firefox")){ | |
92 | + System.setProperty("webdriver.gecko.driver", ".\\resources\\geckodriver.exe"); | |
93 | + driver = new FirefoxDriver(); | |
94 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动FireFox浏览器"); | |
95 | + } | |
96 | + else if(browserName.equals("Chrome")){ | |
97 | + System.setProperty("webdriver.chrome.driver", ".\\src\\main\\resources\\chromedriver.exe"); //图形界面 | |
98 | + driver= new ChromeDriver(); | |
99 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动Chrome浏览器"); | |
100 | + }else if(browserName.equalsIgnoreCase("IE")){ | |
101 | + System.setProperty("webdriver.ie.driver", ".\\src\\main\resources\\IEDriverServer.exe"); | |
102 | + driver= new InternetExplorerDriver(); | |
103 | + Logger.Output(LogType.LogTypeName.INFO, "正在启动IE浏览器"); | |
104 | + } | |
105 | + driver.manage().window().maximize(); | |
106 | + Logger.Output(LogType.LogTypeName.INFO, "窗口最大化"); | |
107 | + driver.get(serverURL); | |
108 | + Logger.Output(LogType.LogTypeName.INFO, "打开URL: "+ serverURL); | |
109 | + callWait(5);*/ | |
110 | + return getBrowser(browserEnum,configProperties.getServerURL(),5); | |
111 | +// return driver; | |
107 | 112 | } |
108 | 113 | |
109 | 114 | ... | ... |
... | ... | @@ -0,0 +1,109 @@ |
1 | +package com.essa.framework; | |
2 | +/** | |
3 | + * Created by weicheng on 2018/10/25. | |
4 | + */ | |
5 | + | |
6 | +import java.util.List; | |
7 | +import java.util.concurrent.ConcurrentHashMap; | |
8 | +import java.util.concurrent.atomic.AtomicReference; | |
9 | + | |
10 | +public enum BrowserEnum { | |
11 | + Firefox("Firefox","webdriver.gecko.driver","geckodriver.exe"), | |
12 | + Chrome("Chrome","webdriver.chrome.driver","chromedriver.exe"), | |
13 | + IE("IE","webdriver.ie.driver","IEDriverServer.exe"); | |
14 | + | |
15 | + /** | |
16 | + * 原子引用(全部) | |
17 | + */ | |
18 | + private static AtomicReference<ConcurrentHashMap<String, BrowserEnum>> mapAllRef = new AtomicReference<>(); | |
19 | + | |
20 | + private static AtomicReference<ConcurrentHashMap<String, BrowserEnum>> mapPartRef = new AtomicReference<>(); | |
21 | + | |
22 | + /** | |
23 | + * 根据code获取 BrowserEnum | |
24 | + * | |
25 | + * @param code | |
26 | + * @return | |
27 | + */ | |
28 | + public static BrowserEnum fromCode(String code) { | |
29 | + buildConcurrentHashMap(); | |
30 | + return mapAllRef.get().get(code); | |
31 | + } | |
32 | + | |
33 | + /** | |
34 | + * 如果map是空,就会构建Map | |
35 | + */ | |
36 | + private static void buildConcurrentHashMap() { | |
37 | + //如果所有枚举的原子引用是空对象,就创建一个ConcurrentHashMap给原子引用 | |
38 | + mapAllRef.compareAndSet(null, new ConcurrentHashMap<>()); | |
39 | + //获取原子引用的currentHashMap对象 | |
40 | + ConcurrentHashMap<String, BrowserEnum> concurrentHashAllMap = mapAllRef.get(); | |
41 | + //如果ConcurrentHashMap里面没有一个枚举对象,需要初次化 | |
42 | + if (concurrentHashAllMap.isEmpty()) { | |
43 | + for (BrowserEnum e : BrowserEnum.values()) { | |
44 | + concurrentHashAllMap.put(e.getCode(), e); | |
45 | + } | |
46 | + mapAllRef.set(concurrentHashAllMap); | |
47 | + } | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * 枚举代码 | |
52 | + */ | |
53 | + private String code; | |
54 | + | |
55 | + /** | |
56 | + * 浏览器驱动名字 | |
57 | + */ | |
58 | + private String driver; | |
59 | + | |
60 | + /** | |
61 | + * exe 名字 | |
62 | + */ | |
63 | + private String exeName; | |
64 | + | |
65 | + public String getCode() { | |
66 | + return code; | |
67 | + } | |
68 | + | |
69 | + public void setCode(String code) { | |
70 | + this.code = code; | |
71 | + } | |
72 | + | |
73 | + public String getDriver() { | |
74 | + return driver; | |
75 | + } | |
76 | + | |
77 | + public void setDriver(String driver) { | |
78 | + this.driver = driver; | |
79 | + } | |
80 | + | |
81 | + public String getExeName() { | |
82 | + return exeName; | |
83 | + } | |
84 | + | |
85 | + public void setExeName(String exeName) { | |
86 | + this.exeName = exeName; | |
87 | + } | |
88 | + | |
89 | + BrowserEnum(String code,String exeName, String driver) { | |
90 | + this.code = code; | |
91 | + this.driver = driver; | |
92 | + this.exeName = exeName; | |
93 | + } | |
94 | + | |
95 | + public static List<BrowserEnum> getAllEnum() { | |
96 | + buildConcurrentHashMap(); | |
97 | + return (List<BrowserEnum>) mapAllRef.get().values(); | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * 只返回常用枚举 | |
102 | + * | |
103 | + * @return | |
104 | + */ | |
105 | + public static List<BrowserEnum> getEnumByDefault() { | |
106 | + buildConcurrentHashMap(); | |
107 | + return (List<BrowserEnum>) mapPartRef.get().values(); | |
108 | + } | |
109 | +} | ... | ... |
src/main/java/com/essa/framework/ConfigProperties.java
0 → 100644
... | ... | @@ -0,0 +1,119 @@ |
1 | +package com.essa.framework; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.io.InputStream; | |
5 | +import java.util.HashMap; | |
6 | +import java.util.Map; | |
7 | +import java.util.Properties; | |
8 | + | |
9 | +/** | |
10 | + * Created by weicheng on 2018/10/25. | |
11 | + */ | |
12 | +public class ConfigProperties { | |
13 | + | |
14 | + //浏览器名称 | |
15 | + private String browserName; | |
16 | + //bpms首页url | |
17 | + private String serverURL; | |
18 | + //buyer首页url | |
19 | + private String buyerURL; | |
20 | + | |
21 | + // 数据库驱动名字 | |
22 | + private String jdbcName = null; | |
23 | + // 数据库协议地址 | |
24 | + private String dbUrl = null; | |
25 | + // 数据库用户名 | |
26 | + private String dbUser = null; | |
27 | + // 数据库密码 | |
28 | + private String dbPassword = null; | |
29 | + | |
30 | + private ConfigProperties() { | |
31 | + | |
32 | + } | |
33 | + | |
34 | + private static Map<String,ConfigProperties> configPropertiesMap = new HashMap<String,ConfigProperties>(); | |
35 | + | |
36 | + static { | |
37 | + //读取各个环境的配置项 | |
38 | + EnvEnum[] env = EnvEnum.values(); | |
39 | + for (EnvEnum envEnum : env) { | |
40 | + try { | |
41 | + ConfigProperties configProperties = new ConfigProperties(); | |
42 | + Properties p = new Properties(); | |
43 | + InputStream ips = ClassLoader.getSystemResourceAsStream("conf/config_" + envEnum.getCode() +".properties"); | |
44 | + p.load(ips); | |
45 | + configProperties.setBrowserName(p.getProperty("browserName"));//使用jframe要注释 | |
46 | + configProperties.setBuyerURL(p.getProperty("buyerURL")); | |
47 | + configProperties.setServerURL(p.getProperty("serverURL")); | |
48 | + configProperties.setJdbcName(p.getProperty("jdbc.driver")); | |
49 | + configProperties.setDbUrl(p.getProperty("jdbc.url")); | |
50 | + configProperties.setDbUser(p.getProperty("jdbc.user")); | |
51 | + configProperties.setDbPassword(p.getProperty("jdbc.pwd")); | |
52 | + configPropertiesMap.put(envEnum.getCode(),configProperties); | |
53 | + ips.close(); | |
54 | + } catch (IOException e) { | |
55 | + e.printStackTrace(); | |
56 | + } | |
57 | + } | |
58 | + } | |
59 | + | |
60 | + public static ConfigProperties getConfig(EnvEnum envEnum) { | |
61 | + return configPropertiesMap.get(envEnum.getCode()); | |
62 | + } | |
63 | + | |
64 | + public String getBrowserName() { | |
65 | + return browserName; | |
66 | + } | |
67 | + | |
68 | + public void setBrowserName(String browserName) { | |
69 | + this.browserName = browserName; | |
70 | + } | |
71 | + | |
72 | + public String getServerURL() { | |
73 | + return serverURL; | |
74 | + } | |
75 | + | |
76 | + public void setServerURL(String serverURL) { | |
77 | + this.serverURL = serverURL; | |
78 | + } | |
79 | + | |
80 | + public String getBuyerURL() { | |
81 | + return buyerURL; | |
82 | + } | |
83 | + | |
84 | + public void setBuyerURL(String buyerURL) { | |
85 | + this.buyerURL = buyerURL; | |
86 | + } | |
87 | + | |
88 | + public String getJdbcName() { | |
89 | + return jdbcName; | |
90 | + } | |
91 | + | |
92 | + public void setJdbcName(String jdbcName) { | |
93 | + this.jdbcName = jdbcName; | |
94 | + } | |
95 | + | |
96 | + public String getDbUrl() { | |
97 | + return dbUrl; | |
98 | + } | |
99 | + | |
100 | + public void setDbUrl(String dbUrl) { | |
101 | + this.dbUrl = dbUrl; | |
102 | + } | |
103 | + | |
104 | + public String getDbUser() { | |
105 | + return dbUser; | |
106 | + } | |
107 | + | |
108 | + public void setDbUser(String dbUser) { | |
109 | + this.dbUser = dbUser; | |
110 | + } | |
111 | + | |
112 | + public String getDbPassword() { | |
113 | + return dbPassword; | |
114 | + } | |
115 | + | |
116 | + public void setDbPassword(String dbPassword) { | |
117 | + this.dbPassword = dbPassword; | |
118 | + } | |
119 | +} | ... | ... |
src/test/java/com/essa/framework/DBInfo.java renamed to src/main/java/com/essa/framework/DBInfo.java
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 | -} | |
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 | +} | ... | ... |
src/test/java/com/essa/framework/DButil.java renamed to src/main/java/com/essa/framework/DButil.java
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 | -} | |
1 | +package com.essa.framework; | |
2 | + | |
3 | +import com.mysql.cj.api.jdbc.Statement; | |
4 | +import com.mysql.cj.jdbc.CallableStatement; | |
5 | +import com.mysql.cj.jdbc.PreparedStatement; | |
6 | + | |
7 | +import java.sql.Connection; | |
8 | +import java.sql.DriverManager; | |
9 | +import java.sql.ResultSet; | |
10 | +import java.sql.SQLException; | |
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 | + | |
24 | + Connection conn = null; | |
25 | + try { | |
26 | + //通过环境找寻相应的配置,然后初始化数据库连接 | |
27 | + EnvEnum envEnum = EnvEnum.fromCode(Model.getEnv()); | |
28 | + ConfigProperties dbConfig = ConfigProperties.getConfig(envEnum); | |
29 | + Class.forName(dbConfig.getJdbcName()); | |
30 | + conn = DriverManager.getConnection(dbConfig.getDbUrl(),dbConfig.getDbUser(), dbConfig.getDbPassword()); | |
31 | + } catch (Exception e) { | |
32 | + e.printStackTrace(); | |
33 | + } | |
34 | + return conn; | |
35 | + /*if ("SIT".equals(Model.getEnv())) { | |
36 | + try { | |
37 | + jdbcName = DBInfo.getSitJdbcName(); | |
38 | + dbUrl = DBInfo.getSitSqlUrl(); | |
39 | + dbUser = DBInfo.getSitUser(); | |
40 | + dbPassword = DBInfo.getSitPassword(); | |
41 | + Class.forName(jdbcName); | |
42 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | |
43 | + return conn; | |
44 | + } catch (Exception e) { | |
45 | + e.printStackTrace(); | |
46 | + } | |
47 | + } else if ("HOTFIX".equals(Model.getEnv())) { | |
48 | + try { | |
49 | + jdbcName = DBInfo.getHotfixJdbcName(); | |
50 | + dbUrl = DBInfo.getHotfixSqlUrl(); | |
51 | + dbUser = DBInfo.getHotfixUser(); | |
52 | + dbPassword = DBInfo.getHotfixPassword(); | |
53 | + Class.forName(jdbcName); | |
54 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | |
55 | + return conn; | |
56 | + } catch (Exception e) { | |
57 | + e.printStackTrace(); | |
58 | + } | |
59 | + } else if ("DIT".equals(Model.getEnv())) { | |
60 | + try { | |
61 | + jdbcName = DBInfo.getDitJdbcName(); | |
62 | + dbUrl = DBInfo.getDitSqlUrl(); | |
63 | + dbUser = DBInfo.getDitUser(); | |
64 | + dbPassword = DBInfo.getDitPassword(); | |
65 | + Class.forName(jdbcName); | |
66 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | |
67 | + return conn; | |
68 | + } catch (Exception e) { | |
69 | + e.printStackTrace(); | |
70 | + } | |
71 | + } else if ("UAT".equals(Model.getEnv())) { | |
72 | + try { | |
73 | + jdbcName = DBInfo.getUatJdbcName(); | |
74 | + dbUrl = DBInfo.getUatSqlUrl(); | |
75 | + dbUser = DBInfo.getUatUser(); | |
76 | + dbPassword = DBInfo.getUatPassword(); | |
77 | + Class.forName(jdbcName); | |
78 | + conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); | |
79 | + return conn; | |
80 | + } catch (Exception e) { | |
81 | + e.printStackTrace(); | |
82 | + } | |
83 | + } | |
84 | + return null;*/ | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * 关闭连接 | |
89 | + * | |
90 | + * @param stmt | |
91 | + * @param conn | |
92 | + * @throws Exception | |
93 | + */ | |
94 | + public static void close(Statement stmt, Connection conn) throws Exception { | |
95 | + if (stmt != null) { | |
96 | + stmt.close(); | |
97 | + if (conn != null) { | |
98 | + conn.close(); | |
99 | + } | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * 关闭连接 | |
105 | + * | |
106 | + * @param cstmt | |
107 | + * @param conn | |
108 | + * @throws Exception | |
109 | + */ | |
110 | + public static void close(CallableStatement cstmt, Connection conn) throws Exception { | |
111 | + if (cstmt != null) { | |
112 | + cstmt.close(); | |
113 | + if (conn != null) { | |
114 | + conn.close(); | |
115 | + } | |
116 | + } | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * 关闭连接 | |
121 | + * | |
122 | + * @param pstmt | |
123 | + * @param conn | |
124 | + * @throws SQLException | |
125 | + */ | |
126 | + public static void close(PreparedStatement pstmt, Connection conn) throws SQLException { | |
127 | + if (pstmt != null) { | |
128 | + pstmt.close(); | |
129 | + if (conn != null) { | |
130 | + conn.close(); | |
131 | + } | |
132 | + } | |
133 | + } | |
134 | + | |
135 | + /** | |
136 | + * 重载关闭方法 | |
137 | + * | |
138 | + * @param rs | |
139 | + * @param pstmt | |
140 | + * @param conn | |
141 | + * @throws Exception | |
142 | + */ | |
143 | + public static void close(ResultSet rs, PreparedStatement pstmt, Connection conn) throws Exception { | |
144 | + if (rs != null) { | |
145 | + rs.close(); | |
146 | + if (pstmt != null) { | |
147 | + pstmt.close(); | |
148 | + if (conn != null) { | |
149 | + conn.close(); | |
150 | + } | |
151 | + } | |
152 | + } | |
153 | + } | |
154 | +} | ... | ... |
... | ... | @@ -0,0 +1,97 @@ |
1 | +package com.essa.framework; | |
2 | +/** | |
3 | + * Created by weicheng on 2018/10/25. | |
4 | + */ | |
5 | + | |
6 | +import java.util.List; | |
7 | +import java.util.concurrent.ConcurrentHashMap; | |
8 | +import java.util.concurrent.atomic.AtomicReference; | |
9 | + | |
10 | +public enum EnvEnum { | |
11 | + SIT("sit","SIT"), | |
12 | + DIT("dit","DIT"), | |
13 | + HOTFIX("hotfix","HOTFIX"), | |
14 | + UAT("uat","UAT"), | |
15 | + EPD("epd","EPD"); | |
16 | + | |
17 | + /** | |
18 | + * 原子引用(全部) | |
19 | + */ | |
20 | + private static AtomicReference<ConcurrentHashMap<String, EnvEnum>> mapAllRef = new AtomicReference<>(); | |
21 | + | |
22 | + private static AtomicReference<ConcurrentHashMap<String, EnvEnum>> mapPartRef = new AtomicReference<>(); | |
23 | + | |
24 | + /** | |
25 | + * 根据code获取 EnvEnum | |
26 | + * | |
27 | + * @param code | |
28 | + * @return | |
29 | + */ | |
30 | + public static EnvEnum fromCode(String code) { | |
31 | + buildConcurrentHashMap(); | |
32 | + return mapAllRef.get().get(code); | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * 如果map是空,就会构建Map | |
37 | + */ | |
38 | + private static void buildConcurrentHashMap() { | |
39 | + //如果所有枚举的原子引用是空对象,就创建一个ConcurrentHashMap给原子引用 | |
40 | + mapAllRef.compareAndSet(null, new ConcurrentHashMap<>()); | |
41 | + //获取原子引用的currentHashMap对象 | |
42 | + ConcurrentHashMap<String, EnvEnum> concurrentHashAllMap = mapAllRef.get(); | |
43 | + //如果ConcurrentHashMap里面没有一个枚举对象,需要初次化 | |
44 | + if (concurrentHashAllMap.isEmpty()) { | |
45 | + for (EnvEnum e : EnvEnum.values()) { | |
46 | + concurrentHashAllMap.put(e.getCode(), e); | |
47 | + } | |
48 | + mapAllRef.set(concurrentHashAllMap); | |
49 | + } | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * 枚举代码 | |
54 | + */ | |
55 | + private String code; | |
56 | + | |
57 | + /** | |
58 | + * 枚举描述 | |
59 | + */ | |
60 | + private String desc; | |
61 | + | |
62 | + public String getCode() { | |
63 | + return code; | |
64 | + } | |
65 | + | |
66 | + public void setCode(String code) { | |
67 | + this.code = code; | |
68 | + } | |
69 | + | |
70 | + public String getDesc() { | |
71 | + return desc; | |
72 | + } | |
73 | + | |
74 | + public void setDesc(String desc) { | |
75 | + this.desc = desc; | |
76 | + } | |
77 | + | |
78 | + EnvEnum(String code, String desc) { | |
79 | + this.code = code; | |
80 | + this.desc = desc; | |
81 | + } | |
82 | + | |
83 | + public static List<EnvEnum> getAllEnum() { | |
84 | + buildConcurrentHashMap(); | |
85 | + return (List<EnvEnum>) mapAllRef.get().values(); | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * 只返回常用枚举 | |
90 | + * | |
91 | + * @return | |
92 | + */ | |
93 | + public static List<EnvEnum> getEnumByDefault() { | |
94 | + buildConcurrentHashMap(); | |
95 | + return (List<EnvEnum>) mapPartRef.get().values(); | |
96 | + } | |
97 | +} | ... | ... |
... | ... | @@ -0,0 +1,60 @@ |
1 | +package com.essa.framework; | |
2 | +import java.sql.*; | |
3 | + | |
4 | +public class LinkSQL { | |
5 | + | |
6 | + public static void main(String[] args) { | |
7 | + LinkSQL dao = new LinkSQL(); | |
8 | + dao.SQLQuery(); | |
9 | + | |
10 | + } | |
11 | + | |
12 | + public static String SQLQuery() { | |
13 | + | |
14 | + String Code = null; | |
15 | + Connection conn = null; | |
16 | + Statement stmt = null; | |
17 | + ResultSet rs = null; | |
18 | + | |
19 | + try { | |
20 | + Class.forName("com.mysql.jdbc.Driver"); | |
21 | +// 连接SIT环境的数据库 | |
22 | + conn = DriverManager.getConnection("jdbc:mysql://192.168.1.247:3307/bpms","root","redhat"); | |
23 | + | |
24 | + stmt = conn.createStatement(); | |
25 | + | |
26 | +// 查询FO单在制单中的PO单号 | |
27 | + rs =stmt.executeQuery("SELECT p.code FROM fact_fo as f INNER JOIN sale_po as p ON f.from_id=p.id WHERE send_order_status=2 AND from_type=1 ORDER BY f.id DESC LIMIT 1"); | |
28 | + | |
29 | + while (rs.next()) { | |
30 | + Code = rs.getString("code"); | |
31 | + } | |
32 | + return Code; | |
33 | + | |
34 | + } catch (ClassNotFoundException e) { | |
35 | + System.out.println("驱动类无法找到!"); | |
36 | + throw new RuntimeException(e); | |
37 | + | |
38 | + } catch (SQLException e) { | |
39 | + System.out.println("数据库访问异常!"); | |
40 | + throw new RuntimeException(e); | |
41 | + }finally { | |
42 | + //关闭链接资源 | |
43 | + try { | |
44 | + if (rs !=null) { | |
45 | + rs.close(); | |
46 | + } | |
47 | + if (stmt !=null) { | |
48 | + stmt.cancel(); | |
49 | + } | |
50 | + if (conn !=null) { | |
51 | + conn.close(); | |
52 | + } | |
53 | + | |
54 | + } catch (SQLException e) { | |
55 | + System.out.println("关闭连接时发生异常"); | |
56 | + e.printStackTrace(); | |
57 | + } | |
58 | + } | |
59 | + } | |
60 | +} | ... | ... |
src/test/java/com/essa/framework/ListenerSuite.java renamed to src/main/java/com/essa/framework/ListenerSuite.java
src/test/java/com/essa/framework/LogType.java renamed to src/main/java/com/essa/framework/LogType.java
src/test/java/com/essa/framework/Logger.java renamed to src/main/java/com/essa/framework/Logger.java
... | ... | @@ -6,8 +6,6 @@ import java.io.OutputStreamWriter; |
6 | 6 | import java.text.SimpleDateFormat; |
7 | 7 | import java.util.Date; |
8 | 8 | |
9 | -import com.essa.framework.LogType; | |
10 | - | |
11 | 9 | public class Logger { |
12 | 10 | |
13 | 11 | public static String OutputFileName = getDateTimeByFormat(new Date(), "yyyyMMdd"); |
... | ... | @@ -27,10 +25,13 @@ public class Logger { |
27 | 25 | // 定义日志文件保存路径和日志文件名称 |
28 | 26 | logFileName = ".\\Log" + "\\" + OutputFileName + ".log"; |
29 | 27 | if (outputStreamWriter == null) { |
30 | - File logFile = new File(logFileName); | |
31 | - | |
32 | - if (!logFile.exists()) | |
33 | - logFile.createNewFile(); | |
28 | + File logFile = new File(logFileName); | |
29 | + | |
30 | + if(!logFile.getParentFile().exists()){ | |
31 | + logFile.getParentFile().mkdirs(); | |
32 | + } | |
33 | + if (!logFile.exists()) | |
34 | + logFile.createNewFile(); | |
34 | 35 | //利用OutputStreamWriter往日志文件写内容,字符编码是unicode |
35 | 36 | outputStreamWriter = new OutputStreamWriter(new FileOutputStream(logFileName), "utf-8"); |
36 | 37 | } | ... | ... |
src/test/java/com/essa/framework/Model.java renamed to src/main/java/com/essa/framework/Model.java
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 | -} | |
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 = "A181120T9194A";//po单号 | |
19 | + public static int isactivity=0;//是否是活动商品 1:是 0:否 | |
20 | + public static String manager;//商品的类目经理 | |
21 | + public static String serialNum;//待办流水号 | |
22 | + public static String materialName;//物料名称 | |
23 | + public static String projectName;//项目立项书名称 | |
24 | + public static String salesman;//业务员 | |
25 | + | |
26 | + public static String getSalesman() { | |
27 | + return salesman; | |
28 | + } | |
29 | + | |
30 | + public static void setSalesman(String salesman) { | |
31 | + Model.salesman = salesman; | |
32 | + } | |
33 | + | |
34 | + public static String getProjectName() { | |
35 | + return projectName; | |
36 | + } | |
37 | + | |
38 | + public static void setProjectName(String projectName) { | |
39 | + Model.projectName = projectName; | |
40 | + } | |
41 | + | |
42 | + public static String getMaterialName() { | |
43 | + return materialName; | |
44 | + } | |
45 | + | |
46 | + public static void setMaterialName(String materialName) { | |
47 | + Model.materialName = materialName; | |
48 | + } | |
49 | + | |
50 | + public static String getSerialNum() { | |
51 | + return serialNum; | |
52 | + } | |
53 | + | |
54 | + public static void setSerialNum(String serialNum) { | |
55 | + Model.serialNum = serialNum; | |
56 | + } | |
57 | + | |
58 | + public static String getManager() { | |
59 | + return manager; | |
60 | + } | |
61 | + | |
62 | + public static void setManager(String manager) { | |
63 | + Model.manager = manager; | |
64 | + } | |
65 | + | |
66 | + public static int getIsactivity() { | |
67 | + return isactivity; | |
68 | + } | |
69 | + | |
70 | + public static void setIsactivity(int isactivity) { | |
71 | + Model.isactivity = isactivity; | |
72 | + } | |
73 | + | |
74 | + public static String getPoNum() { | |
75 | + return poNum; | |
76 | + } | |
77 | + | |
78 | + public static void setPoNum(String poNum) { | |
79 | + Model.poNum = poNum; | |
80 | + } | |
81 | + | |
82 | + public static String getBuyerAccount() { | |
83 | + return buyerAccount; | |
84 | + } | |
85 | + | |
86 | + public static void setBuyerAccount(String buyerAccount) { | |
87 | + Model.buyerAccount = buyerAccount; | |
88 | + } | |
89 | + | |
90 | + public static String getBuyerPassword() { | |
91 | + return buyerPassword; | |
92 | + } | |
93 | + | |
94 | + public static void setBuyerPassword(String buyerPassword) { | |
95 | + Model.buyerPassword = buyerPassword; | |
96 | + } | |
97 | + | |
98 | + public static String getEnv() { | |
99 | + return env; | |
100 | + } | |
101 | + | |
102 | + public static void setEnv(String env) { | |
103 | + Model.env = env; | |
104 | + } | |
105 | + | |
106 | + public static String getInvateCode() { | |
107 | + return invateCode; | |
108 | + } | |
109 | + | |
110 | + public static void setInvateCode(String invateCode) { | |
111 | + Model.invateCode = invateCode; | |
112 | + } | |
113 | + | |
114 | + public static String getEmail() { | |
115 | + return email; | |
116 | + } | |
117 | + | |
118 | + public static void setEmail(String email) { | |
119 | + Model.email = email; | |
120 | + } | |
121 | + | |
122 | + public static String getPicPath() { | |
123 | + return picPath; | |
124 | + } | |
125 | + | |
126 | + public static void setPicPath(String picPath) { | |
127 | + Model.picPath = picPath; | |
128 | + } | |
129 | + | |
130 | + public static String getSupplierName() { | |
131 | + return supplierName; | |
132 | + } | |
133 | + | |
134 | + public static void setSupplierName(String supplierName) { | |
135 | + Model.supplierName = supplierName; | |
136 | + } | |
137 | + | |
138 | + public static String getBuyerNo() { | |
139 | + return buyerNo; | |
140 | + } | |
141 | + | |
142 | + public static void setBuyerNo(String buyerNo) { | |
143 | + Model.buyerNo = buyerNo; | |
144 | + } | |
145 | + | |
146 | + public static String getSkuNo() { | |
147 | + return skuNo; | |
148 | + } | |
149 | + | |
150 | + public static void setSkuNo(String No) { | |
151 | + skuNo = No; | |
152 | + } | |
153 | + | |
154 | +} | ... | ... |
src/test/java/com/essa/framework/SendEmail.java renamed to src/main/java/com/essa/framework/SendEmail.java
... | ... | @@ -0,0 +1,120 @@ |
1 | +package com.essa.framework; | |
2 | +/** | |
3 | + * Created by weicheng on 2018/10/25. | |
4 | + */ | |
5 | + | |
6 | +import java.util.List; | |
7 | +import java.util.concurrent.ConcurrentHashMap; | |
8 | +import java.util.concurrent.atomic.AtomicReference; | |
9 | + | |
10 | +public enum SuitesEnum { | |
11 | + //suite 第一个是唯一标志,第二个表示需要使用哪个xml(需要换的时候只要改这个即可),第三个描述这个干吗的 | |
12 | + ADD_ORIGINAL_GOODS("ADD_ORIGIN_SKU","addOriginalGoods.xml","新增原厂商品"), | |
13 | + ADD_MARKET_GOODS("ADD_MARKET_GOODS","addMarketGoods.xml","新增市场商品"), | |
14 | + PUBLISH_GROUP_PURCHASE("PUBLISH_GROUP_PURCHASE","publishGroupPurchase.xml","发布团购"), | |
15 | + BUYER_REGISTER("BUYER_REGISTER","buyerRegister.xml","采购商注册"), | |
16 | + ADD_SKU_TO_CART("ADD_SKU_TO_CART","addSkuToCart.xml","添加SKU至购物车"), | |
17 | + ACTIVITY_INQUIRY("ACTIVITY_INQUIRY","activityInquiry.xml","成品询价(活动)"), | |
18 | + PRODUCT_INQUIRY("PRODUCT_INQUIRY","productInquiry.xml","成品询价(正常)"), | |
19 | + ACTIVITY_SEND_PO("ACTIVITY_SEND_PO","activitySendPO.xml","生成PO(活动)"), | |
20 | + SEND_PO("SEND_PO","sendPO.xml","生成PO(正常)"), | |
21 | + PO_INQUIRY("PO_INQUIRY","POInquiry.xml","PO询价"), | |
22 | + ADD_DEV_GOODS("ADD_DEV_GOODS","addDevGoods.xml","新增开发商品"), | |
23 | + LOAD_FINISH("LOAD_FINISH","LoadContainer.xml","装柜完成"); | |
24 | + ; | |
25 | + | |
26 | + /** | |
27 | + * 原子引用(全部) | |
28 | + */ | |
29 | + private static AtomicReference<ConcurrentHashMap<String, SuitesEnum>> mapAllRef = new AtomicReference<>(); | |
30 | + | |
31 | + private static AtomicReference<ConcurrentHashMap<String, SuitesEnum>> mapPartRef = new AtomicReference<>(); | |
32 | + | |
33 | + /** | |
34 | + * 根据code获取 SuitesEnum | |
35 | + * | |
36 | + * @param code | |
37 | + * @return | |
38 | + */ | |
39 | + public static SuitesEnum fromCode(String code) { | |
40 | + buildConcurrentHashMap(); | |
41 | + return mapAllRef.get().get(code); | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * 如果map是空,就会构建Map | |
46 | + */ | |
47 | + private static void buildConcurrentHashMap() { | |
48 | + //如果所有枚举的原子引用是空对象,就创建一个ConcurrentHashMap给原子引用 | |
49 | + mapAllRef.compareAndSet(null, new ConcurrentHashMap<>()); | |
50 | + //获取原子引用的currentHashMap对象 | |
51 | + ConcurrentHashMap<String, SuitesEnum> concurrentHashAllMap = mapAllRef.get(); | |
52 | + //如果ConcurrentHashMap里面没有一个枚举对象,需要初次化 | |
53 | + if (concurrentHashAllMap.isEmpty()) { | |
54 | + for (SuitesEnum e : SuitesEnum.values()) { | |
55 | + concurrentHashAllMap.put(e.getCode(), e); | |
56 | + } | |
57 | + mapAllRef.set(concurrentHashAllMap); | |
58 | + } | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * 枚举代码 | |
63 | + */ | |
64 | + private String code; | |
65 | + | |
66 | + /** | |
67 | + * suite 文件名 | |
68 | + */ | |
69 | + private String suiteName; | |
70 | + | |
71 | + /** | |
72 | + * 枚举描述 | |
73 | + */ | |
74 | + private String desc; | |
75 | + | |
76 | + public String getCode() { | |
77 | + return code; | |
78 | + } | |
79 | + | |
80 | + public void setCode(String code) { | |
81 | + this.code = code; | |
82 | + } | |
83 | + | |
84 | + public String getDesc() { | |
85 | + return desc; | |
86 | + } | |
87 | + | |
88 | + public void setDesc(String desc) { | |
89 | + this.desc = desc; | |
90 | + } | |
91 | + | |
92 | + public String getSuiteName() { | |
93 | + return suiteName; | |
94 | + } | |
95 | + | |
96 | + public void setSuiteName(String suiteName) { | |
97 | + this.suiteName = suiteName; | |
98 | + } | |
99 | + | |
100 | + SuitesEnum(String code, String suiteName, String desc) { | |
101 | + this.code = code; | |
102 | + this.suiteName = SystemConstant.SUITES_PATH + suiteName; | |
103 | + this.desc = desc; | |
104 | + } | |
105 | + | |
106 | + public static List<SuitesEnum> getAllEnum() { | |
107 | + buildConcurrentHashMap(); | |
108 | + return (List<SuitesEnum>) mapAllRef.get().values(); | |
109 | + } | |
110 | + | |
111 | + /** | |
112 | + * 只返回常用枚举 | |
113 | + * | |
114 | + * @return | |
115 | + */ | |
116 | + public static List<SuitesEnum> getEnumByDefault() { | |
117 | + buildConcurrentHashMap(); | |
118 | + return (List<SuitesEnum>) mapPartRef.get().values(); | |
119 | + } | |
120 | +} | ... | ... |
src/main/java/com/essa/framework/SystemConstant.java
0 → 100644
... | ... | @@ -0,0 +1,11 @@ |
1 | +package com.essa.framework; | |
2 | + | |
3 | +/** | |
4 | + * Created by weicheng on 2018/10/26. | |
5 | + */ | |
6 | +public class SystemConstant { | |
7 | + | |
8 | + public static final String RESOURCE_PATH = ".\\src\\main\\resources\\"; | |
9 | + | |
10 | + public static final String SUITES_PATH = RESOURCE_PATH + "\\suites\\"; | |
11 | +} | ... | ... |
src/test/java/com/essa/framework/Tools.java renamed to src/main/java/com/essa/framework/Tools.java
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 | -} | |
1 | +package com.essa.framework; | |
2 | + | |
3 | +import java.text.SimpleDateFormat; | |
4 | +import java.time.Year; | |
5 | +import java.util.Calendar; | |
6 | +import java.util.Date; | |
7 | + | |
8 | +public class Tools { | |
9 | + | |
10 | + /** | |
11 | + * 获取当前时间 | |
12 | + * @return MMdd_HHmmss | |
13 | + */ | |
14 | + public static String getCurrentTime() { | |
15 | + SimpleDateFormat format = new SimpleDateFormat("MMdd_HHmmss"); | |
16 | + Date today = new Date(); | |
17 | + String time = format.format(today); | |
18 | + return time; | |
19 | + } | |
20 | + /** | |
21 | + * 使用当前时间作为工厂货号 | |
22 | + * @return yyyyMMddHHmmss | |
23 | + */ | |
24 | + public static String getFactoryNo() { | |
25 | + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); | |
26 | + Date today = new Date(); | |
27 | + String time = format.format(today); | |
28 | + return time; | |
29 | + } | |
30 | + /** | |
31 | + *格式化当前时间,由于服务器时间与北京时间有误差,这里取值当前时间-5分钟 | |
32 | + * @param | |
33 | + * @return yyyy/MM/dd HH:mm:ss | |
34 | + */ | |
35 | + public static String getFormatTime(){ | |
36 | + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); | |
37 | + Date today = new Date(); | |
38 | + Calendar cal = Calendar.getInstance(); | |
39 | + cal.setTime(today); | |
40 | + cal.add(Calendar.MINUTE,-5); | |
41 | + today = cal.getTime(); | |
42 | + String time = format.format(today); | |
43 | + return time; | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * 获取当前分和秒,另外加一个随机数,作为注册邮箱的区分的数字 | |
48 | + * @return | |
49 | + */ | |
50 | + public static String getTime() { | |
51 | + SimpleDateFormat format = new SimpleDateFormat("mmss"); | |
52 | + Date today = new Date(); | |
53 | + String time = format.format(today); | |
54 | + int i = (int)(1+Math.random()*(10-1+1)); | |
55 | + return time+i; | |
56 | + } | |
57 | + /** | |
58 | + *获取当前时间的下一个月 | |
59 | + * @param | |
60 | + * @return String 格式化后的时间 | |
61 | + */ | |
62 | + public static String getNextMonth(){ | |
63 | + Date today = new Date(); | |
64 | + Calendar cal = Calendar.getInstance(); | |
65 | + cal.setTime(today); | |
66 | + cal.add(Calendar.MONTH,1); | |
67 | + return myForm(cal); | |
68 | + } | |
69 | + /** | |
70 | + *获取当前时间+i天,传入的i为当前时间往后推的天数 | |
71 | + * @param | |
72 | + * @return String | |
73 | + */ | |
74 | + public static String moreDays(int i){ | |
75 | + Date today = new Date(); | |
76 | + Calendar cal = Calendar.getInstance(); | |
77 | + cal.setTime(today); | |
78 | + cal.add(Calendar.DATE,i); | |
79 | + return myForm(cal); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + *获取格式化后的当天 | |
84 | + * @param | |
85 | + * @return String | |
86 | + */ | |
87 | + public static String getToday(){ | |
88 | + Date today = new Date(); | |
89 | + Calendar cal = Calendar.getInstance(); | |
90 | + cal.setTime(today); | |
91 | + return myForm(cal); | |
92 | + } | |
93 | + | |
94 | + /** | |
95 | + *由于bpms系统遇到日期中“天”为0开头时无法输入,故自己写一个格式 | |
96 | + * @param | |
97 | + * @return | |
98 | + */ | |
99 | + public static String myForm(Calendar cal){ | |
100 | + int day = cal.get(Calendar.DATE); | |
101 | + int month = cal.get(Calendar.MONTH)+1; | |
102 | + int year = cal.get(Calendar.YEAR); | |
103 | + return month+"/"+day+"/"+ year; | |
104 | + } | |
105 | +} | ... | ... |
src/test/java/com/essa/pageObject/BaseTest.java renamed to src/main/java/com/essa/pageObject/BaseTest.java
1 | 1 | package com.essa.pageObject; |
2 | 2 | |
3 | -import java.io.IOException; | |
4 | - | |
5 | -import org.openqa.selenium.WebDriver; | |
6 | -import org.openqa.selenium.support.PageFactory; | |
7 | - | |
8 | 3 | import com.buyer.pageObject.BuyerLoginPage; |
9 | 4 | import com.buyer.pageObject.IndexPage; |
10 | 5 | import com.essa.framework.BrowserEngine; |
11 | -import com.essa.pageObject.LoginPage; | |
6 | +import org.openqa.selenium.WebDriver; | |
7 | +import org.openqa.selenium.support.PageFactory; | |
12 | 8 | |
13 | 9 | /** |
14 | 10 | * @author Administrator |
15 | - *测试用例的基类,主要是有登录和调用浏览器的方法 | |
11 | + * 测试用例的基类,主要是有登录和调用浏览器的方法 | |
16 | 12 | */ |
17 | 13 | public class BaseTest { |
18 | - public WebDriver driver; | |
14 | + public WebDriver driver; | |
15 | + | |
16 | + public WebDriver getDriver() { | |
17 | + return driver; | |
18 | + } | |
19 | 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) { | |
20 | + /** | |
21 | + * bpms调用浏览器,打开要测试的网页 | |
22 | + */ | |
23 | + public void initsetUp() { | |
24 | + BrowserEngine browserEngine = new BrowserEngine(); | |
25 | +// try { | |
26 | + browserEngine.initConfigData(); | |
27 | + /*} catch (IOException e) { | |
32 | 28 | 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) { | |
29 | + }*/ | |
30 | + driver = browserEngine.getBrowser(); | |
31 | + } | |
32 | + | |
33 | + /** | |
34 | + * buyer调用浏览器,将访问buyer的地址 | |
35 | + */ | |
36 | + public void initBuyer() { | |
37 | + BrowserEngine browserEngine = new BrowserEngine(); | |
38 | +// try { | |
39 | + browserEngine.initConfigData(); | |
40 | + /* } catch (IOException e) { | |
45 | 41 | e.printStackTrace(); |
46 | - } | |
47 | - driver = browserEngine.buyerGetBrowser(); | |
48 | - } | |
42 | + }*/ | |
43 | + driver = browserEngine.buyerGetBrowser(); | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * bpms初始化登录页面,登录 | |
48 | + * | |
49 | + * @param account | |
50 | + */ | |
51 | + public void loginValid(String account) { | |
52 | + LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); | |
53 | + loginPage.login(account, "essa123"); | |
54 | + } | |
49 | 55 | |
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 | - } | |
56 | + /** | |
57 | + * buyer初始化登录 | |
58 | + * | |
59 | + * @param account | |
60 | + */ | |
61 | + public void loginBuyerValid(String account, String password) { | |
62 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | |
63 | + indexPage.toLoginPage(); | |
64 | + BuyerLoginPage loginPage = PageFactory.initElements(driver, BuyerLoginPage.class); | |
65 | + loginPage.login(account, password); | |
66 | + } | |
68 | 67 | } |
69 | 68 | ... | ... |
src/main/java/com/essa/pageObject/DocumentaryManage/BillingCenterPage.java
0 → 100644
... | ... | @@ -0,0 +1,161 @@ |
1 | +package com.essa.pageObject.DocumentaryManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.pageObject.HomePage; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | +import org.testng.asserts.SoftAssert; | |
11 | + | |
12 | +/** | |
13 | +* @Description: 发单中心页面 | |
14 | +* @Author: ZengJin | |
15 | +* @CreateTime: 2018/10/31 | |
16 | +*/ | |
17 | +public class BillingCenterPage extends BasePage { | |
18 | + /** | |
19 | + * 构造方法 | |
20 | + * | |
21 | + * @param driver | |
22 | + */ | |
23 | + public BillingCenterPage(WebDriver driver) { | |
24 | + super(driver); | |
25 | + } | |
26 | + /** | |
27 | + * 元素定位 | |
28 | + */ | |
29 | + @FindBy (xpath = "//*[@ng-model='query.params.keyword']") | |
30 | + WebElement keyword;//关键字搜索框 | |
31 | + | |
32 | + @FindBy (xpath = "//*[text()='高级查询']") | |
33 | + WebElement advancedSearch;//高级查询 | |
34 | + | |
35 | + @FindBy (xpath = "//*[@ng-model='query.params.poCode']") | |
36 | + WebElement PONum;//根据PO单号查询 | |
37 | + | |
38 | + @FindBy (xpath = "//*[@ng-click='richSearch()']") | |
39 | + WebElement search;//高级查询:查询按钮 | |
40 | + | |
41 | + @FindBy (xpath = "//*[text()='开始发单']") | |
42 | + WebElement send;//开始发单按钮 | |
43 | + | |
44 | + @FindBy (xpath = "//*[text()='登记接单']") | |
45 | + WebElement accept;//登记接单按钮 | |
46 | + | |
47 | + @FindBy (xpath = "//tbody//tr[1]/td[1]") | |
48 | + WebElement firstFo;//第一个FO单编号 | |
49 | + | |
50 | + @FindBy (xpath = "//tbody//tr[1]/td[3]") | |
51 | + WebElement status;//第一个FO单发单状态 | |
52 | + | |
53 | + @FindBy (xpath = "//*[@ng-model='scanValue']") | |
54 | + WebElement FOKeyword;//弹框里的FO单号查询输入框 | |
55 | + | |
56 | + @FindBy (xpath = "//*[@ng-click='clickBtn()']") | |
57 | + WebElement FOSearch;//FO查询搜索框 | |
58 | + | |
59 | + @FindBy (xpath = "//*[@ng-click='sendBill()']") | |
60 | + WebElement sendBill;//开始发单按钮 | |
61 | + | |
62 | + @FindBy (xpath = "//*[@ng-click='acceptBill()']") | |
63 | + WebElement acceptBill;//接单完成 | |
64 | + | |
65 | + @FindBy (xpath = "//div[@class='left ng-scope']//span[2]") | |
66 | + WebElement total;//一共有多少个FO单 | |
67 | + | |
68 | + @FindBy (xpath = "//button[contains(text(),'50')]") | |
69 | + WebElement show50;//分页展示50个 | |
70 | + | |
71 | + /** | |
72 | + * 页面方法 | |
73 | + */ | |
74 | + /** | |
75 | + *单个Fo单的发单方法 | |
76 | + * @param | |
77 | + * @return homePage | |
78 | + */ | |
79 | + public HomePage Billing(){ | |
80 | + forceWait(2000); | |
81 | + sendKeys(keyword,"程序仍在进行,等待页面加载完成中……"); | |
82 | + forceWait(4000); | |
83 | + dynamicLoad(By.xpath("//*[text()='对不起!没有查询到相关数据。']")); | |
84 | + clear(keyword); | |
85 | + click(advancedSearch); | |
86 | + sendKeys(PONum,Model.getPoNum()); | |
87 | + click(search); | |
88 | + dynamicLoad(); | |
89 | + String FO = firstFo.getText(); | |
90 | + click(send); | |
91 | + sendKeys(FOKeyword,FO); | |
92 | + click(FOSearch); | |
93 | + forceWait(500); | |
94 | + click(sendBill); | |
95 | + forceWait(500); | |
96 | + SoftAssert softAssert = new SoftAssert(); | |
97 | + softAssert.assertEquals(status.getText(),"发单中","发单失败!"); | |
98 | + click(accept); | |
99 | + sendKeys(FOKeyword,FO); | |
100 | + click(FOSearch); | |
101 | + forceWait(500); | |
102 | + click(acceptBill); | |
103 | + forceWait(500); | |
104 | + softAssert.assertEquals(status.getText(),"已接单","接单失败!"); | |
105 | + softAssert.assertAll(); | |
106 | + return new HomePage(driver); | |
107 | + } | |
108 | + /** | |
109 | + *多个FO单时的发单 | |
110 | + * @param | |
111 | + * @return | |
112 | + */ | |
113 | + public HomePage MoreBilling(){ | |
114 | + forceWait(2000); | |
115 | + sendKeys(keyword,"程序仍在进行,等待页面加载完成中……"); | |
116 | + forceWait(4000); | |
117 | + dynamicLoad(By.xpath("//*[text()='对不起!没有查询到相关数据。']")); | |
118 | + clear(keyword); | |
119 | + click(advancedSearch); | |
120 | + sendKeys(PONum,Model.getPoNum()); | |
121 | + click(search); | |
122 | + dynamicLoad(); | |
123 | + int totalNum = Integer.parseInt(total.getText());//根据分页获取FO单总数 | |
124 | + if (totalNum>10){ | |
125 | + click(show50); | |
126 | + forceWait(1000); | |
127 | + } | |
128 | + for(int i=1;i<=totalNum;i++){ | |
129 | + WebElement FOs = driver.findElement(By.xpath("//tbody//tr["+i+"]/td[1]"));//获取Fo单号 | |
130 | + WebElement FoStatus = driver.findElement(By.xpath("//tbody//tr["+i+"]/td[3]"));//当前FO单状态 | |
131 | + String FO = FOs.getText(); | |
132 | + switch (FoStatus.getText()){ | |
133 | + case "制单中" : | |
134 | + click(send); | |
135 | + sendKeys(FOKeyword,FO); | |
136 | + click(FOSearch); | |
137 | + forceWait(500); | |
138 | + click(sendBill); | |
139 | + forceWait(500); | |
140 | + click(accept); | |
141 | + sendKeys(FOKeyword,FO); | |
142 | + click(FOSearch); | |
143 | + forceWait(500); | |
144 | + click(acceptBill); | |
145 | + forceWait(500); | |
146 | + break; | |
147 | + case "发单中" : | |
148 | + click(accept); | |
149 | + sendKeys(FOKeyword,FO); | |
150 | + click(FOSearch); | |
151 | + forceWait(500); | |
152 | + click(acceptBill); | |
153 | + forceWait(500); | |
154 | + break; | |
155 | + default : | |
156 | + break; | |
157 | + } | |
158 | + } | |
159 | + return new HomePage(driver); | |
160 | + } | |
161 | +} | ... | ... |
src/main/java/com/essa/pageObject/DocumentaryManage/ConvertTailPage.java
0 → 100644
... | ... | @@ -0,0 +1,51 @@ |
1 | +package com.essa.pageObject.DocumentaryManage; | |
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 ConvertTailPage extends BasePage { | |
16 | + | |
17 | + public ConvertTailPage(WebDriver driver) { | |
18 | + super(driver); | |
19 | + } | |
20 | + /* | |
21 | + * 元素定位 | |
22 | + */ | |
23 | + @FindBy (xpath = "//*[@name='tailDeliveryDay']") | |
24 | + WebElement tailDeliveryDay;//尾货货期 | |
25 | + | |
26 | + @FindBy (xpath ="//*[@name='moveOutQuantity']") | |
27 | + WebElement moveOutQuantity;//转出箱数 | |
28 | + | |
29 | + @FindBy (xpath ="//button[text()='保存']") | |
30 | + WebElement save;//保存 | |
31 | + | |
32 | + @FindBy (xpath ="//button[text()='确定']") | |
33 | + WebElement confirm;//保存 | |
34 | + | |
35 | + /* | |
36 | + * 页面方法 | |
37 | + */ | |
38 | + /** | |
39 | + * 对sku转在途尾货 | |
40 | + * @return PO单看板页面 | |
41 | + */ | |
42 | + public POBoardPage convertTail() { | |
43 | + dynamicWait(By.xpath("//*[@name='tailDeliveryDay']")); | |
44 | + sendKeys(tailDeliveryDay, "7"); | |
45 | + sendKeys(moveOutQuantity, "2"); | |
46 | + click(save); | |
47 | + dynamicWait(By.xpath("//button[text()='确定']")); | |
48 | + click(confirm); | |
49 | + return new POBoardPage(driver); | |
50 | + } | |
51 | +} | ... | ... |
src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java
0 → 100644
... | ... | @@ -0,0 +1,125 @@ |
1 | +package com.essa.pageObject.DocumentaryManage; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import com.essa.framework.Tools; | |
5 | +import org.openqa.selenium.By; | |
6 | +import org.openqa.selenium.WebDriver; | |
7 | + | |
8 | +import com.essa.framework.BasePage; | |
9 | +import org.openqa.selenium.WebElement; | |
10 | +import org.openqa.selenium.support.FindBy; | |
11 | + | |
12 | +import java.util.Date; | |
13 | +/** | |
14 | +* @Description: Po看板页面 | |
15 | +* @Author: ZengJin | |
16 | +* @CreateTime: 2018/11/1 | |
17 | +*/ | |
18 | +public class POBoardPage extends BasePage { | |
19 | + | |
20 | + public POBoardPage(WebDriver driver) { | |
21 | + super(driver); | |
22 | + } | |
23 | + /* | |
24 | + * 元素定位 | |
25 | + */ | |
26 | + @FindBy (xpath = "//*[text()='订单任务看板']") | |
27 | + WebElement taskBoard;//订单任务看板 | |
28 | + | |
29 | + @FindBy (xpath = "//*[@ng-model='keyword']") | |
30 | + WebElement keyword;//关键字查询输入框 | |
31 | + | |
32 | + @FindBy (xpath ="//*[@ng-model='keyword']/../span/button") | |
33 | + WebElement search;//查询按钮 | |
34 | + | |
35 | + @FindBy (xpath = "//*[@id='detailView']/div/div[3]/div[1]/div/div/table/tbody/tr[1]/td/div[2]/div[1]/input") | |
36 | + WebElement firstCheckbox;//第一个复选框 | |
37 | + | |
38 | + @FindBy (xpath ="//button[contains(text(),'转在途尾货')]") | |
39 | + WebElement toTail;//转在途尾货按钮 | |
40 | + | |
41 | + // 通知收货 | |
42 | + @FindBy (xpath = "//button[contains(text(),'通知收货')]") | |
43 | + WebElement noticeReceive; | |
44 | + | |
45 | + //收货日期 | |
46 | + @FindBy (xpath = "//*[contains(text(),'收货日期')]") ///label[@class='control-label col-sm-8'] | |
47 | + WebElement reveiveDate; | |
48 | + | |
49 | + // 收货日期输入框 | |
50 | + @FindBy (xpath = " //div[@class='col-sm-16']//input[@type='text']") | |
51 | + WebElement inputReceiveDate; | |
52 | + | |
53 | + // 确定 | |
54 | + @FindBy (xpath = "//button[contains(text(),'确定')]") | |
55 | + WebElement submit; | |
56 | + | |
57 | + // 通知装柜 | |
58 | + @FindBy(xpath = "//button[contains(text(),'通知装柜')]") | |
59 | + WebElement noticeLoad; | |
60 | + | |
61 | + // 装柜日期空白处 | |
62 | + @FindBy(xpath = " //label[@class='control-label col-md-8']") | |
63 | + WebElement loadDate; | |
64 | + | |
65 | + // 装柜日期输入框 | |
66 | + @FindBy (xpath = "//input[@name='newDate']") | |
67 | + WebElement inutLoadDate; | |
68 | + | |
69 | + | |
70 | + /* | |
71 | + * 页面方法 | |
72 | + */ | |
73 | + /** | |
74 | + * 转在途尾货 | |
75 | + * @return 转在途尾货页面 | |
76 | + */ | |
77 | + public ConvertTailPage toTail() { | |
78 | + dynamicLoad(By.xpath("//*[style='display: block;']"));//等待页面加载完成 | |
79 | + click(taskBoard); | |
80 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
81 | + sendKeys(keyword, Model.getSkuNo()); | |
82 | + click(search); | |
83 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
84 | + click(firstCheckbox); | |
85 | + click(toTail); | |
86 | + return new ConvertTailPage(driver); | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * PO通知收货和通知装柜 | |
91 | + */ | |
92 | + // 通知收货 | |
93 | + public POBoardPage noticeReceive(){ | |
94 | + click(noticeReceive); | |
95 | + jsExecutorRemoveAttribute(inputReceiveDate,"readonly"); | |
96 | + sendKeys(inputReceiveDate, Tools.getToday()); | |
97 | + click(reveiveDate); | |
98 | + click(submit); | |
99 | + return new POBoardPage(driver); | |
100 | + } | |
101 | + | |
102 | + public boolean isNoticeReceSucceed(){ | |
103 | + forceWait(2000); | |
104 | + return isVisibility(By.xpath("//*[contains(text(),'收货中')]")); | |
105 | + } | |
106 | + | |
107 | + //通知装柜 | |
108 | + public POBoardPage noticeLoad(){ | |
109 | + click(noticeLoad); | |
110 | + jsExecutorRemoveAttribute(inutLoadDate,"readonly"); | |
111 | + sendKeys(inutLoadDate,Tools.getToday()); | |
112 | + click(loadDate); | |
113 | + forceWait(1000); | |
114 | + click(submit); | |
115 | +// forceWait(2000); | |
116 | + return new POBoardPage(driver); | |
117 | + } | |
118 | + | |
119 | + public boolean isNoticeLoadSucceed(){ | |
120 | + forceWait(2000); | |
121 | + return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); | |
122 | + } | |
123 | + | |
124 | + | |
125 | +} | ... | ... |
src/main/java/com/essa/pageObject/DocumentaryManage/PODocumentaryListPage.java
0 → 100644
... | ... | @@ -0,0 +1,75 @@ |
1 | +package com.essa.pageObject.DocumentaryManage; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import org.openqa.selenium.By; | |
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 | + | |
11 | +/** | |
12 | + * @author Administrator | |
13 | + *PO跟单任务列表页面 | |
14 | + */ | |
15 | +public class PODocumentaryListPage extends BasePage { | |
16 | + | |
17 | + public PODocumentaryListPage(WebDriver driver) { | |
18 | + super(driver); | |
19 | + } | |
20 | + | |
21 | + /* | |
22 | + * 元素定位 | |
23 | + */ | |
24 | + @FindBy (xpath = "//*[contains(text(),'高级查询')]") | |
25 | + WebElement advancedQuery;//高级查询 | |
26 | + | |
27 | + @FindBy (xpath = "//*[text()='PO单号:']/../div[1]/input") | |
28 | + WebElement OrderNo;//PO单号 | |
29 | + | |
30 | + @FindBy (xpath = "//*[text()='查询']") | |
31 | + WebElement search;//查询按钮 | |
32 | + | |
33 | + @FindBy (xpath = "//*[@id='listView']/div/table/tbody/tr[1]/td/div/div[1]/div/ul/li[1]/a") | |
34 | + WebElement detail;//搜索结果中的一个查看详情 | |
35 | + | |
36 | + // 关键字查询 | |
37 | + @FindBy (xpath = "//*[contains(@placeholder,'请输入PO单号、客户编号等关键字查询')]") | |
38 | + WebElement keySearch; | |
39 | + | |
40 | + // 放大镜查询按钮 | |
41 | + @FindBy (xpath = "//*[contains(@ng-click,'search()')]") | |
42 | + WebElement magnifierSearch; | |
43 | + | |
44 | + // 查看详情 | |
45 | + @FindBy (xpath = "//*[contains(text(),'查看详情')]") | |
46 | + WebElement followDetail; | |
47 | + | |
48 | + /* | |
49 | + * 页面方法 | |
50 | + */ | |
51 | + public POBoardPage todetail() { | |
52 | + mywait(detail); | |
53 | + click(advancedQuery); | |
54 | + sendKeys(OrderNo, Model.getPoNum()); | |
55 | + click(search); | |
56 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
57 | + click(detail); | |
58 | + return new POBoardPage(driver); | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * 进入PO跟单详情 | |
63 | + * @return | |
64 | + */ | |
65 | + public PODocumentaryListPage toPoFollowDetail(){ | |
66 | + forceWait(1000); | |
67 | + sendKeys(keySearch, Model.getPoNum()); | |
68 | + click(magnifierSearch); | |
69 | + dynamicLoad(); | |
70 | + click(followDetail); | |
71 | + forceWait(3000); | |
72 | + dynamicLoad(); | |
73 | + return new PODocumentaryListPage(driver); | |
74 | + } | |
75 | +} | ... | ... |
src/main/java/com/essa/pageObject/DocumentaryManage/ReceiptCorePage.java
0 → 100644
... | ... | @@ -0,0 +1,181 @@ |
1 | +package com.essa.pageObject.DocumentaryManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
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 | +public class ReceiptCorePage extends BasePage { | |
11 | + | |
12 | + public ReceiptCorePage(WebDriver driver) { super(driver);} | |
13 | + | |
14 | + /* | |
15 | + * 页面元素定位 | |
16 | + * */ | |
17 | + | |
18 | + @FindBy (xpath = "//*[contains(text(),'对不起!没有查询到相关数据')]") | |
19 | + | |
20 | + WebElement Wait ;//等待 | |
21 | + | |
22 | + @FindBy(xpath = "//i[@class='iconfont icon-double-arrow-right']") | |
23 | + // @FindBy (xpath = "//*[contains(text(),'高级查询')]") | |
24 | + WebElement advancedQuery; //高级查询 | |
25 | + | |
26 | + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/form[2]/div[5]/div[1]/input[1]") | |
27 | + // @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']") | |
28 | + | |
29 | + WebElement PO_numbers; //PO单号 | |
30 | + | |
31 | + @FindBy (xpath = "//*[text()='查询']") | |
32 | + // @FindBy (xpath = "//*/button[@type='submit']") | |
33 | + | |
34 | + WebElement Query ; //查询 | |
35 | + | |
36 | + @FindBy (xpath = "//tbody//tr[1]") | |
37 | + // @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]") | |
38 | + | |
39 | + WebElement list_1; //列表第一条数据 | |
40 | + | |
41 | + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]") | |
42 | + | |
43 | + WebElement list; //列表 | |
44 | + | |
45 | + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[1]") | |
46 | + | |
47 | + WebElement document_code; //单据编号 | |
48 | + | |
49 | + @FindBy (xpath = "//*[text()='开始发单']") | |
50 | + // @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]") | |
51 | + | |
52 | + WebElement start_billing; // 开始发单 | |
53 | + | |
54 | + @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']") | |
55 | + | |
56 | + WebElement start_billing_1 ; //前台发单扫码平台的开始发单 | |
57 | + | |
58 | + @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']") | |
59 | + | |
60 | + WebElement input_document_code;//单据编号输入框 | |
61 | + | |
62 | + @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']") | |
63 | + // @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]") | |
64 | + | |
65 | + WebElement search ;// 搜索按钮 | |
66 | + | |
67 | + @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]") | |
68 | + | |
69 | + WebElement Confirm_billing ; // 扫码确认接单 | |
70 | + | |
71 | + @FindBy (xpath = "//*[text()='接单完成']") | |
72 | + | |
73 | + WebElement finish_billing; //接单完成 | |
74 | + | |
75 | + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]") | |
76 | + | |
77 | + WebElement Fail_billing; //发单失败 | |
78 | + | |
79 | + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]") | |
80 | + | |
81 | + //*[coantains(text(),'所选的工厂订单状态必须为'] | |
82 | + // *[@data-notify='message'] | |
83 | + //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”' | |
84 | + //*[(text()=' 所选的工厂订单状态必须为“发单中”'] | |
85 | + | |
86 | + WebElement Fail_order; //接单失败 | |
87 | + | |
88 | + @FindBy (xpath = "//*[contains(text(),'操作成功')]") | |
89 | + | |
90 | + WebElement Succeed_billing; //发单成功 | |
91 | + | |
92 | + | |
93 | + | |
94 | + | |
95 | + | |
96 | + /** | |
97 | + *页面方法 | |
98 | + * 前台发单中心页面 | |
99 | + */ | |
100 | + | |
101 | + public void BillOrder() { | |
102 | + | |
103 | + dynamicWait(By.xpath("//tbody//tr[1]")); | |
104 | + | |
105 | + click(advancedQuery); | |
106 | +// forceWait(1000); | |
107 | + | |
108 | + sendKeys(PO_numbers, Model.getPoNum()); | |
109 | +// forceWait(1000); | |
110 | + | |
111 | + click(Query); | |
112 | + // forceWait(3000); | |
113 | + | |
114 | + dynamicWait(By.xpath("/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")); | |
115 | + | |
116 | + // actionDoubleClick(document_code); // 双击元素 | |
117 | + // forceWait(1000); | |
118 | + String Fo = document_code.getText(); | |
119 | +// forceWait(1000); | |
120 | + | |
121 | + click(start_billing); | |
122 | + forceWait(1000); | |
123 | + sendKeys(input_document_code,Fo); | |
124 | +// forceWait(1000); | |
125 | + | |
126 | + click(search); | |
127 | + forceWait(500); | |
128 | + | |
129 | + click(start_billing_1); | |
130 | +// forceWait(1000); | |
131 | + // isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")); | |
132 | + dynamicLoad(); | |
133 | + click(start_billing); | |
134 | + forceWait(1000); | |
135 | + | |
136 | + click(Confirm_billing); | |
137 | + forceWait(1000); | |
138 | + | |
139 | + sendKeys(input_document_code,Fo); | |
140 | + forceWait(1000); | |
141 | + | |
142 | + click(search); | |
143 | + forceWait(1000); | |
144 | + | |
145 | + click(finish_billing); | |
146 | + forceWait(3000); | |
147 | + | |
148 | + | |
149 | + | |
150 | + } | |
151 | + | |
152 | + | |
153 | + /* | |
154 | + *用于断言发单接单是否成功 | |
155 | + * @return boolean | |
156 | + */ | |
157 | + | |
158 | + public boolean isSucceed() {return isElementExist(Succeed_billing);} | |
159 | + | |
160 | + /* | |
161 | + *用于断言发单是否成功 | |
162 | + * @return boolean | |
163 | + */ | |
164 | + | |
165 | + public boolean FailBilling() {return isElementExist(Fail_billing);} | |
166 | + | |
167 | + /* | |
168 | + *用于断言接单是否成功 | |
169 | + * @return boolean | |
170 | + */ | |
171 | + | |
172 | + | |
173 | + public boolean FailOrder() {return isElementExist(Fail_order);} | |
174 | + | |
175 | + | |
176 | + | |
177 | + | |
178 | + | |
179 | + | |
180 | + | |
181 | +} | ... | ... |
src/test/java/com/essa/pageObject/GoodsManage/AddMarketGoodsPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AddMarketGoodsPage.java
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 | -} | |
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 = "//td[@title='商品尺寸(cm)']//input[@placeholder='长']") | |
304 | + WebElement goodsLong; | |
305 | + | |
306 | + //商品体积-宽 | |
307 | + @FindBy (xpath = "//td[@title='商品尺寸(cm)']//input[@placeholder='宽']") | |
308 | + WebElement goodsWidth; | |
309 | + | |
310 | + //商品体积-高 | |
311 | + @FindBy (xpath = "//td[@title='商品尺寸(cm)']//input[@placeholder='高']") | |
312 | + WebElement goodsHigh; | |
313 | + | |
314 | + // 包装体积-长 | |
315 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='长']") | |
316 | + WebElement packeLong; | |
317 | + | |
318 | + // 包装体积-宽 | |
319 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='宽']") | |
320 | + WebElement packeWidth; | |
321 | + | |
322 | + // 包装体积-高 | |
323 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='高']") | |
324 | + WebElement packeHigh; | |
325 | + | |
326 | + //外箱体积-长 | |
327 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[2]/input") | |
328 | + WebElement packageLong; | |
329 | + | |
330 | + //外箱体积-宽 | |
331 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[3]/input") | |
332 | + WebElement packageWidth; | |
333 | + | |
334 | + //外箱体积-高 | |
335 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[4]/input") | |
336 | + WebElement packageHigh; | |
337 | + | |
338 | + //毛重 | |
339 | + @FindBy (xpath="//*[@title='毛重']/div/input") | |
340 | + WebElement grossWeight; | |
341 | + | |
342 | + //净重 | |
343 | + @FindBy (xpath="//*[@title='净重']/div/input") | |
344 | + WebElement netWeight; | |
345 | + | |
346 | + //上传图片 | |
347 | + @FindBy (xpath="//*[contains(@handler-obj,'skuPicsHandler')]") | |
348 | + WebElement updatePic; | |
349 | + | |
350 | + //图片上传成功验证 | |
351 | + @FindBy (xpath="//*[contains(@ng-click,'deleteInfo')]") | |
352 | + WebElement isUpudate; | |
353 | + | |
354 | + //提交审核 | |
355 | + @FindBy (xpath="//*[text()='提交审核']") | |
356 | + WebElement submit; | |
357 | + | |
358 | + //提交审核后弹窗--确定按钮 | |
359 | + @FindBy(xpath="//*[text()='确定']") | |
360 | + WebElement confirm; | |
361 | + | |
362 | + //提交审核后弹窗--商品编号 | |
363 | + @FindBy (xpath="//*[@ng-bind='item.no']") | |
364 | + WebElement skuNo; | |
365 | + | |
366 | + /* | |
367 | + * 页面方法 | |
368 | + */ | |
369 | + /** | |
370 | + * 选择供应商 | |
371 | + * @param 供应商名称 | |
372 | + * @throws InterruptedException | |
373 | + */ | |
374 | + public void selectSupplier(){ | |
375 | + dynamicWait(By.xpath("//*[@ng-click='supplier()']")); | |
376 | + selectElement(auditor, "邢昌勇"); | |
377 | + click(selectSupplier); | |
378 | + click(showSelect); | |
379 | + click(queryByName); | |
380 | + sendKeys(queryKeyword,Model.getSupplierName()); | |
381 | + click(search); | |
382 | + forceWait(1000); | |
383 | + mywait(firstRestult); | |
384 | + click(firstRestult); | |
385 | + click(sureBotton); | |
386 | + } | |
387 | + /** | |
388 | + * 选择品牌 | |
389 | + */ | |
390 | + public void selectBrand() { | |
391 | + forceWait(1000); | |
392 | + click(brandName); | |
393 | + mywait(firstBrand); | |
394 | + click(firstBrand); | |
395 | + click(sureBotton); | |
396 | + } | |
397 | + /** | |
398 | + * 选择主类目 | |
399 | + * 注意:这里只能用js点击事件才能展开那个“+” | |
400 | + * @throws InterruptedException | |
401 | + */ | |
402 | + public void selectCategory(){ | |
403 | + forceWait(1000); | |
404 | + mywait(selectCategory); | |
405 | + click(selectCategory); | |
406 | + jsExecutorClick(oneLevel); | |
407 | + jsExecutorClick(twoLevel); | |
408 | + jsExecutorClick(threeLevel); | |
409 | + jsExecutorClick(mainCategory); | |
410 | + click(sureBotton); | |
411 | + } | |
412 | + /** | |
413 | + * 配置商品属性 | |
414 | + */ | |
415 | + public void goodsProperty() { | |
416 | + mywait(secondFunction); | |
417 | + click(secondFunction); | |
418 | + click(secondSpcialFunction); | |
419 | + click(skin); | |
420 | + click(withPerson); | |
421 | + click(forAge); | |
422 | + } | |
423 | + /** | |
424 | + * 配置商品信息 | |
425 | + */ | |
426 | + public void goodsInfo() { | |
427 | + skuNameNo = Tools.getCurrentTime(); | |
428 | + //挪动滚动条,否则查找不到元素 | |
429 | + moveHeightScroll("40"); | |
430 | + sendKeys(goodsName, "市场"+skuNameNo); | |
431 | + click(selectLanguage); | |
432 | + click(english); | |
433 | + sendKeys(goodsName, "Market"+skuNameNo); | |
434 | + sendKeys(factoryNo, Tools.getFactoryNo()); | |
435 | + click(packageLanguage); | |
436 | + click(ownCopyright); | |
437 | + click(sevenDays); | |
438 | + } | |
439 | + /** | |
440 | + * 选择sku属性,并提交 | |
441 | + * @return 商品发布页 | |
442 | + */ | |
443 | + public void goodsSpecifications() { | |
444 | + moveHeightScroll("65"); | |
445 | + click(countUnit); | |
446 | + click(outBox); | |
447 | + click(remoteMode); | |
448 | + click(remoteMode2); | |
449 | + click(thoroughfare); | |
450 | + click(thoroughfare2); | |
451 | + click(normalFunction); | |
452 | + click(normalFunction2); | |
453 | + click(isBattery); | |
454 | + click(isBattery2); | |
455 | + click(isCharge); | |
456 | + click(isCharge2); | |
457 | + click(parts); | |
458 | + click(parts2); | |
459 | + click(pattern); | |
460 | + click(pattern2); | |
461 | + click(suit); | |
462 | + click(suit2); | |
463 | + click(localProcess); | |
464 | + click(localProcess2); | |
465 | + click(color); | |
466 | + click(color2); | |
467 | + click(count); | |
468 | + click(count2); | |
469 | + click(packingType); | |
470 | + click(packingType2); | |
471 | + click(packingWay); | |
472 | + click(packingWay2); | |
473 | + click(addSku); | |
474 | + | |
475 | + sendKeys(skuItemCount, "10"); | |
476 | + sendKeys(saleMOQ, "10"); | |
477 | + sendKeys(supplyTime, "3"); | |
478 | + | |
479 | + //供应商报价,随机生成一个1-200的价格 | |
480 | + int sp = (int)(1+Math.random()*200); | |
481 | + sendKeys(suppliPrice, sp+""); | |
482 | + | |
483 | + jsExecutorDragAndDrop(widthScroll1,2000,0); | |
484 | + mywait(packageLong); | |
485 | + | |
486 | + //商品尺寸 | |
487 | + sendKeys(goodsLong,"10"); | |
488 | + sendKeys(goodsWidth,"15"); | |
489 | + sendKeys(goodsHigh,"20"); | |
490 | + | |
491 | + //包装尺寸 | |
492 | + sendKeys(packeLong,"10"); | |
493 | + sendKeys(packeWidth,"18"); | |
494 | + sendKeys(packeHigh,"25"); | |
495 | + | |
496 | + //外箱体积 | |
497 | + sendKeys(packageLong, "100"); | |
498 | + sendKeys(packageWidth, "50"); | |
499 | + sendKeys(packageHigh, "40"); | |
500 | + //毛重,净重 | |
501 | + sendKeys(grossWeight, "1.5"); | |
502 | + sendKeys(netWeight, "1.2"); | |
503 | + } | |
504 | + | |
505 | + /** | |
506 | + * 上传sku图片并提交审核,确认弹框 | |
507 | + */ | |
508 | + public void updatePic() { | |
509 | + click(updatePic); | |
510 | + uploadFile(Model.getPicPath()); | |
511 | + /*while(!isElementExist(isUpudate)) { | |
512 | + forceWait(1000); | |
513 | + }*/ | |
514 | + dynamicWait(By.xpath("//*[contains(@ng-click,'deleteInfo')]")); | |
515 | + forceWait(1000); | |
516 | + click(submit); | |
517 | + forceWait(1000); | |
518 | + mywait(confirm); | |
519 | + setSkuNo(); | |
520 | + click(confirm); | |
521 | + } | |
522 | + | |
523 | + /** | |
524 | + * 市场商品建档,将上面的方法整合 | |
525 | + * @return MarketGoodsRelesePage | |
526 | + */ | |
527 | + public MarketGoodsRelesePage addMarketGoods() { | |
528 | + selectSupplier(); | |
529 | + selectBrand(); | |
530 | + selectCategory(); | |
531 | + goodsProperty(); | |
532 | + goodsInfo(); | |
533 | + goodsSpecifications(); | |
534 | + updatePic(); | |
535 | + return new MarketGoodsRelesePage(driver); | |
536 | + } | |
537 | + | |
538 | + /** | |
539 | + * 将商品编号写进model | |
540 | + */ | |
541 | + public void setSkuNo() { | |
542 | + Model.setSkuNo(skuNo.getText()); | |
543 | + } | |
544 | +} | ... | ... |
src/test/java/com/essa/pageObject/GoodsManage/AddOriginalGoodsPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AddOriginalGoodsPage.java
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 | -} | |
1 | +package com.essa.pageObject.GoodsManage; | |
2 | + | |
3 | +import com.essa.pageObject.productDev.ProjectListPage; | |
4 | +import org.openqa.selenium.By; | |
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.Tools; | |
11 | + | |
12 | +/** | |
13 | + * 新增原厂商品页面 | |
14 | + * @author Administrator | |
15 | + * | |
16 | + */ | |
17 | +public class AddOriginalGoodsPage extends BasePage { | |
18 | + public AddOriginalGoodsPage(WebDriver driver) { | |
19 | + super(driver); | |
20 | + } | |
21 | + | |
22 | + public static String skuNameNo = null; | |
23 | + public static String supplierName ; | |
24 | + | |
25 | + /* | |
26 | + * 元素定位 | |
27 | + */ | |
28 | + | |
29 | + //选择供应商 | |
30 | + @FindBy (xpath="//*[@ng-click='supplier()']") | |
31 | + WebElement selectSupplier; | |
32 | + | |
33 | + //确定按钮-开发商品确认 | |
34 | + @FindBy (xpath = "//*[text()='确定']") | |
35 | + WebElement confrim; | |
36 | + | |
37 | + //供应商查询方式选择 | |
38 | + @FindBy (xpath="//*[@ng-click='showSelect()']") | |
39 | + WebElement showSelect; | |
40 | + | |
41 | + //供应商名称查询 | |
42 | + @FindBy (xpath="//*[contains(@ng-click,'keywordTypeChecked(item)') and @value='name']/..") | |
43 | +// @FindBy (xpath="//*[@ng-click='showSelect()']/../ul[1]") | |
44 | + WebElement queryByName; | |
45 | + | |
46 | + //查询输入框 | |
47 | + @FindBy (xpath="//*[@ng-keyup='keyupChecked()']") | |
48 | + WebElement queryKeyword; | |
49 | + | |
50 | + //供应商查询按钮 | |
51 | + @FindBy (xpath="//*[@ng-click='search()']") | |
52 | + WebElement search; | |
53 | + | |
54 | + //查询的第一个结果 | |
55 | + @FindBy (xpath="//*[@id='spTableParams']/tbody/tr[1]") | |
56 | + WebElement firstRestult; | |
57 | + | |
58 | + //供应商选择【确定】 | |
59 | + @FindBy (xpath="//*[text()='确定']") | |
60 | + WebElement sureBotton; | |
61 | + | |
62 | + //品牌名称选框 | |
63 | + @FindBy (xpath="//*[text()='品牌名称']/../div[2]/div/div") | |
64 | + WebElement brandName; | |
65 | + | |
66 | + //品牌选项-第一个品牌 | |
67 | + @FindBy (xpath="//*[@class='msgLayer']/li[1]") | |
68 | + WebElement firstBrand; | |
69 | + | |
70 | + //品牌【确定】 | |
71 | + //与供应商选择的确定按钮元素一样,可直接使用 | |
72 | + | |
73 | + //选择类目 | |
74 | + @FindBy(xpath="//*[text()='主类目']/../../div[1]/div") | |
75 | + WebElement selectCategory; | |
76 | + | |
77 | + //玩具类目一级类目 | |
78 | + @FindBy (xpath="//*[@id='undefined_1_switch']") | |
79 | + WebElement oneLevel; | |
80 | + | |
81 | + //动植物二级类目 | |
82 | + @FindBy (xpath="//*[@id='undefined_7_switch']") | |
83 | + WebElement twoLevel; | |
84 | + | |
85 | + //飞行鸟类三级类目 | |
86 | + @FindBy (xpath="//*[text()='飞行鸟类']") | |
87 | + WebElement threeLevel; | |
88 | + | |
89 | + //[主类目]选择 | |
90 | + @FindBy (xpath="//*[contains(@class,'btn btn-success')]") | |
91 | + WebElement mainCategory; | |
92 | + | |
93 | + | |
94 | + /* | |
95 | + * 商品属性 | |
96 | + */ | |
97 | + //商品属性-功能:第二个-遥控 | |
98 | + @FindBy (xpath="//*[text()='功能']/../div[2]/div[2]") | |
99 | + WebElement secondFunction; | |
100 | + | |
101 | + //商品属性-特殊功能:第二个-声控 | |
102 | + @FindBy (xpath="//*[text()='特殊功能']/../div[2]/div[2]") | |
103 | + WebElement secondSpcialFunction; | |
104 | + | |
105 | + //商品属性-外观造型:第一个-仿真 | |
106 | + @FindBy (xpath="//*[text()='外观造型']/../div[2]/div[1]") | |
107 | + WebElement skin; | |
108 | + | |
109 | + //商品属性-是否带人 | |
110 | + @FindBy (xpath="//*[text()='是否带人']/../div[2]/div[1]") | |
111 | + WebElement withPerson; | |
112 | + | |
113 | + //商品属性-适用年龄:第三个-6-18个月 | |
114 | + @FindBy (xpath="//*[text()='适用年龄']/../div[2]/div[3]") | |
115 | + WebElement forAge; | |
116 | + | |
117 | + /* | |
118 | + * 商品信息 | |
119 | + */ | |
120 | + | |
121 | + //品名选择 | |
122 | + @FindBy (xpath="//*[text()='品名']/../div[2]/div") | |
123 | + WebElement selectLanguage; | |
124 | + | |
125 | + //品名语言-英语 | |
126 | + @FindBy (xpath="//*[@class='msg2']/ul[1]/li[2]") | |
127 | + WebElement english; | |
128 | + | |
129 | + //品名输入框 | |
130 | + @FindBy (xpath="//*[text()='品名']/../div[3]/div/input") | |
131 | + WebElement goodsName; | |
132 | + | |
133 | + //工厂货号输入框 | |
134 | + @FindBy (xpath="//*[@ng-model='model.factoryNo']") | |
135 | + WebElement factoryNo; | |
136 | + | |
137 | + //包装语言 | |
138 | + @FindBy (xpath = "//*[@dic-list='包装语言']/div[1]") | |
139 | + WebElement packageLanguage; | |
140 | + | |
141 | + //自有版权 | |
142 | + @FindBy (xpath="//*[text()='自有版权']") | |
143 | + WebElement ownCopyright; | |
144 | + | |
145 | + //第三方版权 | |
146 | + @FindBy (xpath="//*[text()='第三方版权']") | |
147 | + WebElement thirdCopyright; | |
148 | + | |
149 | + //无授权 | |
150 | + @FindBy (xpath="//*[text()='无版权']") | |
151 | + WebElement noCopyright; | |
152 | + | |
153 | + //A货 | |
154 | + @FindBy (xpath="//*[text()='A货']") | |
155 | + WebElement AGoods; | |
156 | + | |
157 | + //新品保护期 -第三个:7天 | |
158 | + @FindBy (xpath="//*[@dic-list='新品保护期']/div[3]") | |
159 | + WebElement sevenDays; | |
160 | + | |
161 | + /* | |
162 | + * 商品规格 | |
163 | + */ | |
164 | + | |
165 | + //计量单位-第一个:只 | |
166 | + @FindBy (xpath="//*[@dic-list='计量单位']/div[1]") | |
167 | + WebElement countUnit; | |
168 | + | |
169 | + //外箱 | |
170 | + @FindBy (xpath="//*[text()='外箱']") | |
171 | + WebElement outBox; | |
172 | + | |
173 | + //遥控模式 | |
174 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']") | |
175 | + WebElement remoteMode; | |
176 | + | |
177 | + //遥控模式:无线电 | |
178 | + @FindBy (xpath="//*[@placeholder='请选择遥控模式']/../../div[3]/div/span[1]") | |
179 | + WebElement remoteMode2; | |
180 | + | |
181 | + //通道 | |
182 | + @FindBy (xpath="//*[@placeholder='请选择通道']") | |
183 | + WebElement thoroughfare; | |
184 | + | |
185 | + //通道:2通 | |
186 | + @FindBy (xpath="//*[@placeholder='请选择通道']/../../div[3]/div/span[1]") | |
187 | + WebElement thoroughfare2; | |
188 | + | |
189 | + //常规功能 | |
190 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']") | |
191 | + WebElement normalFunction; | |
192 | + | |
193 | + //常规功能:灯光 | |
194 | + @FindBy (xpath="//*[@placeholder='请选择常规功能']/../../div[3]/div/span[2]") | |
195 | + WebElement normalFunction2; | |
196 | + | |
197 | + //是否包电 | |
198 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']") | |
199 | + WebElement isBattery; | |
200 | + | |
201 | + //是否包电:包电 | |
202 | + @FindBy (xpath="//*[@placeholder='请选择是否包电']/../../div[3]/div/span[2]") | |
203 | + WebElement isBattery2; | |
204 | + | |
205 | + //是否可充电 | |
206 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']") | |
207 | + WebElement isCharge; | |
208 | + | |
209 | + //是否可充电:可充电 | |
210 | + @FindBy (xpath="//*[@placeholder='请选择是否可充电']/../../div[3]/div/span[1]") | |
211 | + WebElement isCharge2; | |
212 | + | |
213 | + //配件 | |
214 | + @FindBy (xpath="//*[@placeholder='请选择配件']") | |
215 | + WebElement parts; | |
216 | + | |
217 | + //配件:无 | |
218 | + @FindBy (xpath="//*[@placeholder='请选择配件']/../../div[3]/div/span[1]") | |
219 | + WebElement parts2; | |
220 | + | |
221 | + //包装图案 | |
222 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']") | |
223 | + WebElement pattern; | |
224 | + | |
225 | + //包装图案:无 | |
226 | + @FindBy (xpath="//*[@placeholder='请选择包装图案']/../../div[3]/div/span[1]") | |
227 | + WebElement pattern2; | |
228 | + | |
229 | + //单品或套装 | |
230 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']") | |
231 | + WebElement suit; | |
232 | + | |
233 | + //单品或套装:单品 | |
234 | + @FindBy (xpath="//*[@placeholder='请选择单品或套装']/../../div[3]/div/span[1]") | |
235 | + WebElement suit2; | |
236 | + | |
237 | + //局部工艺 | |
238 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']") | |
239 | + WebElement localProcess; | |
240 | + | |
241 | + //局部工艺:无 | |
242 | + @FindBy (xpath="//*[@placeholder='请选择局部工艺']/../../div[3]/div/span[1]") | |
243 | + WebElement localProcess2; | |
244 | + | |
245 | + //颜色 | |
246 | + @FindBy (xpath="//*[@placeholder='请选择颜色']") | |
247 | + WebElement color; | |
248 | + | |
249 | + //颜色 | |
250 | + @FindBy (xpath="//*[@placeholder='请选择颜色']/../../div[3]/div/span[1]") | |
251 | + WebElement color2; | |
252 | + | |
253 | + //装量 | |
254 | + @FindBy (xpath="//*[@placeholder='请选择装量']") | |
255 | + WebElement count; | |
256 | + | |
257 | + //装量:9 装量的具体值 | |
258 | + @FindBy (xpath="//*[@placeholder='请选择装量']/../../div[3]/div/span[2]") | |
259 | + WebElement count2; | |
260 | + | |
261 | + //包装类型 | |
262 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']") | |
263 | + WebElement packingType; | |
264 | + | |
265 | + //包装类型:OPP袋 | |
266 | + @FindBy (xpath="//*[@placeholder='请选择包装类型']/../../div[3]/div/span[1]") | |
267 | + WebElement packingType2; | |
268 | + | |
269 | + //包装方式 | |
270 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']") | |
271 | + WebElement packingWay; | |
272 | + | |
273 | + //包装方式:OPP袋 | |
274 | + @FindBy (xpath="//*[@placeholder='请选择包装方式']/../../div[3]/div/span[1]") | |
275 | + WebElement packingWay2; | |
276 | + | |
277 | + //“+”sku按钮 | |
278 | + @FindBy (xpath="//*[@class='addSku']") | |
279 | + WebElement addSku; | |
280 | + | |
281 | + //计数数量 | |
282 | + @FindBy (xpath="//*[@title='计数数量']/div/input") | |
283 | + WebElement skuItemCount; | |
284 | + | |
285 | + //销售MOQ | |
286 | + @FindBy (xpath="//*[@title='销售MOQ']/div/input") | |
287 | + WebElement saleMOQ; | |
288 | + | |
289 | + //供货周期 | |
290 | + @FindBy (xpath="//*[@title='供货周期']/div/input") | |
291 | + WebElement supplyTime; | |
292 | + | |
293 | + //供应商报价 | |
294 | + @FindBy (xpath="//*[@placeholder='单品价格']") | |
295 | + WebElement suppliPrice; | |
296 | + | |
297 | + //横向滚动条1 | |
298 | + @FindBy (xpath="//*[@id='customScroll']") | |
299 | + WebElement widthScroll1; | |
300 | + | |
301 | +// //横向滚动条2,滚动条与内容一起,无法拖动 | |
302 | +// @FindBy (xpath="//*[contains(@id,'table-single-goods-sku')]/..") | |
303 | +// WebElement widthScroll2; | |
304 | + | |
305 | + //商品体积-长 | |
306 | + @FindBy (xpath = "//td[@title='商品尺寸(cm)']//input[@placeholder='长']") | |
307 | + WebElement goodsLong; | |
308 | + | |
309 | + //商品体积-宽 | |
310 | + @FindBy (xpath = "//td[@title='商品尺寸(cm)']//input[@placeholder='宽']") | |
311 | + WebElement goodsWidth; | |
312 | + | |
313 | + //商品体积-高 | |
314 | + @FindBy (xpath = "//td[@title='商品尺寸(cm)']//input[@placeholder='高']") | |
315 | + WebElement goodsHigh; | |
316 | + | |
317 | + // 包装体积-长 | |
318 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='长']") | |
319 | + WebElement packeLong; | |
320 | + | |
321 | + // 包装体积-宽 | |
322 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='宽']") | |
323 | + WebElement packeWidth; | |
324 | + | |
325 | + // 包装体积-高 | |
326 | + @FindBy (xpath = "//td[@title='包装尺寸(cm)']//input[@placeholder='高']") | |
327 | + WebElement packeHigh; | |
328 | + | |
329 | + //外箱体积-长 | |
330 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[2]/input") | |
331 | + WebElement packageLong; | |
332 | + | |
333 | + //外箱体积-宽 | |
334 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[3]/input") | |
335 | + WebElement packageWidth; | |
336 | + | |
337 | + //外箱体积-高 | |
338 | + @FindBy (xpath="//*[@title='外箱体积(cm)']/div[4]/input") | |
339 | + WebElement packageHigh; | |
340 | + | |
341 | + //毛重 | |
342 | + @FindBy (xpath="//*[@title='毛重']/div/input") | |
343 | + WebElement grossWeight; | |
344 | + | |
345 | + //净重 | |
346 | + @FindBy (xpath="//*[@title='净重']/div/input") | |
347 | + WebElement netWeight; | |
348 | + | |
349 | + //保存 | |
350 | + @FindBy (xpath="//*[text()='保存']") | |
351 | + WebElement save; | |
352 | + | |
353 | + //提示 | |
354 | + @FindBy(xpath="//*[text()='原厂商品保存成功']") | |
355 | + WebElement succeedMessage; | |
356 | + | |
357 | + /* | |
358 | + * 以下为页面方法 | |
359 | + */ | |
360 | + | |
361 | + /** | |
362 | + * 选择供应商 | |
363 | + * @param | |
364 | + * @throws InterruptedException | |
365 | + */ | |
366 | + public void selectSupplier(String supplierName){ | |
367 | + forceWait(2000); | |
368 | + dynamicWait(By.xpath("//*[@ng-click='supplier()']")); | |
369 | + click(selectSupplier); | |
370 | + click(showSelect); | |
371 | + click(queryByName); | |
372 | + sendKeys(queryKeyword,supplierName); | |
373 | + click(search); | |
374 | + forceWait(1000); | |
375 | + dynamicWait(By.xpath("//*[@id='spTableParams']/tbody/tr[1]")); | |
376 | + click(firstRestult); | |
377 | + click(sureBotton); | |
378 | + } | |
379 | + | |
380 | + /** | |
381 | + * 选择品牌 | |
382 | + */ | |
383 | + public void selectBrand() { | |
384 | + forceWait(1000); | |
385 | + click(brandName); | |
386 | + dynamicWait(By.xpath("//*[@class='msgLayer']/li[1]")); | |
387 | + click(firstBrand); | |
388 | + click(sureBotton); | |
389 | + } | |
390 | + | |
391 | + /** | |
392 | + * 选择主类目 | |
393 | + * 注意:这里只能用js点击事件才能展开那个“+” | |
394 | + * @throws InterruptedException | |
395 | + */ | |
396 | + public void selectCategory(){ | |
397 | + forceWait(1000); | |
398 | + mywait(selectCategory); | |
399 | + click(selectCategory); | |
400 | + jsExecutorClick(oneLevel); | |
401 | + jsExecutorClick(twoLevel); | |
402 | + jsExecutorClick(threeLevel); | |
403 | + jsExecutorClick(mainCategory); | |
404 | + click(sureBotton); | |
405 | + } | |
406 | + | |
407 | + /** | |
408 | + * 配置商品属性 | |
409 | + */ | |
410 | + public void goodsProperty() { | |
411 | + mywait(secondFunction); | |
412 | + click(secondFunction); | |
413 | + click(secondSpcialFunction); | |
414 | + click(skin); | |
415 | + click(withPerson); | |
416 | + click(forAge); | |
417 | + } | |
418 | + | |
419 | + /** | |
420 | + * 配置商品信息 | |
421 | + */ | |
422 | + public void goodsInfo() { | |
423 | + skuNameNo = Tools.getCurrentTime(); | |
424 | + //挪动滚动条,否则查找不到元素 | |
425 | + moveHeightScroll("40"); | |
426 | + sendKeys(goodsName, "原厂"+skuNameNo); | |
427 | + click(selectLanguage); | |
428 | + click(english); | |
429 | + sendKeys(goodsName, "Original"+skuNameNo); | |
430 | + sendKeys(factoryNo, Tools.getFactoryNo()); | |
431 | + click(packageLanguage); | |
432 | + click(ownCopyright); | |
433 | + click(sevenDays); | |
434 | + } | |
435 | + | |
436 | + /** | |
437 | + * 选择sku属性,并提交 | |
438 | + * @return 商品发布页 | |
439 | + */ | |
440 | + public GoodsRelesePage goodsSpecifications() { | |
441 | + moveHeightScroll("65"); | |
442 | + click(countUnit); | |
443 | + click(outBox); | |
444 | + click(remoteMode); | |
445 | + click(remoteMode2); | |
446 | + click(thoroughfare); | |
447 | + click(thoroughfare2); | |
448 | + click(normalFunction); | |
449 | + click(normalFunction2); | |
450 | + click(isBattery); | |
451 | + click(isBattery2); | |
452 | + click(isCharge); | |
453 | + click(isCharge2); | |
454 | + click(parts); | |
455 | + click(parts2); | |
456 | + click(pattern); | |
457 | + click(pattern2); | |
458 | + click(suit); | |
459 | + click(suit2); | |
460 | + click(localProcess); | |
461 | + click(localProcess2); | |
462 | + click(color); | |
463 | + click(color2); | |
464 | + click(count); | |
465 | + click(count2); | |
466 | + click(packingType); | |
467 | + click(packingType2); | |
468 | + click(packingWay); | |
469 | + click(packingWay2); | |
470 | + click(addSku); | |
471 | + | |
472 | + sendKeys(skuItemCount, "10"); | |
473 | + sendKeys(saleMOQ, "10"); | |
474 | + sendKeys(supplyTime, "3"); | |
475 | + | |
476 | + //供应商报价,随机生成一个1-200的价格 | |
477 | + int sp = (int)(1+Math.random()*200); | |
478 | + sendKeys(suppliPrice, sp+""); | |
479 | + | |
480 | + jsExecutorDragAndDrop(widthScroll1,2000,0); | |
481 | + mywait(packageLong); | |
482 | + | |
483 | + //商品尺寸 | |
484 | + sendKeys(goodsLong,"10"); | |
485 | + sendKeys(goodsWidth,"15"); | |
486 | + sendKeys(goodsHigh,"20"); | |
487 | + | |
488 | + //包装尺寸 | |
489 | + sendKeys(packeLong,"10"); | |
490 | + sendKeys(packeWidth,"18"); | |
491 | + sendKeys(packeHigh,"25"); | |
492 | + | |
493 | + //外箱体积 | |
494 | + sendKeys(packageLong, "100"); | |
495 | + sendKeys(packageWidth, "50"); | |
496 | + sendKeys(packageHigh, "40"); | |
497 | + //毛重,净重 | |
498 | + sendKeys(grossWeight, "1.5"); | |
499 | + sendKeys(netWeight, "1.2"); | |
500 | + | |
501 | + click(save); | |
502 | + return new GoodsRelesePage(driver); | |
503 | + } | |
504 | + | |
505 | + /** | |
506 | + * 原厂商品建档,将上面的方法整合 | |
507 | + * @param | |
508 | + * @return | |
509 | + * @throws InterruptedException | |
510 | + */ | |
511 | + public GoodsRelesePage addOriginalGoods() { | |
512 | + selectSupplier(supplierName); | |
513 | + selectBrand(); | |
514 | + selectCategory(); | |
515 | + goodsProperty(); | |
516 | + goodsInfo(); | |
517 | + goodsSpecifications(); | |
518 | + return new GoodsRelesePage(driver); | |
519 | + } | |
520 | + /** | |
521 | + *开发商品建档保存 | |
522 | + * @param | |
523 | + * @return 项目立项书列表 | |
524 | + */ | |
525 | + public ProjectListPage addDevGood(){ | |
526 | + forceWait(4000);//页面会刷几次,只能强制等待 | |
527 | + moveHeightScroll("0"); | |
528 | + forceWait(1000); | |
529 | + click(save); | |
530 | + forceWait(1000); | |
531 | + if(isVisibility(By.xpath("//*[text()='确定']"))){ | |
532 | + click(confrim); | |
533 | + } | |
534 | + dynamicLoad(); | |
535 | + return new ProjectListPage(driver); | |
536 | + } | |
537 | + | |
538 | + /** | |
539 | + * 用于断言是否商品建档成功 | |
540 | + * @return boolean | |
541 | + */ | |
542 | + public boolean isSucceed() { | |
543 | + return isElementExist(succeedMessage); | |
544 | + } | |
545 | + | |
546 | + /** | |
547 | + * 返回商品名称后面的那串数字 | |
548 | + * @return | |
549 | + */ | |
550 | + public static String getSkuNameNo() { | |
551 | + return skuNameNo; | |
552 | + } | |
553 | + | |
554 | + /** | |
555 | + * 通过GUI设置供应商名称 | |
556 | + * @param suppliername | |
557 | + */ | |
558 | + public static void setSupplierName(String suppliername) { | |
559 | + supplierName = suppliername; | |
560 | + } | |
561 | +} | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/AuditDevGoodsPage.java
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +package com.essa.pageObject.GoodsManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
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 | +public class AuditDevGoodsPage extends BasePage { | |
11 | + /** | |
12 | + * 构造方法 | |
13 | + * | |
14 | + * @param driver | |
15 | + */ | |
16 | + public AuditDevGoodsPage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | + /** | |
20 | + * 元素定位 | |
21 | + */ | |
22 | + @FindBy (xpath = "//*[@ng-model='query.skuCode']") | |
23 | + WebElement skuNo;//sku编号 | |
24 | + | |
25 | + @FindBy (xpath = "//*[text()='查询']") | |
26 | + WebElement search;//查询按钮 | |
27 | + | |
28 | + @FindBy (xpath = "//*[@ng-change='getCheckedStatus();']") | |
29 | + WebElement checkbox;//复选框 | |
30 | + | |
31 | + @FindBy (xpath = "//*[text()='审核']") | |
32 | + WebElement audit;//审核 | |
33 | + | |
34 | + /** | |
35 | + * 页面方法 | |
36 | + */ | |
37 | + /** | |
38 | + *跳转到审核页面,这里开发商品共用的原厂商品的审核页面 | |
39 | + * @param | |
40 | + * @return 原厂商品审核页面 | |
41 | + */ | |
42 | + public AuditOriginalOpreatePage auditDevGood(){ | |
43 | +// dynamicLoad(); | |
44 | + dynamicWait(By.xpath("//table[@class='table border-default margin-bottom-80 ng-scope ng-table']//tbody[1]")); | |
45 | + sendKeys(skuNo, Model.getSkuNo()); | |
46 | + click(search); | |
47 | + forceWait(1000); | |
48 | + click(checkbox); | |
49 | + click(audit); | |
50 | + return new AuditOriginalOpreatePage(driver); | |
51 | + } | |
52 | +} | ... | ... |
src/test/java/com/essa/pageObject/GoodsManage/AuditMarketGoodsPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AuditMarketGoodsPage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/AuditMarketOpreatePage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AuditMarketOpreatePage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/AuditOriginalGoodsPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AuditOriginalGoodsPage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/AuditOriginalOpreatePage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/AuditOriginalOpreatePage.java
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 | -} | |
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 AuditOriginalOpreatePage extends BasePage { | |
15 | + public AuditOriginalOpreatePage(WebDriver driver) { | |
16 | + super(driver); | |
17 | + } | |
18 | + /* | |
19 | + * 元素定位 | |
20 | + */ | |
21 | + | |
22 | + //审核通过 | |
23 | + @FindBy(xpath="//*[text()='审核通过']") | |
24 | + WebElement pass; | |
25 | + | |
26 | + //审核通过提示语 | |
27 | + @FindBy(xpath="//*[text()='商品审核已通过'") | |
28 | + WebElement succeedMessage; | |
29 | + | |
30 | + //定价销售 | |
31 | + @FindBy (xpath = "//*[@ng-model='skuItem.isFixedSale']") | |
32 | + WebElement isFixedSale; | |
33 | + | |
34 | + //毛利率 | |
35 | + @FindBy (xpath = "//*[@ng-model='skuItem.grossProfit2']") | |
36 | + WebElement grossProfit; | |
37 | + | |
38 | + //工厂货号重复时,确定按钮 | |
39 | + @FindBy (xpath = "//*[text()='确定']") | |
40 | + WebElement confirm; | |
41 | + | |
42 | + /* | |
43 | + * 页面方法 | |
44 | + */ | |
45 | + | |
46 | + /** | |
47 | + * 挪动滚动条至底部,点击审核通过 | |
48 | + * @return AuditOriginalGoodsPage | |
49 | + */ | |
50 | + public AuditOriginalGoodsPage auditPass() { | |
51 | + forceWait(2000); | |
52 | + moveHeightScroll("0"); | |
53 | + click(pass); | |
54 | + forceWait(500); | |
55 | + if (isVisibility(By.xpath("//*[text()='确定']"))) | |
56 | + click(confirm); | |
57 | + return new AuditOriginalGoodsPage(driver); | |
58 | + } | |
59 | + /** | |
60 | + *开发商品审核通过,要设置毛利率 | |
61 | + * @param | |
62 | + * @return AuditOriginalGoodsPage | |
63 | + */ | |
64 | + public AuditOriginalGoodsPage auditDevGoodPass(){ | |
65 | + forceWait(2000); | |
66 | + moveHeightScroll("50"); | |
67 | + selectElement(isFixedSale,"否"); | |
68 | + sendKeys(grossProfit,"5"); | |
69 | + moveHeightScroll("0"); | |
70 | + click(pass); | |
71 | + forceWait(500); | |
72 | + if (isVisibility(By.xpath("//*[text()='确定']"))) | |
73 | + click(confirm); | |
74 | + return new AuditOriginalGoodsPage(driver); | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * 用于断言商品审核是否通过 | |
79 | + * @return boolean | |
80 | + */ | |
81 | + public boolean isSucceed() { | |
82 | + return isElementExist(succeedMessage); | |
83 | + } | |
84 | + | |
85 | +} | ... | ... |
src/test/java/com/essa/pageObject/GoodsManage/EditSpuPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/EditSpuPage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/GoodsBankPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/GoodsBankPage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/GoodsRelesePage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/GoodsRelesePage.java
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 | -} | |
1 | +package com.essa.pageObject.GoodsManage; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import org.openqa.selenium.By; | |
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 | + | |
11 | +/** | |
12 | + * @author Administrator | |
13 | + *商品发布管理 | |
14 | + */ | |
15 | +public class GoodsRelesePage extends BasePage { | |
16 | + public GoodsRelesePage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | + /* | |
20 | + * 元素定位 | |
21 | + */ | |
22 | + | |
23 | + //商品发布--检查点 | |
24 | + @FindBy(xpath="//*[text()='商品发布']") | |
25 | + WebElement checkPoint; | |
26 | + | |
27 | + /* | |
28 | + //勾选第1个复选框--后续最好根据商品名称来定位勾选框 | |
29 | + @FindBy(xpath="//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input") | |
30 | + WebElement checkBox; | |
31 | + */ | |
32 | + | |
33 | + /** | |
34 | + * 根据商品名称获得其复选框 | |
35 | + * @return | |
36 | + */ | |
37 | + private WebElement getCheckBox() { | |
38 | + String no = AddOriginalGoodsPage.getSkuNameNo(); | |
39 | + return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]/../../td[1]/input")); | |
40 | + } | |
41 | + | |
42 | + @FindBy (xpath = "//*[@ng-model='query.keyword']") | |
43 | + WebElement keyword;//关键字 | |
44 | + | |
45 | + @FindBy (xpath = "//*[@ng-click='search()']") | |
46 | + WebElement search;//查询按钮 | |
47 | + | |
48 | + @FindBy (xpath = "//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input") | |
49 | + WebElement checkbox;//第一个复选框 | |
50 | + | |
51 | + //图片更新 | |
52 | + @FindBy(xpath="//*[contains(text(),'图片更新')]") | |
53 | + WebElement updatePic; | |
54 | + | |
55 | + //编辑 | |
56 | + @FindBy(xpath="//*[contains(text(),'编辑')]") | |
57 | + WebElement edit; | |
58 | + | |
59 | + /* | |
60 | + * 页面方法 | |
61 | + */ | |
62 | + | |
63 | + /** | |
64 | + * 进入更新图片页面 | |
65 | + * @return UpdatePicPage | |
66 | + */ | |
67 | + public UpdatePicPage toUpDatePic() { | |
68 | + forceWait(2000); | |
69 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | |
70 | + click(getCheckBox()); | |
71 | + click(updatePic); | |
72 | + return new UpdatePicPage(driver); | |
73 | + } | |
74 | + | |
75 | + /** | |
76 | + * 进入编辑页面 | |
77 | + * @return EditSpuPage | |
78 | + * @throws InterruptedException | |
79 | + */ | |
80 | + public EditSpuPage toEditSpuPage() { | |
81 | + isThisPage("商品发布", checkPoint); | |
82 | + click(getCheckBox()); | |
83 | + click(edit); | |
84 | + return new EditSpuPage(driver); | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + *开发商品更新图片 | |
89 | + * @param | |
90 | + * @return 更新图片详情页 | |
91 | + */ | |
92 | + public UpdatePicPage toUpdateDevGoodPic(){ | |
93 | + forceWait(2000); | |
94 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | |
95 | + sendKeys(keyword,Model.getSkuNo()); | |
96 | + click(search); | |
97 | + forceWait(1500); | |
98 | + click(checkbox); | |
99 | + click(updatePic); | |
100 | + return new UpdatePicPage(driver); | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * 断言商品建档是否成功 | |
105 | + * @return boolean | |
106 | + */ | |
107 | + public boolean isAddOrignalSucceed() { | |
108 | + forceWait(1000); | |
109 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | |
110 | + String SkuNameNo = AddOriginalGoodsPage.getSkuNameNo(); | |
111 | + //由于@findby只能输入常量,不能输入变量,所以这里用最底层的方法来寻找元素 | |
112 | + return isVisibility((driver.findElement(By.xpath("//*[contains(text(),'"+SkuNameNo+"')]")))); | |
113 | + } | |
114 | +} | ... | ... |
src/test/java/com/essa/pageObject/GoodsManage/MarketGoodsRelesePage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/MarketGoodsRelesePage.java
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 | -} | |
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/test/java/com/essa/pageObject/GoodsManage/UpdatePicPage.java renamed to src/main/java/com/essa/pageObject/GoodsManage/UpdatePicPage.java
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 | -} | |
1 | +package com.essa.pageObject.GoodsManage; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import org.openqa.selenium.By; | |
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 | + | |
11 | +/** | |
12 | + * @author Administrator | |
13 | + *更新图片 | |
14 | + */ | |
15 | +public class UpdatePicPage extends BasePage { | |
16 | + public UpdatePicPage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | +// public static String picPath; | |
20 | + | |
21 | + /* | |
22 | + * 元素定位 | |
23 | + */ | |
24 | + | |
25 | + //检查点 | |
26 | + @FindBy(xpath="//*[text()='SPU信息']") | |
27 | + WebElement checkPoint; | |
28 | + | |
29 | + //spu上传图片按钮 | |
30 | + @FindBy(xpath="//*[@id='spuWrapper']/div[3]/div[2]") | |
31 | + WebElement spuUploadPic; | |
32 | + | |
33 | + //spu的主图 | |
34 | + @FindBy(xpath="//*[@class='load-pic']") | |
35 | + WebElement spuPic; | |
36 | + | |
37 | + //sku上传图片按钮 | |
38 | + @FindBy(xpath="//*[@id='skuWrapper']/div/div/div[1]/div[2]") | |
39 | + WebElement skuUploadPic; | |
40 | + | |
41 | + //SKU图片上的X | |
42 | + @FindBy(xpath="//*[contains(@ng-click,'picInfo,')]") | |
43 | + WebElement skuPic; | |
44 | + | |
45 | + //保存按钮 | |
46 | + @FindBy(xpath="//*[text()='保存']") | |
47 | + WebElement save; | |
48 | + | |
49 | + //保存成功提示 | |
50 | + @FindBy(xpath="保存成功") | |
51 | + WebElement succeedMessage; | |
52 | + | |
53 | + /* | |
54 | + * 以下为页面方法 | |
55 | + */ | |
56 | + | |
57 | + /** | |
58 | + * 更新商品图片 | |
59 | + * @param picPath 作为商品图片的本机地址 | |
60 | + * @return GoodsRelesePage | |
61 | + */ | |
62 | + public GoodsRelesePage upDatePic() { | |
63 | + forceWait(2000); | |
64 | + dynamicWait(By.xpath("//*[text()='SPU信息']")); | |
65 | + click(spuUploadPic); | |
66 | +// uploadFile(picPath); | |
67 | + uploadFile(Model.getPicPath()); | |
68 | + dynamicWait(By.xpath("//*[@class='load-pic']")); | |
69 | + click(skuUploadPic); | |
70 | +// uploadFile(picPath); | |
71 | + uploadFile(Model.getPicPath()); | |
72 | + dynamicWait(By.xpath("//*[contains(@ng-click,'picInfo,')]")); | |
73 | + forceWait(1000); | |
74 | + click(save); | |
75 | + return new GoodsRelesePage(driver); | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * 断言更新图片是否成功 | |
80 | + * @return | |
81 | + */ | |
82 | + public boolean isSucceed() { | |
83 | + return isElementExist(succeedMessage); | |
84 | + } | |
85 | + | |
86 | +// /** | |
87 | +// * 通过GUI设置本机图片路径 | |
88 | +// * @param picpath | |
89 | +// */ | |
90 | +// public static void setPicPath(String picpath) { | |
91 | +// picPath = picpath; | |
92 | +// } | |
93 | +} | ... | ... |
src/test/java/com/essa/pageObject/HomePage.java renamed to src/main/java/com/essa/pageObject/HomePage.java
1 | 1 | package com.essa.pageObject; |
2 | 2 | |
3 | -import org.openqa.selenium.WebDriver; | |
3 | +import com.essa.pageObject.DocumentaryManage.BillingCenterPage; | |
4 | +import com.essa.pageObject.DocumentaryManage.ReceiptCorePage; | |
5 | +import com.essa.pageObject.GoodsManage.*; | |
6 | +import com.essa.pageObject.LogisticShipp.LogisticsShippPage; | |
7 | +import org.openqa.selenium.By; | |
8 | +import com.essa.pageObject.SupplierManage.SupplierOperationsTrackPage; | |
9 | +import com.essa.pageObject.productDev.AddMatterialPage; | |
10 | +import com.essa.pageObject.productDev.AddProjectPage; | |
11 | +import com.essa.pageObject.productDev.ProjectListPage; | |
12 | +import org.openqa.selenium.WebDriver; | |
4 | 13 | import org.openqa.selenium.WebElement; |
5 | 14 | import org.openqa.selenium.support.FindBy; |
6 | 15 | import com.essa.framework.BasePage; |
7 | 16 | 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; | |
17 | +import com.essa.pageObject.DocumentaryManage.PODocumentaryListPage; | |
18 | +import com.essa.pageObject.StorageManage.GoodsReceiveTaskPage; | |
19 | +import com.essa.pageObject.StorageManage.NoticeReceivePage; | |
14 | 20 | import com.essa.pageObject.buyPlaneManage.SkuCategoryManagerCongfigPage; |
15 | 21 | import com.essa.pageObject.buyerManage.InvateCodePage; |
16 | 22 | import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage; |
17 | 23 | import com.essa.pageObject.marketingManage.GroupControlPage; |
18 | 24 | import com.essa.pageObject.marketingManage.GroupSettingPage; |
19 | -import com.essa.pageObject.needDealt.NeedDealtApplyPage; | |
20 | - | |
25 | +import com.essa.pageObject.needDealt.NeedDealtApplyPage; | |
26 | +import com.essa.pageObject.StorageManage.CabineTaskManagemenPage; | |
27 | + | |
21 | 28 | /** |
22 | 29 | * @author Administrator |
23 | 30 | *bpms后台首页 |
... | ... | @@ -54,6 +61,9 @@ public class HomePage extends BasePage{ |
54 | 61 | //商品管理 |
55 | 62 | @FindBy (xpath="//*[text()='商品管理']") |
56 | 63 | WebElement goodsManage; |
64 | + | |
65 | + @FindBy (xpath = "//*[text()='开发商品发布审核']") | |
66 | + WebElement DevGoodAudit;//开发商品发布审核 | |
57 | 67 | |
58 | 68 | //商品库 |
59 | 69 | @FindBy (xpath="//*[text()='商品库']") |
... | ... | @@ -131,6 +141,10 @@ public class HomePage extends BasePage{ |
131 | 141 | @FindBy (xpath = "//*[@title='采购计划审核流程']") |
132 | 142 | WebElement purchasePlaneProcess; |
133 | 143 | |
144 | + //待办中的“船务确认备选船期流程” | |
145 | + @FindBy (xpath = "//*[text()='船务确认备选船期流程']") | |
146 | + WebElement confirmDailingDate; | |
147 | + | |
134 | 148 | //第一条待办 |
135 | 149 | @FindBy (xpath = "//*[@ng-table='tableParams']/tbody/tr[1]") |
136 | 150 | WebElement firstNeedDealt; |
... | ... | @@ -143,6 +157,63 @@ public class HomePage extends BasePage{ |
143 | 157 | @FindBy (xpath = "//*[@name='searchForm']/div/span/button") |
144 | 158 | WebElement search; |
145 | 159 | |
160 | + //跟单管理 | |
161 | + @FindBy (xpath = "//*[text()='跟单管理']") | |
162 | + WebElement DocumentaryManage; | |
163 | + | |
164 | + //PO跟单 | |
165 | + @FindBy (xpath ="//*[text()='PO跟单']") | |
166 | + WebElement PODocumentary; | |
167 | + | |
168 | + //前台发单中心 | |
169 | + @FindBy (xpath ="//*[text()='前台发单中心']") | |
170 | + WebElement Receipt_core ; | |
171 | + | |
172 | + //仓储管理 | |
173 | + @FindBy (xpath = "//span[contains(text(),'仓储管理')]") | |
174 | + WebElement StorageManage; | |
175 | + | |
176 | + //收货通知 | |
177 | + @FindBy (xpath = "//a[@name='child.text'][contains(text(),'收货通知')]") | |
178 | + WebElement NoticeReceive; | |
179 | + | |
180 | + //收货任务管理 | |
181 | + @FindBy (xpath = "//a[contains(text(),'收货任务管理')]") | |
182 | + WebElement goodsReceiveTask; | |
183 | + | |
184 | + | |
185 | + //物料新增 | |
186 | + @FindBy (xpath = "//*[text()='物料新增']") | |
187 | + WebElement addMaterial; | |
188 | + | |
189 | + //装柜任务管理 | |
190 | + @FindBy (xpath = "//a[@name='child.text'][contains(text(),'装柜任务管理')]") | |
191 | + WebElement loadContainerTask; | |
192 | + | |
193 | + //前台发单中心 | |
194 | + @FindBy (xpath = "//*[text()='前台发单中心']") | |
195 | + WebElement billingCenter; | |
196 | + | |
197 | + | |
198 | + //物流船务 | |
199 | + @FindBy (xpath = "//*[text()='物流船务']") | |
200 | + WebElement LogisticsskippBoard; | |
201 | + | |
202 | + //船务看板 | |
203 | + @FindBy (xpath = "//*[text()='船务看板']") | |
204 | + WebElement skippBoard; | |
205 | + | |
206 | + //装柜通知(lana) | |
207 | + @FindBy (xpath = "//a[@name='child.text'][contains(text(),'装柜通知')]") | |
208 | + WebElement CabinetsNotice; | |
209 | + | |
210 | + //装柜务务管理(lana) | |
211 | + @FindBy (xpath = "//a[contains(text(),'装柜任务管理')]") | |
212 | + WebElement CabineTaskManagemen; | |
213 | + | |
214 | + | |
215 | + | |
216 | + | |
146 | 217 | /* |
147 | 218 | * 方法 |
148 | 219 | */ |
... | ... | @@ -180,6 +251,7 @@ public class HomePage extends BasePage{ |
180 | 251 | * @return GoodsRelesePage |
181 | 252 | */ |
182 | 253 | public GoodsRelesePage tGoodsRelesePage() { |
254 | + getHome(); | |
183 | 255 | click(goodsManage); |
184 | 256 | click(goodsPublish); |
185 | 257 | return new GoodsRelesePage(driver); |
... | ... | @@ -344,4 +416,176 @@ public class HomePage extends BasePage{ |
344 | 416 | switchMoreWindow(); |
345 | 417 | return new NeedDealtApplyPage(driver); |
346 | 418 | } |
347 | -} | |
348 | 419 | \ No newline at end of file |
420 | + | |
421 | + /** | |
422 | + * 进入PO跟单列表页 | |
423 | + * @return PO跟单列表页 | |
424 | + */ | |
425 | + public PODocumentaryListPage toPoDocumentaryListPage() { | |
426 | + getHome(); | |
427 | + click(DocumentaryManage); | |
428 | + click(PODocumentary); | |
429 | + return new PODocumentaryListPage(driver); | |
430 | + } | |
431 | + | |
432 | + /** | |
433 | + * 进入收货通知页面 | |
434 | + * @return 收货通知页面 | |
435 | + */ | |
436 | + public NoticeReceivePage toNoticeReceivePage() { | |
437 | + click(StorageManage); | |
438 | + click(NoticeReceive); | |
439 | + return new NoticeReceivePage(driver); | |
440 | + } | |
441 | + | |
442 | + /** | |
443 | + * 进入收货任务管理 | |
444 | + * @return 收货任务管理页面 | |
445 | + */ | |
446 | + public GoodsReceiveTaskPage toGoodsReceiveTaskPage() { | |
447 | + getHome(); | |
448 | + click(StorageManage); | |
449 | + click(goodsReceiveTask); | |
450 | + return new GoodsReceiveTaskPage(driver); | |
451 | + } | |
452 | + /** | |
453 | + * 大跟单进入第一个需要确认备选船期的待办页面 | |
454 | + * @return 确认船期页面 | |
455 | + */ | |
456 | + public NeedDealtApplyPage toSailingDateConfirmPage() { | |
457 | + click(confirmDailingDate); | |
458 | + forceWait(1000); | |
459 | + click(firstNeedDealt); | |
460 | + switchMoreWindow(); | |
461 | + return new NeedDealtApplyPage(driver); | |
462 | + } | |
463 | + | |
464 | + /** | |
465 | + * 进入装柜任务处理管理页面 | |
466 | + * @return 返回装柜任务处理管理页面 | |
467 | + */ | |
468 | + public NeedDealtApplyPage toLoadContainer(){ | |
469 | + getHome(); | |
470 | + click(StorageManage); | |
471 | + click(loadContainerTask); | |
472 | + dynamicWait(By.xpath("//div[@class='loading ng-scope']")); | |
473 | +// forceWait(3000); | |
474 | + return new NeedDealtApplyPage(driver); | |
475 | + } | |
476 | + | |
477 | + /** | |
478 | + * 登记备选船期待办 | |
479 | + * @return 进入登记船务船期待办详情页面 | |
480 | + */ | |
481 | + public NeedDealtApplyPage toShippingMarkWait(){ | |
482 | + mywait(firstNeedDealt); | |
483 | + sendKeys(searchText,Model.getSerialNum()); | |
484 | + click(search); | |
485 | + forceWait(1000); | |
486 | + mywait(firstNeedDealt); | |
487 | + click(firstNeedDealt); | |
488 | + switchMoreWindow(); | |
489 | + return new NeedDealtApplyPage(driver); | |
490 | + } | |
491 | + | |
492 | + /* | |
493 | + * 进入前台发单中心页面 | |
494 | + * */ | |
495 | + public ReceiptCorePage toReceiptCore() { | |
496 | + click(DocumentaryManage); | |
497 | + click(Receipt_core); | |
498 | + return new ReceiptCorePage (driver); | |
499 | + } | |
500 | + /** | |
501 | + *进入开发商品发布审核 | |
502 | + * @param | |
503 | + * @return 开发商品发布审核 | |
504 | + */ | |
505 | + public AuditDevGoodsPage toAuditDevgoodsPage(){ | |
506 | + click(goodsManage); | |
507 | + click(DevGoodAudit); | |
508 | + return new AuditDevGoodsPage(driver); | |
509 | + } | |
510 | + /** | |
511 | + *进入项目立项书新增页面 | |
512 | + * @param | |
513 | + * @return 项目立项书新增 | |
514 | + */ | |
515 | + public AddProjectPage toAddProject(){ | |
516 | + click(productDev); | |
517 | + click(addProject); | |
518 | + return new AddProjectPage(driver); | |
519 | + } | |
520 | + /** | |
521 | + *进入物料新增页面 | |
522 | + * @param | |
523 | + * @return 物料新增页面 | |
524 | + */ | |
525 | + public AddMatterialPage toMaterialPage(){ | |
526 | + click(productDev); | |
527 | + click(addMaterial); | |
528 | + return new AddMatterialPage(driver); | |
529 | + } | |
530 | + /** | |
531 | + *进入项目立项书列表 | |
532 | + * @param | |
533 | + * @return 项目立项书查询 | |
534 | + */ | |
535 | + public ProjectListPage toProjectListPage(){ | |
536 | + getHome(); | |
537 | + click(productDev); | |
538 | + click(quiryProject); | |
539 | + return new ProjectListPage(driver); | |
540 | + } | |
541 | + /** | |
542 | + *进入前台发单中心 | |
543 | + * @param | |
544 | + * @return 前台发单中心页面 | |
545 | + */ | |
546 | + public BillingCenterPage toBillingCenterPage() { | |
547 | + click(DocumentaryManage); | |
548 | + click(billingCenter); | |
549 | + return new BillingCenterPage(driver); | |
550 | + } | |
551 | + | |
552 | + /** | |
553 | + *进入船务看板界面 | |
554 | + */ | |
555 | + public LogisticsShippPage toLogisticsShippPage(){ | |
556 | +// mywait(LogisticsskippBoard); | |
557 | + click(LogisticsskippBoard); | |
558 | +// forceWait(1000); | |
559 | + click(skippBoard); | |
560 | +// jsExecutorClick(skippBoard); | |
561 | + return new LogisticsShippPage(driver); | |
562 | + } | |
563 | + /** | |
564 | + *业务员进入待办详情页,填写船务资料 | |
565 | + * @param | |
566 | + * @return | |
567 | + */ | |
568 | + public NeedDealtApplyPage toWriteShipping() { | |
569 | + click(firstNeedDealt); | |
570 | + switchMoreWindow(); | |
571 | + return new NeedDealtApplyPage(driver); | |
572 | + } | |
573 | + | |
574 | + /** | |
575 | + * 进入装柜任务管理 | |
576 | + * @return装柜任务管理 | |
577 | + */ | |
578 | + public CabineTaskManagemenPage toCabineTaskManagemenPage() { | |
579 | + click(StorageManage); | |
580 | + click(CabineTaskManagemen); | |
581 | + return new CabineTaskManagemenPage(driver); | |
582 | + } | |
583 | + /** | |
584 | + *对浏览器弹框处理 | |
585 | + * @param | |
586 | + * @return | |
587 | + */ | |
588 | + public void dealAlert(boolean isAccept){ | |
589 | + alert(isAccept); | |
590 | + } | |
591 | + | |
592 | +} | |
349 | 593 | \ No newline at end of file | ... | ... |
src/test/java/com/essa/pageObject/LoginPage.java renamed to src/main/java/com/essa/pageObject/LoginPage.java
src/main/java/com/essa/pageObject/LogisticShipp/BookingCarPage.java
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +package com.essa.pageObject.LogisticShipp; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.framework.Tools; | |
6 | +import org.openqa.selenium.WebDriver; | |
7 | +import org.openqa.selenium.WebElement; | |
8 | +import org.openqa.selenium.support.FindBy; | |
9 | + | |
10 | +//订车页面 | |
11 | +public class BookingCarPage extends BasePage { | |
12 | + | |
13 | + public BookingCarPage(WebDriver driver) { | |
14 | + super(driver); | |
15 | + } | |
16 | + | |
17 | + //订车看板 | |
18 | + @FindBy(xpath = "//*[text()='订车']") | |
19 | + WebElement BookingCarBoard; | |
20 | + | |
21 | + //查询条件 | |
22 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form/div/div/input") | |
23 | + WebElement SetQuery; | |
24 | + | |
25 | + //查询按钮 | |
26 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form/div/div/span/button/i") | |
27 | + WebElement QueryBtn; | |
28 | + | |
29 | + //查询数据 | |
30 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[1]") | |
31 | + WebElement QueryRsult; | |
32 | + | |
33 | + //订车按钮 | |
34 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/div[1]/button[1]") | |
35 | + WebElement BookingCarBtn; | |
36 | + | |
37 | + //订车类型 | |
38 | + @FindBy(xpath = "//*[text()='贷代订车']") | |
39 | + WebElement BookingCarSeclType; | |
40 | + | |
41 | + //预计到车日期 | |
42 | + @FindBy(xpath = "//*[@name='expectTruckArrivingDate']") | |
43 | + WebElement BookingCarDate; | |
44 | + | |
45 | + //确定按钮 | |
46 | + @FindBy(xpath = "//button[@data-bb-handler='submit']") | |
47 | + WebElement SubmitBtn; | |
48 | + | |
49 | + public BookingCarPage toBookingCarPage() { | |
50 | + mywait(BookingCarBoard); | |
51 | + click(BookingCarBoard); | |
52 | + SetQuery.sendKeys(Model.getPoNum()); | |
53 | + click(QueryBtn); | |
54 | + forceWait(1000); | |
55 | + click(QueryRsult); | |
56 | + click(BookingCarBtn); | |
57 | + mywait(BookingCarSeclType); | |
58 | + click(BookingCarSeclType); | |
59 | +// mywait(BookingCarDate); | |
60 | + jsExecutorRemoveAttribute(BookingCarDate, "readonly"); | |
61 | +// sendKeys(BookingCarDate,); | |
62 | + click(BookingCarDate); | |
63 | + paste(Tools.getFormatTime()); | |
64 | + click(SubmitBtn); | |
65 | + return new BookingCarPage(driver); | |
66 | + } | |
67 | +} | ... | ... |
src/main/java/com/essa/pageObject/LogisticShipp/CabinInfoPage.java
0 → 100644
... | ... | @@ -0,0 +1,90 @@ |
1 | +package com.essa.pageObject.LogisticShipp; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.framework.Tools; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | + | |
11 | +//船务看板-订舱-待订舱-订舱录入界面 | |
12 | +public class CabinInfoPage extends BasePage { | |
13 | + public CabinInfoPage(WebDriver driver) { | |
14 | + super(driver); | |
15 | + } | |
16 | + | |
17 | +// public String FilePath = "C:\\Users\\hanlei\\Desktop\\1.png"; | |
18 | + | |
19 | + //订舱看板 | |
20 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/ul/li[3]") | |
21 | + WebElement BookingCabin; | |
22 | + | |
23 | + //记录 | |
24 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/table/tbody/tr[1]/td/table/tbody/tr[1]") | |
25 | + WebElement FirstDate; | |
26 | + | |
27 | + //输入框 | |
28 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form[1]/div/div/input") | |
29 | + WebElement SetQuery; | |
30 | + | |
31 | + //查询按钮 | |
32 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form[1]/div/div/span/button") | |
33 | + WebElement QueryBtn; | |
34 | + | |
35 | + //选择订舱条目 | |
36 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/table/tbody/tr[1]/td/table/tbody/tr[1]/td[1]/input") | |
37 | + WebElement SelectFirstDate; | |
38 | + | |
39 | + //订舱按钮 | |
40 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/div[1]/button[1]") | |
41 | + WebElement BookingCabinBtn; | |
42 | + | |
43 | + //订舱S/O号 | |
44 | + @FindBy(xpath = "/html/body/div[6]/div/div/div[2]/div/form/div/div[1]/div/div[2]/div/div/input") | |
45 | + WebElement SetCabinSONo; | |
46 | + | |
47 | + //最后装柜日期 | |
48 | + @FindBy(xpath = "//*[@id='lastLoadTime']") | |
49 | + WebElement LastLoadTimeSet; | |
50 | + | |
51 | + //选择文件 | |
52 | + @FindBy(xpath = "//*[text()='点击选择文件...']") | |
53 | + WebElement FileUp; | |
54 | + | |
55 | + //确定 | |
56 | + @FindBy(xpath = "//button[@data-bb-handler='submit' and @type='button']") | |
57 | + WebElement CommitBtn; | |
58 | + | |
59 | + //窗体 | |
60 | + @FindBy(xpath = "/html/body/div[6]/div/div/div[2]/div") | |
61 | + WebElement Body; | |
62 | + | |
63 | + //预计到港时间 | |
64 | + @FindBy (xpath = "//*[@id='expectArrivalTime']") | |
65 | + WebElement expectArrivalTime; | |
66 | + | |
67 | + | |
68 | + public CabinInfoPage toCabinInfoPage() { | |
69 | + forceWait(1000); | |
70 | + click(BookingCabin); | |
71 | + mywait(FirstDate); | |
72 | + SetQuery.sendKeys(Model.getPoNum()); | |
73 | + click(QueryBtn); | |
74 | + forceWait(1000); | |
75 | + click(SelectFirstDate); | |
76 | + click(BookingCabinBtn); | |
77 | + mywait(SetCabinSONo); | |
78 | + SetCabinSONo.sendKeys("TestCabinNo"); | |
79 | + jsExecutorRemoveAttribute(LastLoadTimeSet, "readonly"); | |
80 | + click(LastLoadTimeSet); | |
81 | + paste(Tools.getFormatTime());//用键盘粘贴的方式填入时间 | |
82 | + click(Body); | |
83 | + actionClick(FileUp); | |
84 | + uploadFile(Model.getPicPath()); | |
85 | + dynamicLoad(By.xpath("//img[@ng-src='/img/nopic.jpg']"));//直到默认的图片找不到时,执行下一步 | |
86 | + click(CommitBtn); | |
87 | + dynamicLoad(); | |
88 | + return new CabinInfoPage(driver); | |
89 | + } | |
90 | +} | ... | ... |
src/main/java/com/essa/pageObject/LogisticShipp/LogisticsShippPage.java
0 → 100644
... | ... | @@ -0,0 +1,70 @@ |
1 | +package com.essa.pageObject.LogisticShipp; | |
2 | + | |
3 | + | |
4 | +import com.essa.framework.BasePage; | |
5 | +import com.essa.framework.Model; | |
6 | +import com.essa.pageObject.HomePage; | |
7 | +import org.openqa.selenium.By; | |
8 | +import org.openqa.selenium.WebDriver; | |
9 | +import org.openqa.selenium.WebElement; | |
10 | +import org.openqa.selenium.support.FindBy; | |
11 | + | |
12 | +//船务看板-通知确认船务资料界面 | |
13 | +public class LogisticsShippPage extends BasePage { | |
14 | + public LogisticsShippPage(WebDriver driver) { | |
15 | + super(driver); | |
16 | + } | |
17 | + | |
18 | + // 通知确认船务资料看板 | |
19 | + @FindBy(xpath = "//a[text()='通知确认船务资料']") | |
20 | + WebElement NoticeBoard; | |
21 | + | |
22 | + //等待数据结构 | |
23 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/table/tbody/tr[1]") | |
24 | + WebElement resultDate; | |
25 | + | |
26 | + //订单编号输入框 | |
27 | + @FindBy (xpath = "//input[@type='text' and @ng-model ='query.keyword']") | |
28 | + WebElement setPono; | |
29 | + | |
30 | + //高级查询按钮 | |
31 | + @FindBy (xpath = "//i[@class='iconfont icon-search']") | |
32 | + WebElement querySubBtn; | |
33 | + | |
34 | + //查询结果 | |
35 | + @FindBy (xpath = "//input[@type ='checkbox' and @checklist-value='item']") | |
36 | + WebElement selectedpo; | |
37 | + | |
38 | + //点击通知确认船务资料 | |
39 | + @FindBy (xpath = "//button[text()='通知确认船务资料']") | |
40 | + WebElement skippSubBtn; | |
41 | + | |
42 | + //点击确认按钮 | |
43 | + @FindBy (xpath = "//html/body/div[5]/div/div/div[2]/div/div/button[1]") | |
44 | + WebElement submitSubBtn; | |
45 | + | |
46 | + //点击退出登录 | |
47 | + @FindBy (xpath="//*[text()='退出']") | |
48 | + WebElement logout; | |
49 | + | |
50 | + //搜索并通知业务补充船务资料 | |
51 | + public HomePage isSucceed() { | |
52 | + forceWait(1000); | |
53 | + click(NoticeBoard); | |
54 | + dynamicWait(By.xpath("//tbody/tr[1]/td[1]/input[1]"));//列表加载 | |
55 | +// setPono.sendKeys("D180411T0278"); | |
56 | + sendKeys(setPono, Model.getPoNum()); | |
57 | + click(querySubBtn); | |
58 | + mywait(selectedpo); | |
59 | + click(selectedpo); | |
60 | + mywait(selectedpo); | |
61 | + click(skippSubBtn); | |
62 | + mywait(submitSubBtn); | |
63 | + click(submitSubBtn); | |
64 | + String saleman = DBSqlSearch("select a.account_name from pri_user a INNER JOIN\n" + | |
65 | + "sale_po b on a.id=b.salesman_id\n" + | |
66 | + "where b.`code` = '"+ Model.getPoNum()+"';","account_name");//根据PO单号查出对应的业务员 | |
67 | + Model.setSalesman(saleman);//将查询出的业务员存储在model中 | |
68 | + return new HomePage(driver); | |
69 | + } | |
70 | +} | ... | ... |
src/main/java/com/essa/pageObject/LogisticShipp/SendCarPage.java
0 → 100644
... | ... | @@ -0,0 +1,68 @@ |
1 | +package com.essa.pageObject.LogisticShipp; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import org.openqa.selenium.WebDriver; | |
6 | +import org.openqa.selenium.WebElement; | |
7 | +import org.openqa.selenium.support.FindBy; | |
8 | + | |
9 | +//确认发车页面 | |
10 | +public class SendCarPage extends BasePage { | |
11 | + public SendCarPage(WebDriver driver) { | |
12 | + super(driver); | |
13 | + } | |
14 | + | |
15 | + //订车看板 | |
16 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/ul/li[4]") | |
17 | + WebElement BookingCarBoard; | |
18 | + | |
19 | + //待发车看板 | |
20 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/ul/li[2]") | |
21 | + WebElement WaitForBookingCarBoard; | |
22 | + | |
23 | + //查询 | |
24 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form/div/div/input") | |
25 | + WebElement QueryWaitForBooking; | |
26 | + | |
27 | + //查询按钮 | |
28 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/form/div/div/span/button") | |
29 | + WebElement QueryWaitForBookingCarBtn; | |
30 | + | |
31 | + //查询结果 | |
32 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div/div/div/div/div/div/table/tbody/tr") | |
33 | + WebElement FristWaitForBookingCarDate; | |
34 | + | |
35 | + //发车确认 | |
36 | + @FindBy(xpath = "//*[text()='发车确认']") | |
37 | + WebElement ConfirmBookingCar; | |
38 | + | |
39 | + //柜号 | |
40 | + @FindBy(xpath = "//*[@name='containerNo']") | |
41 | + WebElement SetContainerNo; | |
42 | + | |
43 | + //封条号 | |
44 | + @FindBy(xpath = "//*[@name='sealNo']") | |
45 | + WebElement SetSealNo; | |
46 | + | |
47 | + //确认发车 | |
48 | + @FindBy(xpath = "//*[@data-bb-handler='submit']") | |
49 | + WebElement SubmitBtn; | |
50 | + | |
51 | + public SendCarPage toSendCarPage() { | |
52 | + forceWait(1000); | |
53 | + click(BookingCarBoard); | |
54 | + mywait(WaitForBookingCarBoard); | |
55 | + click(WaitForBookingCarBoard); | |
56 | + forceWait(500); | |
57 | + QueryWaitForBooking.sendKeys(Model.getPoNum()); | |
58 | + click(QueryWaitForBookingCarBtn); | |
59 | + forceWait(1000); | |
60 | + click(FristWaitForBookingCarDate); | |
61 | + click(ConfirmBookingCar); | |
62 | + mywait(SetContainerNo); | |
63 | + SetContainerNo.sendKeys("TestContainerNo"); | |
64 | + SetSealNo.sendKeys("TestSealNo"); | |
65 | + click(SubmitBtn); | |
66 | + return new SendCarPage(driver); | |
67 | + } | |
68 | +} | ... | ... |
src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java
0 → 100644
... | ... | @@ -0,0 +1,85 @@ |
1 | +package com.essa.pageObject.PODocumentary; | |
2 | + | |
3 | +import com.essa.framework.Tools; | |
4 | +import org.openqa.selenium.By; | |
5 | +import org.openqa.selenium.WebDriver; | |
6 | +import com.essa.framework.BasePage; | |
7 | +import org.openqa.selenium.WebElement; | |
8 | +import org.openqa.selenium.support.FindBy; | |
9 | + | |
10 | +import java.util.Date; | |
11 | + | |
12 | +/** | |
13 | + * @author Administrator | |
14 | + *PO详情页 | |
15 | + */ | |
16 | +public class POBoardPage extends BasePage { | |
17 | + | |
18 | + public POBoardPage(WebDriver driver) { super(driver); } | |
19 | + | |
20 | + /* | |
21 | + * 元素定位 | |
22 | + */ | |
23 | + @FindBy (xpath = "//*[contains(text(),'通知收货')]") | |
24 | + WebElement NoticeReceipt;//通知收货 | |
25 | + | |
26 | + @FindBy (xpath = "//div[@class='col-sm-16']//input[@type='text']") | |
27 | + WebElement receiptDate;//选择收货日期 | |
28 | + | |
29 | + @FindBy (xpath = "//input[@name='newDate']") | |
30 | + WebElement loadingDate;//选择装柜日期 | |
31 | + | |
32 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | |
33 | + WebElement submit;//提交 | |
34 | + | |
35 | + @FindBy (xpath = "//div[@class='bootbox modal fade in']") | |
36 | + WebElement BlankPlace;//点击空白处 | |
37 | + | |
38 | + @FindBy (xpath = "//*[contains(text(),'通知装柜')]") | |
39 | + WebElement NotificationLoading;//通知装柜 | |
40 | + | |
41 | + //通知收货 | |
42 | + public POBoardPage toNoticeReceipt() { | |
43 | + click(NoticeReceipt); | |
44 | + jsExecutorRemoveAttribute(receiptDate,"readonly"); | |
45 | + String Receiptdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); | |
46 | + sendKeys(receiptDate,Receiptdate); | |
47 | + click(BlankPlace); | |
48 | + click(submit); | |
49 | + forceWait(4000); | |
50 | + | |
51 | + return new POBoardPage(driver); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 判断通知收货是否成功 | |
56 | + * @return boolean | |
57 | + */ | |
58 | + public boolean isNoticeReceipt (){ | |
59 | + forceWait(2000); | |
60 | + return isVisibility(By.xpath("//*[contains(text(),'收货中')]")); | |
61 | + } | |
62 | + | |
63 | + | |
64 | + //通知装柜 | |
65 | + public POBoardPage toNotificationLoading(){ | |
66 | + click(NotificationLoading); | |
67 | + jsExecutorRemoveAttribute(loadingDate,"readonly"); | |
68 | +// String Loadingdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); | |
69 | + sendKeys(loadingDate, Tools.getToday()); | |
70 | + click(BlankPlace); | |
71 | + click(submit); | |
72 | + forceWait(4000); | |
73 | + | |
74 | + return new POBoardPage(driver); | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * 判断通知装柜是否成功 | |
79 | + * @return boolean | |
80 | + */ | |
81 | + public boolean isNotificationLoading(){ | |
82 | + forceWait(2000); | |
83 | + return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); | |
84 | + } | |
85 | +} | |
0 | 86 | \ No newline at end of file | ... | ... |
src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java
0 → 100644
... | ... | @@ -0,0 +1,53 @@ |
1 | +package com.essa.pageObject.PODocumentary; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import org.openqa.selenium.WebDriver; | |
5 | +import org.openqa.selenium.WebElement; | |
6 | +import org.openqa.selenium.support.FindBy; | |
7 | + | |
8 | +import com.essa.framework.BasePage; | |
9 | + | |
10 | +/** | |
11 | + * @author Administrator | |
12 | + *PO跟单任务列表页面 | |
13 | + */ | |
14 | +public class PODocumentaryListPage extends BasePage { | |
15 | + | |
16 | + public PODocumentaryListPage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | + | |
20 | + /* | |
21 | + * 元素定位 | |
22 | + */ | |
23 | + @FindBy (xpath = "//*[text()='跟单管理']") | |
24 | + WebElement DocumentaryManage;//跟单管理 | |
25 | + | |
26 | + @FindBy (xpath ="//*[text()='PO跟单']") | |
27 | + WebElement PODocumentary;//PO跟单 | |
28 | + | |
29 | + @FindBy (xpath = "//*[@placeholder='请输入PO单号、客户编号等关键字查询']") | |
30 | + WebElement OrderNo;//输入PO单号 | |
31 | + | |
32 | + @FindBy (xpath = "//*[@ng-click='search()']") | |
33 | + WebElement searchPO;//搜索 | |
34 | + | |
35 | + @FindBy (xpath = "//*[contains(text(),'查看详情')]") | |
36 | + WebElement detail;//查看详情 | |
37 | + | |
38 | + /** | |
39 | + * 搜索PO单查看详情 | |
40 | + */ | |
41 | + | |
42 | + public PODocumentaryListPage toPoDocumentaryListPage(){ | |
43 | + click(DocumentaryManage); | |
44 | + click(PODocumentary); | |
45 | + sendKeys(OrderNo,Model.getPoNum()); | |
46 | + forceWait(2000); | |
47 | + click(searchPO); | |
48 | + forceWait(2000); | |
49 | + click(detail); | |
50 | + forceWait(7000); | |
51 | + return new PODocumentaryListPage(driver); | |
52 | + } | |
53 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/CabineTaskManagemenPage.java
0 → 100644
... | ... | @@ -0,0 +1,68 @@ |
1 | +package com.essa.pageObject.StorageManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
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 | +/** | |
11 | + * Created by lana on 2018/10/26 0026. | |
12 | + * 装柜任务管理页 | |
13 | + */ | |
14 | +public class CabineTaskManagemenPage extends BasePage{ | |
15 | + | |
16 | + public CabineTaskManagemenPage(WebDriver driver) { | |
17 | + super(driver); | |
18 | + } | |
19 | + | |
20 | + /* | |
21 | + * 元素定位 | |
22 | + */ | |
23 | + | |
24 | + @FindBy(xpath = "//input[@name='selectKey']") | |
25 | + WebElement selectKey;//关键字查询 | |
26 | + | |
27 | + @FindBy (xpath = "//button[contains(@ng-click,'search')]") | |
28 | + WebElement search;//查询按钮 | |
29 | + | |
30 | + @FindBy(xpath ="//button[contains(@ng-click,'goCompleteTask')]" ) | |
31 | + WebElement handle;//处理按钮 | |
32 | + | |
33 | + @FindBy(xpath ="//tbody/tr[1]") | |
34 | + WebElement firstTr;//定位第一行 | |
35 | + | |
36 | + @FindBy (xpath = "//button[contains(text(),'处理')]") | |
37 | + WebElement deal;//处理 | |
38 | + | |
39 | + /* | |
40 | + * 页面参数 | |
41 | + * */ | |
42 | +// String poNo=""; | |
43 | + | |
44 | + /* | |
45 | + * 页面方法 | |
46 | + */ | |
47 | + | |
48 | + /** | |
49 | + * 设置装柜处理查询 | |
50 | + */ | |
51 | + public CabineTaskManagemenPage setWareHouse() { | |
52 | + dynamicLoad(By.xpath("//div[@style='display: none;' and @id='mask']")); | |
53 | +// if(Model.getPoNum()!=""|| Model.getPoNum()!=null){ | |
54 | +// poNo="B180828T9165"; | |
55 | +// sendKeys(selectKey, poNo); | |
56 | +// }else{ | |
57 | +// sendKeys(selectKey, Model.getPoNum()); | |
58 | +// } | |
59 | + sendKeys(selectKey, Model.getPoNum()); | |
60 | + click(search); | |
61 | + forceWait(1000); | |
62 | + click(firstTr); | |
63 | + click(deal); | |
64 | + return new CabineTaskManagemenPage(driver); | |
65 | + | |
66 | + } | |
67 | + | |
68 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/GoodsReceiveTaskPage.java
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
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 | + @FindBy (xpath = "//tbody//tr[1]/td[8]") | |
38 | + WebElement status;//第一个结果的状态 | |
39 | + | |
40 | + /* | |
41 | + * 页面方法 | |
42 | + */ | |
43 | + /** | |
44 | + * 选择第一个筛选结果,点击处理 | |
45 | + * @return PO收货任务处理页 | |
46 | + */ | |
47 | + public GoodsReceiveTaskPage dealReceive() { | |
48 | + forceWait(1000); | |
49 | + dynamicWait(By.xpath("//tbody//tr[1]")); | |
50 | + sendKeys(keyword, Model.getPoNum()); | |
51 | + click(search); | |
52 | + dynamicLoad(); | |
53 | + click(firstResult); | |
54 | + click(deal); | |
55 | + return new GoodsReceiveTaskPage(driver); | |
56 | + } | |
57 | + /** | |
58 | + *判断是否全部收货完成:true完成,false未完成 | |
59 | + * @param | |
60 | + * @return boolean | |
61 | + */ | |
62 | + public boolean isFinish(){ | |
63 | + forceWait(500); | |
64 | + boolean b = isVisibility(By.xpath("//*[text()='完成']")); | |
65 | + return b; | |
66 | + } | |
67 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/HandlingLoadingOrders.java
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +package com.essa.pageObject.StorageManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Tools; | |
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 java.text.SimpleDateFormat; | |
11 | +import java.util.Date; | |
12 | + | |
13 | + | |
14 | +/** | |
15 | + * 装柜任务处理页面 | |
16 | + * Created by Administrator on 2018/10/30 0030. | |
17 | + */ | |
18 | +public class HandlingLoadingOrders extends BasePage { | |
19 | + public HandlingLoadingOrders(WebDriver driver) { | |
20 | + super(driver); | |
21 | + } | |
22 | + | |
23 | + WebDriver webDriver; | |
24 | + /* | |
25 | + * 元素定位 | |
26 | + */ | |
27 | + | |
28 | + //实际装柜日期 | |
29 | + @FindBy(xpath = "//input[@id='loadCompleteDate']") | |
30 | + WebElement loadCompleteDate; | |
31 | + | |
32 | + //获取装柜商品列表 | |
33 | + @FindBy(xpath = "//tbody[2]/tr[1]/td[6]") | |
34 | + WebElement firstTr;//定位第一行 | |
35 | + | |
36 | + //输入实装箱数 | |
37 | + @FindBy(xpath = "//input[@id='actLoadBoxQuantity']") | |
38 | + WebElement realNumber; | |
39 | + | |
40 | + //提交 | |
41 | + @FindBy(xpath = "//*[text()='提交']") | |
42 | + WebElement submit; | |
43 | + | |
44 | + //可装柜箱数 | |
45 | + @FindBy (xpath = "//tr[@class='ng-scope']//td[6]/div") | |
46 | + WebElement canLoadNum; | |
47 | + | |
48 | + /** | |
49 | + * 设置装柜处理参数 | |
50 | + */ | |
51 | + public HandlingLoadingOrders setHandlingCabinet() { | |
52 | + forceWait(1000); | |
53 | + //设置实际装柜日期 | |
54 | + jsExecutorRemoveAttribute(loadCompleteDate, "readonly"); | |
55 | + click(loadCompleteDate); | |
56 | + paste(Tools.getFormatTime()); | |
57 | + String context = canLoadNum.getText(); | |
58 | + String nums = context.substring(0,2); | |
59 | + int num = Integer.parseInt(nums)-8; | |
60 | + sendKeys(realNumber,num+""); | |
61 | + click(submit); | |
62 | + dynamicLoad(); | |
63 | + return new HandlingLoadingOrders(driver); | |
64 | + } | |
65 | + | |
66 | + | |
67 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/LoadContainerHandlePage.java
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +package com.essa.pageObject.StorageManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.framework.Tools; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | + | |
11 | +import java.util.Date; | |
12 | + | |
13 | + | |
14 | +/** | |
15 | + * 装柜任务处理 | |
16 | + */ | |
17 | +public class LoadContainerHandlePage extends BasePage { | |
18 | + | |
19 | + public LoadContainerHandlePage(WebDriver driver){ | |
20 | + super(driver); | |
21 | + } | |
22 | + | |
23 | + /** | |
24 | + * 元素定位 | |
25 | + */ | |
26 | + // 实装柜日期 | |
27 | + @FindBy (xpath = "//input[@id='loadCompleteDate']") | |
28 | + WebElement actLoadTime; | |
29 | + | |
30 | + // 可装柜箱数 | |
31 | + @FindBy (xpath = "//tr[@class='ng-scope']//td[6]") | |
32 | + WebElement mayLoadQuantity; | |
33 | + | |
34 | + // 实装箱数 | |
35 | + @FindBy (xpath = "//input[@id='actLoadBoxQuantity']") | |
36 | + WebElement actLoadQuantity; | |
37 | + | |
38 | + // 点击选择文件 | |
39 | + @FindBy (xpath ="//div[@id='rt_rt_1cqvbp0jn14kfb41keb187l1u8oh']//label" ) | |
40 | + WebElement actPicture; | |
41 | + | |
42 | + // 提交 | |
43 | + @FindBy (xpath = "//*[text()='提交']") | |
44 | + WebElement submit; | |
45 | + | |
46 | + /** | |
47 | + * 页面方法 | |
48 | + */ | |
49 | + public LoadContainerHandlePage loadTaskHandle(){ | |
50 | + forceWait(1000); | |
51 | + jsExecutorRemoveAttribute(actLoadTime,"readonly"); | |
52 | +// String date = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); | |
53 | + sendKeys(actLoadTime, Tools.getToday()); | |
54 | + // 获取‘可装柜数量’字符串中的数量 | |
55 | + String qua = partiaStr(mayLoadQuantity,0,1); | |
56 | + // 对切片结果进行int转换 | |
57 | + int i = Integer.valueOf(qua).intValue(); | |
58 | + // 形成现存尾货‘2’ | |
59 | + int tail = i-2; | |
60 | + // 对计算结果转换成string,并赋值给“实装柜数量” | |
61 | + String quantity = String.valueOf(tail); | |
62 | + sendKeys(actLoadQuantity,quantity); | |
63 | + click(submit); | |
64 | + dynamicLoad(); | |
65 | + return new LoadContainerHandlePage(driver); | |
66 | + } | |
67 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/LoadContainerManagePage.java
0 → 100644
... | ... | @@ -0,0 +1,59 @@ |
1 | +package com.essa.pageObject.StorageManage; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import net.bytebuddy.asm.Advice; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | +/** | |
11 | +* @Description: 装柜任务管理列表 | |
12 | +* @Author: ZengJin | |
13 | +* @CreateTime: 2018/11/1 | |
14 | +*/ | |
15 | +public class LoadContainerManagePage extends BasePage { | |
16 | + | |
17 | + public LoadContainerManagePage(WebDriver driver) { | |
18 | + super(driver); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * 元素定位 | |
23 | + */ | |
24 | + | |
25 | + // 关键字搜索输入框 | |
26 | + @FindBy(xpath = "//input[@placeholder='请输入PO单号或采购商编号,多个请用空格隔开']") | |
27 | + WebElement inputKeySearch; | |
28 | + | |
29 | + // 放大镜搜索按钮 | |
30 | + @FindBy(xpath = "//*[@class='iconfont icon-search']") | |
31 | + WebElement keySearch; | |
32 | + | |
33 | + // 选中查询的第一条数据 | |
34 | + @FindBy (xpath = "//td[@title='待处理']") | |
35 | + WebElement firstPO; | |
36 | + | |
37 | + // 处理 | |
38 | + @FindBy(xpath = "//*[text()='处理']") | |
39 | + WebElement handle; | |
40 | + | |
41 | + /** | |
42 | + * 页面方法 | |
43 | + * | |
44 | + * @return | |
45 | + */ | |
46 | + public LoadContainerManagePage toLoadContainerDetail() { | |
47 | + forceWait(1000); | |
48 | + dynamicLoad(By.xpath("//div[@style='display: none;' and @id='mask']")); | |
49 | + sendKeys(inputKeySearch, Model.getPoNum()); | |
50 | +// forceWait(5000); | |
51 | + click(keySearch); | |
52 | +// forceWait(2000); | |
53 | + dynamicLoad(); | |
54 | + click(firstPO); | |
55 | +// forceWait(2000); | |
56 | + click(handle); | |
57 | + return new LoadContainerManagePage(driver); | |
58 | + } | |
59 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/NoticeReceivePage.java
0 → 100644
... | ... | @@ -0,0 +1,83 @@ |
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 NoticeReceivePage 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 | + jsExecutorClick(wareHouse); | |
66 | + jsExecutorClick(zone); | |
67 | + jsExecutorClick(shelf); | |
68 | +// click(wareHouse); | |
69 | +// forceWait(1000); | |
70 | +// click(zone); | |
71 | +// forceWait(1000); | |
72 | +// click(shelf); | |
73 | +// forceWait(1000); | |
74 | + click(confirm); | |
75 | + forceWait(1000); | |
76 | + click(sysch); | |
77 | + forceWait(1000); | |
78 | + isVisibility(By.xpath("//*[text()='设置成功']")); | |
79 | + click(succeed); | |
80 | + return new NoticeReceivePage(driver); | |
81 | + } | |
82 | + | |
83 | +} | ... | ... |
src/main/java/com/essa/pageObject/StorageManage/ReceiveTaskDealPage.java
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
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 | + dynamicLoad(); | |
37 | + moveHeightScroll("0"); | |
38 | + click(allReceive); | |
39 | + forceWait(500); | |
40 | + click(confirm); | |
41 | + forceWait(1000); | |
42 | + click(confirm); | |
43 | + dynamicLoad(); | |
44 | + return new GoodsReceiveTaskPage(driver); | |
45 | + } | |
46 | +} | ... | ... |
src/test/java/com/essa/pageObject/SupplierOperationsTrackPage.java renamed to src/main/java/com/essa/pageObject/SupplierManage/SupplierOperationsTrackPage.java
1 | -package com.essa.pageObject; | |
1 | +package com.essa.pageObject.SupplierManage; | |
2 | 2 | |
3 | 3 | import org.openqa.selenium.WebDriver; |
4 | 4 | import org.openqa.selenium.WebElement; |
... | ... | @@ -6,6 +6,11 @@ import org.openqa.selenium.support.FindBy; |
6 | 6 | |
7 | 7 | import com.essa.framework.BasePage; |
8 | 8 | |
9 | +/* | |
10 | +* @Description:BD跟进管理页面 | |
11 | +* @Author: ZengJin | |
12 | +* @CreateTime: 2018/10/29 | |
13 | +*/ | |
9 | 14 | public class SupplierOperationsTrackPage extends BasePage { |
10 | 15 | public SupplierOperationsTrackPage(WebDriver driver) { |
11 | 16 | super(driver); | ... | ... |
src/test/java/com/essa/pageObject/SupplierStrengthPage.java renamed to src/main/java/com/essa/pageObject/SupplierManage/SupplierStrengthPage.java
1 | -package com.essa.pageObject; | |
1 | +package com.essa.pageObject.SupplierManage; | |
2 | 2 | |
3 | 3 | import java.util.List; |
4 | 4 | |
... | ... | @@ -8,7 +8,11 @@ import org.openqa.selenium.WebElement; |
8 | 8 | import org.openqa.selenium.support.FindBy; |
9 | 9 | |
10 | 10 | import com.essa.framework.BasePage; |
11 | - | |
11 | +/* | |
12 | +* @Description:综合实力评估页面 | |
13 | +* @Author: ZengJin | |
14 | +* @CreateTime: 2018/10/29 | |
15 | +*/ | |
12 | 16 | public class SupplierStrengthPage extends BasePage{ |
13 | 17 | public SupplierStrengthPage(WebDriver driver) { |
14 | 18 | super(driver); |
... | ... | @@ -259,7 +263,7 @@ public class SupplierStrengthPage extends BasePage{ |
259 | 263 | isElementExist(addCertificate); |
260 | 264 | click(addCertificate); |
261 | 265 | |
262 | - java.util.List<WebElement> list= checkBoxes; | |
266 | + List<WebElement> list= checkBoxes; | |
263 | 267 | int x = list.size(); |
264 | 268 | |
265 | 269 | selectElement(itemType(x), "WRAP"); | ... | ... |
src/test/java/com/essa/pageObject/buyPlaneManage/SkuCategoryManagerCongfigPage.java renamed to src/main/java/com/essa/pageObject/buyPlaneManage/SkuCategoryManagerCongfigPage.java
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 | -} | |
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/test/java/com/essa/pageObject/buyerManage/InvateCodePage.java renamed to src/main/java/com/essa/pageObject/buyerManage/InvateCodePage.java
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 | -} | |
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/test/java/com/essa/pageObject/inquiryManage/ProductInquiryFeedbackPage.java renamed to src/main/java/com/essa/pageObject/inquiryManage/ProductInquiryFeedbackPage.java
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 | -} | |
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/test/java/com/essa/pageObject/inquiryManage/ProductInquiryTaskPage.java renamed to src/main/java/com/essa/pageObject/inquiryManage/ProductInquiryTaskPage.java
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 | -} | |
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 | + dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | |
61 | + click(advancedQuery); | |
62 | + sendKeys(skuNoQuery, Model.getSkuNo()); | |
63 | + click(search); | |
64 | + forceWait(1000); | |
65 | + mywait(firstRow); | |
66 | + click(firstRow); | |
67 | + click(feedBack); | |
68 | + return new ProductInquiryFeedbackPage(driver); | |
69 | + } | |
70 | + | |
71 | + /** | |
72 | + * 判断页面是否查询不到该商品 | |
73 | + * | |
74 | + * @return boolean | |
75 | + */ | |
76 | + public boolean isSucceed() { | |
77 | + click(advancedQuery); | |
78 | + sendKeys(skuNoQuery, Model.getSkuNo()); | |
79 | + click(search); | |
80 | + forceWait(1000); | |
81 | + return isVisibility(By.xpath("//*[text()='暂无数据']")); | |
82 | + } | |
83 | + | |
84 | + /** | |
85 | + * 判断根据po单查询,是否全部询价完成 | |
86 | + * | |
87 | + * @return boolean | |
88 | + */ | |
89 | + public boolean isPOSucceed() { | |
90 | + forceWait(1000); | |
91 | + return isVisibility(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | |
92 | + } | |
93 | + | |
94 | + /** | |
95 | + * 根据PO单号查询询价 | |
96 | + * | |
97 | + * @return 询价反馈页面 | |
98 | + */ | |
99 | + public ProductInquiryFeedbackPage POtoFeedback() { | |
100 | + dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | |
101 | + click(advancedQuery); | |
102 | + sendKeys(POQuery, Model.getPoNum()); | |
103 | + click(search); | |
104 | + dynamicWait(By.xpath("//*[@id='mask' and @style='display: none;']")); | |
105 | +// dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]")); | |
106 | +// mywait(firstRow); | |
107 | +// forceWait(2000); | |
108 | + click(firstRow); | |
109 | + click(feedBack); | |
110 | + return new ProductInquiryFeedbackPage(driver); | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 如果列表中还存在待询价的单,循环方法,继续询价 | |
115 | + * | |
116 | + * @return | |
117 | + */ | |
118 | + public ProductInquiryFeedbackPage POcircle() { | |
119 | + click(firstRow); | |
120 | + click(feedBack); | |
121 | + return new ProductInquiryFeedbackPage(driver); | |
122 | + } | |
123 | +} | ... | ... |
src/test/java/com/essa/pageObject/marketingManage/CollectBillControlPage.java renamed to src/main/java/com/essa/pageObject/marketingManage/CollectBillControlPage.java
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 | -} | |
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/test/java/com/essa/pageObject/marketingManage/CollectBillSettingPage.java renamed to src/main/java/com/essa/pageObject/marketingManage/CollectBillSettingPage.java
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 | -} | |
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/test/java/com/essa/pageObject/marketingManage/GroupControlPage.java renamed to src/main/java/com/essa/pageObject/marketingManage/GroupControlPage.java
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 | -} | |
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/test/java/com/essa/pageObject/marketingManage/GroupSettingPage.java renamed to src/main/java/com/essa/pageObject/marketingManage/GroupSettingPage.java
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 | -} | |
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/LargeDcofdPage.java
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +package com.essa.pageObject.needDealt; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.pageObject.HomePage; | |
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 | +//大跟单确认备选船期待办界面 | |
11 | +public class LargeDcofdPage extends BasePage { | |
12 | + public LargeDcofdPage (WebDriver driver) { | |
13 | + super(driver); | |
14 | + } | |
15 | + | |
16 | + // 确认登记备选船期 | |
17 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div[4]/span[1]/button[2]") | |
18 | + WebElement ConfirmationShipDate; | |
19 | + | |
20 | + /** | |
21 | + *大跟单确认船期 | |
22 | + * @param | |
23 | + * @return | |
24 | + */ | |
25 | + public HomePage toLargeDcofdPage(){ | |
26 | +// mywait(ConfirmationShipDate); | |
27 | + dynamicWait(By.xpath("//*[contains(text(),'待办工作')]")); | |
28 | + click(ConfirmationShipDate); | |
29 | + dynamicLoad(); | |
30 | + return new HomePage(driver); | |
31 | + } | |
32 | +} | ... | ... |
src/main/java/com/essa/pageObject/needDealt/NeedDealtApplyPage.java
0 → 100644
... | ... | @@ -0,0 +1,176 @@ |
1 | +package com.essa.pageObject.needDealt; | |
2 | + | |
3 | +import com.essa.framework.Tools; | |
4 | +import org.openqa.selenium.By; | |
5 | +import org.openqa.selenium.JavascriptExecutor; | |
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.pageObject.HomePage; | |
13 | + | |
14 | +import java.util.Date; | |
15 | + | |
16 | +/** | |
17 | + * 当团购活动成功时,类目经理采购计划单申请页面 | |
18 | + * @author Administrator | |
19 | + * | |
20 | + */ | |
21 | +public class NeedDealtApplyPage extends BasePage { | |
22 | + | |
23 | + public NeedDealtApplyPage(WebDriver driver) { | |
24 | + super(driver); | |
25 | + } | |
26 | + | |
27 | + /* | |
28 | + * 元素定位 | |
29 | + */ | |
30 | + | |
31 | + //提交询价 | |
32 | + @FindBy (xpath ="//*[text()='提交询价']") | |
33 | + WebElement submitInquiry; | |
34 | + | |
35 | + //待办工作--检查点 | |
36 | + @FindBy (xpath = "//*[contains(text(),'待办工作')]") | |
37 | + WebElement checkpoint; | |
38 | + | |
39 | + //流水号 | |
40 | + @FindBy (xpath = "//*[contains(text(),'流水号:RW')]") | |
41 | + WebElement serialNumber; | |
42 | + | |
43 | + //确认 | |
44 | + @FindBy (xpath = "//*[text()='确认']") | |
45 | + WebElement confirm; | |
46 | + | |
47 | + //送审核 | |
48 | + @FindBy (xpath = "//*[text()='提交审核']") | |
49 | + WebElement toAudit; | |
50 | + | |
51 | + //认领 | |
52 | + @FindBy (xpath = "//*[text()='认领']") | |
53 | + WebElement claim; | |
54 | + | |
55 | + //同意 | |
56 | + @FindBy (xpath ="//*[text()='同意']") | |
57 | + WebElement agree; | |
58 | + | |
59 | + //添加 | |
60 | + @FindBy(xpath = "//*[text()='添加']" ) | |
61 | + WebElement add; | |
62 | + | |
63 | + //船公司 | |
64 | + @FindBy(xpath = "//input[@name='shipperCompany']") | |
65 | + WebElement inputShipperCompany; | |
66 | + | |
67 | + //开船日期 | |
68 | + @FindBy(xpath = "//input[@id='deliveryDate0']") | |
69 | + WebElement inputShipperStartDate; | |
70 | + | |
71 | + //预计到港日期 | |
72 | + @FindBy(xpath = "//input[@id='estimatedArrivalDate0']") | |
73 | + WebElement inputShipperArriveDate; | |
74 | + | |
75 | + //提交 | |
76 | + @FindBy(xpath = "//*[text()='提交']") | |
77 | + WebElement submit; | |
78 | + | |
79 | + //暂存 | |
80 | + @FindBy(xpath = "//*[text()='暂存']") | |
81 | + WebElement save; | |
82 | + | |
83 | + | |
84 | + /* | |
85 | + * 页面方法 | |
86 | + */ | |
87 | + | |
88 | + /** | |
89 | + * 提交询价 | |
90 | + * @return bmps首页 | |
91 | + */ | |
92 | + public HomePage submitInquiry() { | |
93 | + mywait(checkpoint); | |
94 | + forceWait(1000); | |
95 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | |
96 | + moveHeightScroll("100"); | |
97 | + click(submitInquiry); | |
98 | + forceWait(500); | |
99 | + click(confirm); | |
100 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
101 | + return new HomePage(driver); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 类目经理修订,送审核 | |
106 | + * @return bpms首页 | |
107 | + */ | |
108 | + public HomePage toAudit() { | |
109 | + mywait(checkpoint); | |
110 | + forceWait(1000); | |
111 | + moveHeightScroll("100"); | |
112 | + click(toAudit); | |
113 | + forceWait(500); | |
114 | + click(confirm); | |
115 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
116 | + return new HomePage(driver); | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * 财务审核计划申请 | |
121 | + * @return | |
122 | + */ | |
123 | + public HomePage audit() { | |
124 | + mywait(checkpoint); | |
125 | + forceWait(1000); | |
126 | + moveHeightScroll("100"); | |
127 | + click(claim); | |
128 | + mywait(checkpoint); | |
129 | + moveHeightScroll("100"); | |
130 | + click(agree); | |
131 | + click(confirm); | |
132 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
133 | + return new HomePage(driver); | |
134 | + } | |
135 | + | |
136 | + public HomePage confirmSailingDate() { | |
137 | + mywait(checkpoint); | |
138 | + forceWait(1000); | |
139 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | |
140 | + click(confirm); | |
141 | + return new HomePage(driver); | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * 认领船务登记船期待办 | |
146 | + * @return 首页 | |
147 | + */ | |
148 | + public HomePage toClaimShippingMark(){ | |
149 | + | |
150 | + dynamicWait(By.xpath("//*[contains(text(),'待办工作')]")); | |
151 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | |
152 | + if(isVisibility(By.xpath("//*[text()='认领']"))){ | |
153 | + moveHeightScroll("0"); | |
154 | + click(claim); | |
155 | + } | |
156 | + forceWait(3000); | |
157 | + mywait(checkpoint); | |
158 | + click(add); | |
159 | + sendKeys(inputShipperCompany,"essa"); | |
160 | + //设置开船日期 | |
161 | + jsExecutorRemoveAttribute(inputShipperStartDate,"readonly"); | |
162 | + inputShipperStartDate.clear(); | |
163 | +// String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy"); | |
164 | + sendKeys(inputShipperStartDate, Tools.getNextMonth()); | |
165 | + //设置预计到港日期 | |
166 | + jsExecutorRemoveAttribute(inputShipperArriveDate,"readonly"); | |
167 | + inputShipperArriveDate.clear(); | |
168 | + sendKeys(inputShipperArriveDate,Tools.getNextMonth()); | |
169 | + //提交 | |
170 | + click(submit); | |
171 | + dynamicLoad(); | |
172 | + return new HomePage(driver); | |
173 | + } | |
174 | + | |
175 | + | |
176 | +} | ... | ... |
src/main/java/com/essa/pageObject/needDealt/RegisOptShpDatePage.java
0 → 100644
... | ... | @@ -0,0 +1,70 @@ |
1 | +package com.essa.pageObject.needDealt; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.framework.Tools; | |
6 | +import com.essa.pageObject.HomePage; | |
7 | +import org.openqa.selenium.By; | |
8 | +import org.openqa.selenium.WebDriver; | |
9 | +import org.openqa.selenium.WebElement; | |
10 | +import org.openqa.selenium.support.FindBy; | |
11 | + | |
12 | +//认领登记备选船期待办页面 | |
13 | +public class RegisOptShpDatePage extends BasePage { | |
14 | + public RegisOptShpDatePage (WebDriver driver) { | |
15 | + super(driver); | |
16 | + } | |
17 | + | |
18 | + // 认领登记备选船期任务 | |
19 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div[4]/button") | |
20 | + WebElement ClaimTask; | |
21 | + | |
22 | + // 添加船务信息 | |
23 | + @FindBy(xpath = "//*[@id='wf_content']/div/div/button[1]") | |
24 | + WebElement AddShippInfo; | |
25 | + | |
26 | + // 添加船公司 | |
27 | + @FindBy(xpath = "//*[@id='wf_content']/form/table/tbody/tr/td/ng-form/div/div[1]/input") | |
28 | + WebElement AddShippCompanyInfo; | |
29 | + | |
30 | + // 设置开船日期 | |
31 | + @FindBy(xpath = "//*[@id='deliveryDate0']") | |
32 | + WebElement SetdeliveryDate0; | |
33 | + | |
34 | + // 设置到岗日期 | |
35 | + @FindBy(xpath = "//*[@id='estimatedArrivalDate0']") | |
36 | + WebElement SetEstimatedArrivalDate0; | |
37 | + | |
38 | + // 提交 | |
39 | + @FindBy(xpath = "//*[@id='tableViewList']/div/div/div/div[4]/span[1]/button[2]") | |
40 | + WebElement SubmitBtn; | |
41 | + | |
42 | + //流水号 | |
43 | + @FindBy (xpath = "//*[contains(text(),'流水号:RW')]") | |
44 | + WebElement serialNumber; | |
45 | + | |
46 | + /** | |
47 | + *登记船期 | |
48 | + * @param | |
49 | + * @return HomePage | |
50 | + */ | |
51 | + public HomePage toRegisOptShpDatePage(){ | |
52 | + dynamicWait(By.xpath("//*[contains(text(),'待办工作')]")); | |
53 | + if (isVisibility(By.xpath("//*[@id='tableViewList']/div/div/div/div[4]/button"))){ | |
54 | + click(ClaimTask);//如果需要认领,则认领 | |
55 | + forceWait(4000); | |
56 | + } | |
57 | + mywait(AddShippInfo); | |
58 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:")); | |
59 | + click(AddShippInfo); | |
60 | + mywait(AddShippCompanyInfo); | |
61 | + AddShippCompanyInfo.sendKeys("TestShippCompanyInfo"); | |
62 | + jsExecutorRemoveAttribute(SetdeliveryDate0, "readonly"); | |
63 | + sendKeys(SetdeliveryDate0, Tools.moreDays(20)); | |
64 | + jsExecutorRemoveAttribute(SetEstimatedArrivalDate0, "readonly"); | |
65 | + sendKeys(SetEstimatedArrivalDate0,Tools.moreDays(20)); | |
66 | + click(SubmitBtn); | |
67 | + dynamicLoad(); | |
68 | + return new HomePage(driver); | |
69 | + } | |
70 | +} | ... | ... |
src/main/java/com/essa/pageObject/needDealt/SellerFillInfoPage.java
0 → 100644
... | ... | @@ -0,0 +1,142 @@ |
1 | +package com.essa.pageObject.needDealt; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.pageObject.HomePage; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | + | |
11 | +//业务员补充船务资料待办页面 | |
12 | +public class SellerFillInfoPage extends BasePage { | |
13 | + public SellerFillInfoPage(WebDriver driver) { | |
14 | + super(driver); | |
15 | + } | |
16 | + | |
17 | + //选择货代来源 | |
18 | + @FindBy(xpath = "//*[text()='ESSA指定']") | |
19 | + WebElement AppointSet; | |
20 | + | |
21 | + //选择报关 | |
22 | + @FindBy(xpath = "//*[@id='shippingPanel1']/div[2]/div/div/label[2]") | |
23 | + WebElement DeclareSet; | |
24 | + | |
25 | + //选择货代 | |
26 | + @FindBy(xpath = "//*[text()='请选择货代']") | |
27 | + WebElement AppointCompanySet; | |
28 | + | |
29 | + //选择货代 | |
30 | + @FindBy(xpath = "//*[text()='中外运']") | |
31 | + WebElement AppointCompanySec; | |
32 | + | |
33 | + //确定选择货代 | |
34 | + @FindBy(xpath = "//*[text()='确定']") | |
35 | + WebElement CommitAppointCompanySec; | |
36 | + | |
37 | + //目标港口 | |
38 | + @FindBy(xpath = "//*[@id='shippingPanel2']/div[2]/div/div/input") | |
39 | + WebElement TargetPortSet; | |
40 | + | |
41 | + //发货人公司 | |
42 | + @FindBy(xpath = "//*[text()='汕头伊斯卡玩具有限公司']") | |
43 | + WebElement ConsignmentCompany; | |
44 | + | |
45 | + //收货公司 | |
46 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[1]/ng-form/div/div/div[1]/div/div/input") | |
47 | + WebElement HarvestCompany; | |
48 | + | |
49 | + //收货电话 | |
50 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[1]/ng-form/div/div/div[3]/div/div/input") | |
51 | + WebElement HarvestMobile; | |
52 | + | |
53 | + //收货传真 | |
54 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[1]/ng-form/div/div/div[4]/div/div/input") | |
55 | + WebElement HarvestFax; | |
56 | + | |
57 | + //收货邮编 | |
58 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[1]/ng-form/div/div/div[5]/div/div/input") | |
59 | + WebElement HarvestZipcode; | |
60 | + | |
61 | + //通知方公司 | |
62 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[2]/ng-form/div/div/div[1]/div/div/input") | |
63 | + WebElement SetNoticeCompany; | |
64 | + | |
65 | + //通知方电话号码 | |
66 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[2]/ng-form/div/div/div[3]/div/div/input") | |
67 | + WebElement SetNoticeMobile; | |
68 | + | |
69 | + //通知方邮编 | |
70 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[2]/ng-form/div/div/div[5]/div/div/input") | |
71 | + WebElement SetNoticeZipcode; | |
72 | + | |
73 | + //通知方传真 | |
74 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[2]/ng-form/div/div/div[4]/div/div/input") | |
75 | + WebElement SetNoticeFix; | |
76 | + | |
77 | + //寄单公司名称 | |
78 | + @FindBy(xpath = "//*[@id='shippingPanel5']/div[7]/div/div/div[1]/div/div/input") | |
79 | + WebElement MailCompanyName; | |
80 | + | |
81 | + //寄单联系人名称 | |
82 | + @FindBy(xpath = "//*[@id='shippingPanel5']/div[7]/div/div/div[2]/div/div/input") | |
83 | + WebElement MailConnecter; | |
84 | + | |
85 | + //寄单联系人名称 | |
86 | + @FindBy(xpath = "//*[@id='shippingPanel5']/div[7]/div/div/div[3]/div/div/input") | |
87 | + WebElement MailPhone; | |
88 | + | |
89 | + //寄单邮编 | |
90 | + @FindBy(xpath = "//*[@id='shippingPanel5']/div[7]/div/div/div[4]/div/div/input") | |
91 | + WebElement MailZipcode; | |
92 | + | |
93 | + //寄单传真 | |
94 | + @FindBy(xpath = "//*[@id='shippingPanel4']/div[2]/ng-form/div/div/div[4]/div/div/input") | |
95 | + WebElement MailFax; | |
96 | + | |
97 | + //寄单邮编 | |
98 | + @FindBy(xpath = "//*[text()='确认']") | |
99 | + WebElement SubmitBtn; | |
100 | + | |
101 | + //流水号 | |
102 | + @FindBy (xpath = "//*[contains(text(),'流水号:RW')]") | |
103 | + WebElement serialNumber; | |
104 | + | |
105 | + /** | |
106 | + *业务员填写船务资料 | |
107 | + * @param | |
108 | + * @return | |
109 | + */ | |
110 | + public HomePage toSellerFillInfo() { | |
111 | +// mywait(AppointSet); | |
112 | + dynamicWait(By.xpath("//*[contains(text(),'待办工作')]")); | |
113 | + Model.setSerialNum(partialStr(serialNumber.getText(), "流水号:"));//将流水号传递出去 | |
114 | + click(AppointSet); | |
115 | + click(DeclareSet); | |
116 | + click(AppointCompanySet); | |
117 | + forceWait(1000); | |
118 | + click(AppointCompanySec); | |
119 | + click(CommitAppointCompanySec); | |
120 | + mywait(TargetPortSet); | |
121 | + TargetPortSet.sendKeys("TestPort"); | |
122 | + click(ConsignmentCompany); | |
123 | + HarvestCompany.sendKeys("TestCompany"); | |
124 | + HarvestMobile.sendKeys("15888889999"); | |
125 | + HarvestFax.sendKeys("TestFax@test.com"); | |
126 | + HarvestZipcode.sendKeys("000000"); | |
127 | + | |
128 | + SetNoticeCompany.sendKeys("TestNoticeCompany"); | |
129 | + SetNoticeMobile.sendKeys("15888889999"); | |
130 | + SetNoticeFix.sendKeys("TestNoticeFix@test.com"); | |
131 | + SetNoticeZipcode.sendKeys("000000"); | |
132 | + | |
133 | + MailCompanyName.sendKeys("TestMailCompanyName"); | |
134 | + MailConnecter.sendKeys("TestMailConnecter"); | |
135 | + MailPhone.sendKeys("TestMailPhone"); | |
136 | + MailZipcode.sendKeys("TestMailZipCode"); | |
137 | + MailFax.sendKeys("TestMailFax"); | |
138 | + click(SubmitBtn); | |
139 | + dynamicLoad(); | |
140 | + return new HomePage(driver); | |
141 | + } | |
142 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/AddMatterialPage.java
0 → 100644
... | ... | @@ -0,0 +1,123 @@ |
1 | +package com.essa.pageObject.productDev; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.framework.Tools; | |
6 | +import org.openqa.selenium.WebDriver; | |
7 | +import org.openqa.selenium.WebElement; | |
8 | +import org.openqa.selenium.support.FindBy; | |
9 | +/* | |
10 | +* @Description: 新增物料页面 | |
11 | +* @Author: ZengJin | |
12 | +* @CreateTime: 2018/10/29 | |
13 | +*/ | |
14 | +public class AddMatterialPage extends BasePage { | |
15 | + /** | |
16 | + * 构造方法 | |
17 | + * | |
18 | + * @param driver | |
19 | + */ | |
20 | + public AddMatterialPage(WebDriver driver) { | |
21 | + super(driver); | |
22 | + } | |
23 | + | |
24 | + /* | |
25 | + 元素定位 | |
26 | + */ | |
27 | + @FindBy (xpath = "//*[text()='物料基础属性']") | |
28 | + WebElement checkPoint;//检查点,物料基础属性 | |
29 | + | |
30 | + @FindBy (xpath = "//*[@ng-model='item.supplierPrice']") | |
31 | + WebElement supplierPrice;//光身:供应商报价 | |
32 | + | |
33 | + @FindBy (xpath = "//*[@ng-model='item.bodyFclPrice']") | |
34 | + WebElement bodyFclPrice;//光身:供应商整柜报价 | |
35 | + | |
36 | + @FindBy (xpath = "//*[@ng-model='item.purchaseMoq']") | |
37 | + WebElement purchaseMoq;//光身:采购MOQ | |
38 | + | |
39 | + @FindBy (xpath = "//*[@ng-model='item.deliverDay']") | |
40 | + WebElement deliverDay;//光身:货期 | |
41 | + | |
42 | + @FindBy (xpath = "//*[@ng-click='save()']") | |
43 | + WebElement save;//保存 | |
44 | + | |
45 | + @FindBy (xpath = "//*[@ng-model='model.matFromType' and @ng-disabled='isUpdate']") | |
46 | + WebElement matFrom;//物料来源 | |
47 | + | |
48 | + @FindBy (xpath = "//*[@ng-model='model.name']") | |
49 | + WebElement matName;//物料名称 | |
50 | + | |
51 | + @FindBy (xpath = "//*[@ng-model='model.baseUnit']") | |
52 | + WebElement baseUnit;//基准单位 | |
53 | + | |
54 | + @FindBy (xpath = "//*[@ng-click='openSelector()']") | |
55 | + WebElement matType;//物料类型 | |
56 | + | |
57 | + @FindBy (xpath = "//*[text()='纸箱']") | |
58 | + WebElement carton;//物料类型:纸箱 | |
59 | + | |
60 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[3]/input") | |
61 | + WebElement factoryNo;//工厂货号 | |
62 | + | |
63 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[5]/select") | |
64 | + WebElement purchaseUnit;//物料采购单位 | |
65 | + | |
66 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[6]/input") | |
67 | + WebElement unitExchangeRate;//换算值 | |
68 | + | |
69 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[8]/input") | |
70 | + WebElement matSupplierPrice;//物料:供应商报价 | |
71 | + | |
72 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[10]/input") | |
73 | + WebElement matPurchaseMoq;//物料:采购MOQ | |
74 | + | |
75 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[12]/input") | |
76 | + WebElement matDeliverDay;//物料:货期 | |
77 | + | |
78 | + /* | |
79 | + 页面方法 | |
80 | + */ | |
81 | + /** | |
82 | + * @Description: 新增光身物料方法 | |
83 | + * @param: [] | |
84 | + * @return: 项目立项书列表 | |
85 | + * @Author: ZengJin | |
86 | + * @CreateTime: 2018/10/29 | |
87 | + */ | |
88 | + public ProjectListPage addBodyMat(){ | |
89 | + mywait(checkPoint); | |
90 | + moveHeightScroll("100"); | |
91 | + sendKeys(supplierPrice,"15"); | |
92 | + sendKeys(bodyFclPrice,"14"); | |
93 | + sendKeys(purchaseMoq,"15"); | |
94 | + sendKeys(deliverDay,"7"); | |
95 | + click(save); | |
96 | + return new ProjectListPage(driver); | |
97 | + } | |
98 | + /** | |
99 | + * @Description:新增物料 | |
100 | + * @return: 物料列表页 | |
101 | + * @Author: ZengJin | |
102 | + * @CreateTime: 2018/10/29 | |
103 | + */ | |
104 | + public MaterialListPage addMaterial(){ | |
105 | + mywait(checkPoint); | |
106 | + selectElement(matFrom,"自主物料"); | |
107 | + Model.setMaterialName("物料" + Tools.getTime()); | |
108 | + sendKeys(matName,Model.getMaterialName()); | |
109 | + selectElement(baseUnit,"只"); | |
110 | + moveHeightScroll("100"); | |
111 | + click(matType); | |
112 | + click(carton); | |
113 | + forceWait(1000); | |
114 | + sendKeys(factoryNo,Tools.getFactoryNo()); | |
115 | + selectElement(purchaseUnit,"只"); | |
116 | + sendKeys(unitExchangeRate,"1"); | |
117 | + sendKeys(matSupplierPrice,"5"); | |
118 | + sendKeys(matPurchaseMoq,"15"); | |
119 | + sendKeys(matDeliverDay,"5"); | |
120 | + click(save); | |
121 | + return new MaterialListPage(driver); | |
122 | + } | |
123 | +} | ... | ... |
src/test/java/com/essa/pageObject/productDev/AddProjectPage.java renamed to src/main/java/com/essa/pageObject/productDev/AddProjectPage.java
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 | -} | |
1 | +package com.essa.pageObject.productDev; | |
2 | + | |
3 | +import com.essa.framework.Model; | |
4 | +import com.essa.framework.Tools; | |
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 | +import java.util.Date; | |
13 | + | |
14 | +/** | |
15 | + * @author Administrator | |
16 | + *新增项目立项书 | |
17 | + */ | |
18 | +public class AddProjectPage extends BasePage { | |
19 | + public AddProjectPage(WebDriver driver) { | |
20 | + super(driver); | |
21 | + } | |
22 | + /* | |
23 | + * 元素定位 | |
24 | + */ | |
25 | + //改版类型 | |
26 | + @FindBy (xpath ="//*[@dic-list='改版类型']") | |
27 | + WebElement revisonType; | |
28 | + | |
29 | + //项目名称 | |
30 | + @FindBy (xpath ="//*[@ng-model='model.name']") | |
31 | + WebElement projectName; | |
32 | + | |
33 | + //项目负责人 | |
34 | + @FindBy (xpath ="//*[@ng-model='model.leaderId']/input") | |
35 | + WebElement projectLeader; | |
36 | + | |
37 | + //项目负责人-林荣 | |
38 | + @FindBy (xpath ="//*[@id='role-user-select-box']/ul/li[3]/span") | |
39 | + WebElement linrong; | |
40 | + | |
41 | + //开发程度 | |
42 | + @FindBy (xpath ="//*[@dic-list='开发程度']") | |
43 | + WebElement devLevel; | |
44 | + | |
45 | + //开发系列 | |
46 | + @FindBy (xpath ="//*[@ng-model='model.serialId']") | |
47 | + WebElement devSerial; | |
48 | + | |
49 | + //团队成员-新增 | |
50 | + @FindBy (xpath ="//button[text()='新增']") | |
51 | + WebElement addMember; | |
52 | + | |
53 | + //任务处理人 -第一个 | |
54 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[1]/td[2]/div/input") | |
55 | + WebElement Transactor1; | |
56 | + | |
57 | + //处理人-linrong | |
58 | + @FindBy (xpath ="//tbody//tr[1]//td[2]//div[1]//div[1]//ul[1]//li[3]") | |
59 | + WebElement linrong1; | |
60 | + | |
61 | + //任务处理人 -第二个 | |
62 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[2]/td[2]/div/input") | |
63 | + WebElement Transactor2; | |
64 | + | |
65 | + //处理人-第二个 | |
66 | + @FindBy (xpath ="//tbody//tr[2]//td[2]//div[1]//div[1]//ul[1]//li[3]") | |
67 | + WebElement linrong2; | |
68 | + | |
69 | + //成员角色 -第一个 | |
70 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[1]/td[3]/select") | |
71 | + WebElement role1; | |
72 | + | |
73 | + //成员角色 -第二个 | |
74 | + @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[2]/td[3]/select") | |
75 | + WebElement role2; | |
76 | + | |
77 | + //选择改版商品信息 | |
78 | + @FindBy (xpath ="//*[text()='选择']") | |
79 | + WebElement selectGoods; | |
80 | + | |
81 | + @FindBy (xpath = "//*[@name='keyword']") | |
82 | + WebElement searchContent; | |
83 | + | |
84 | + //添加商品-查询按钮 | |
85 | + @FindBy (xpath = "//*[@ng-click='search(false)']") | |
86 | + WebElement addSkuSearch; | |
87 | + | |
88 | + //添加商品-展开商品信息 | |
89 | + @FindBy (xpath = "//*[contains(@class,'fa fa-angle-double-dow')]") | |
90 | + WebElement showSku; | |
91 | + | |
92 | + //添加商品-搜索结果复选框 | |
93 | + @FindBy (xpath = "//*[@ng-repeat='list in item.skus']/tbody") | |
94 | + WebElement skuCheckbox; | |
95 | + | |
96 | + //确定按钮 | |
97 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | |
98 | + WebElement confirm; | |
99 | + | |
100 | + //保存 | |
101 | + @FindBy (xpath ="//*[contains(text(),'保存')]") | |
102 | + WebElement save; | |
103 | + | |
104 | + //新增光身物料 | |
105 | + @FindBy (xpath = "//*[@ng-click='relateAdd()']") | |
106 | + WebElement addBodyMat; | |
107 | + | |
108 | + /* | |
109 | + 页面方法 | |
110 | + */ | |
111 | + /* | |
112 | + * @Description:新增项目立项书 | |
113 | + * @param: [] | |
114 | + * @return: 新增光身物料页面 | |
115 | + * @Author: ZengJin | |
116 | + * @CreateTime: 2018/10/29 | |
117 | + */ | |
118 | + public AddMatterialPage addProject(){ | |
119 | + mywait(revisonType); | |
120 | + selectElement(revisonType,"自主改版"); | |
121 | + Model.setProjectName("自主改版"+ Tools.getTime()); | |
122 | + sendKeys(projectName,Model.getProjectName()); | |
123 | + click(projectLeader); | |
124 | + click(linrong); | |
125 | + selectElement(devLevel,"小改"); | |
126 | + selectElement(devSerial,"男孩系列"); | |
127 | + click(addMember); | |
128 | + click(Transactor1); | |
129 | + forceWait(500); | |
130 | + click(linrong1); | |
131 | + selectElement(role1,"项目经理"); | |
132 | + click(Transactor2); | |
133 | + forceWait(500); | |
134 | + click(linrong2); | |
135 | + selectElement(role2,"翻译人员"); | |
136 | + click(selectGoods); | |
137 | + dynamicLoad(By.xpath("//*[@class='loading ng-scope']")); | |
138 | + String no = DBSqlSearch("SELECT no FROM prd_goods_sku WHERE src=1 ORDER BY create_time DESC LIMIT 1","no"); | |
139 | + sendKeys(searchContent,no); | |
140 | + click(addSkuSearch); | |
141 | + forceWait(1000); | |
142 | + click(showSku); | |
143 | + click(skuCheckbox); | |
144 | + click(confirm); | |
145 | + forceWait(3000); | |
146 | + click(save); | |
147 | + forceWait(1000); | |
148 | + click(addBodyMat); | |
149 | + return new AddMatterialPage(driver); | |
150 | + } | |
151 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/EditBOMPage.java
0 → 100644
... | ... | @@ -0,0 +1,76 @@ |
1 | +package com.essa.pageObject.productDev; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import org.openqa.selenium.WebDriver; | |
6 | +import org.openqa.selenium.WebElement; | |
7 | +import org.openqa.selenium.support.FindBy; | |
8 | + | |
9 | +/** | |
10 | +* @Description: BOM修改页面 | |
11 | +* @Author: ZengJin | |
12 | +* @CreateTime: 2018/10/29 | |
13 | +*/ | |
14 | +public class EditBOMPage extends BasePage { | |
15 | + /** | |
16 | + * 构造方法 | |
17 | + * | |
18 | + * @param driver | |
19 | + */ | |
20 | + public EditBOMPage(WebDriver driver) { | |
21 | + super(driver); | |
22 | + } | |
23 | + /** | |
24 | + * 元素定位 | |
25 | + */ | |
26 | + @FindBy (xpath = "//*[@ng-click='materialChoose()']") | |
27 | + WebElement matChoose;//物料选取 | |
28 | + | |
29 | + @FindBy (xpath = "//*[@name='keyword']") | |
30 | + WebElement keyword;//关键字查询 | |
31 | + | |
32 | + @FindBy (xpath = "//*[@name='keyword']/../span/button") | |
33 | + WebElement search;//查询按钮 | |
34 | + | |
35 | + @FindBy (xpath = "//*[@ng-click='materialSelected(item)']") | |
36 | + WebElement checkbox;//复选框 | |
37 | + | |
38 | + @FindBy (xpath = "//*[contains(text(),'选定')]") | |
39 | + WebElement selectedConfirm;//选定 | |
40 | + | |
41 | + @FindBy (xpath = "//*[text()='设置']") | |
42 | + WebElement set;//集单物料:设置 | |
43 | + | |
44 | + @FindBy (xpath = "//*[@ng-click='selectBulkMat(item)']") | |
45 | + WebElement selectBulkMat;//待选择的物料 | |
46 | + | |
47 | + @FindBy (xpath = "//*[@ng-click='save()']") | |
48 | + WebElement save;//确定修改 | |
49 | + | |
50 | + /** | |
51 | + * 页面方法 | |
52 | + */ | |
53 | + /** | |
54 | + *编辑BOM,设置集单物料等 | |
55 | + * @param | |
56 | + * @return 项目立项书列表 | |
57 | + */ | |
58 | + public ProjectListPage editBom(){ | |
59 | + mywait(matChoose); | |
60 | + click(matChoose); | |
61 | + forceWait(500); | |
62 | + sendKeys(keyword, Model.getMaterialName()); | |
63 | + click(search); | |
64 | + forceWait(1000); | |
65 | + click(checkbox); | |
66 | + click(selectedConfirm); | |
67 | + forceWait(500); | |
68 | + click(set); | |
69 | + click(selectBulkMat); | |
70 | + click(selectedConfirm); | |
71 | + forceWait(500); | |
72 | + click(save); | |
73 | + return new ProjectListPage(driver); | |
74 | + } | |
75 | + | |
76 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/MaterialListPage.java
0 → 100644
... | ... | @@ -0,0 +1,65 @@ |
1 | +package com.essa.pageObject.productDev; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import org.openqa.selenium.WebDriver; | |
6 | +import org.openqa.selenium.WebElement; | |
7 | +import org.openqa.selenium.support.FindBy; | |
8 | + | |
9 | +/* | |
10 | +* @Description:物料列表页面 | |
11 | +* @Author: ZengJin | |
12 | +* @CreateTime: 2018/10/29 | |
13 | +*/ | |
14 | +public class MaterialListPage extends BasePage { | |
15 | + /** | |
16 | + * 构造方法 | |
17 | + * | |
18 | + * @param driver | |
19 | + */ | |
20 | + public MaterialListPage(WebDriver driver) { | |
21 | + super(driver); | |
22 | + } | |
23 | + /* | |
24 | + 元素定位 | |
25 | + */ | |
26 | + @FindBy (xpath = "//table[@id='table-material-list']//tbody/tr[1]") | |
27 | + WebElement firstResult;//列表第一个结果 | |
28 | + | |
29 | + @FindBy (xpath = "//*[@name='keyWord']") | |
30 | + WebElement keyword;//关键字查询 | |
31 | + | |
32 | + @FindBy (xpath = "//*[@name='keyWord']/../span/button") | |
33 | + WebElement search;//查询按钮 | |
34 | + | |
35 | + @FindBy (xpath = "//*[contains(text(),'供应商关联类型设置')]") | |
36 | + WebElement supplierCatConfig;//供应商关联类型设置 | |
37 | + | |
38 | + @FindBy (xpath = "//tr[@class='ng-scope active']//select[@class='form-control ng-isolate-scope ng-pristine ng-valid']") | |
39 | + WebElement AssociatioType;//关联类型 | |
40 | + | |
41 | + @FindBy (xpath = "//button[contains(text(),'确定')]") | |
42 | + WebElement confirm;//确定 | |
43 | + | |
44 | + /* | |
45 | + 页面方法 | |
46 | + */ | |
47 | + /** | |
48 | + * @Description:设置核心供应商 | |
49 | + * @return: 物料列表 | |
50 | + * @Author: ZengJin | |
51 | + * @CreateTime: 2018/10/29 | |
52 | + */ | |
53 | + public MaterialListPage setSupplierCatConfig(){ | |
54 | + mywait(firstResult); | |
55 | + sendKeys(keyword,Model.getMaterialName()); | |
56 | + click(search); | |
57 | + mywait(firstResult); | |
58 | + forceWait(1000); | |
59 | + click(supplierCatConfig); | |
60 | + forceWait(1000); | |
61 | + selectElement(AssociatioType,"核心供应商"); | |
62 | + click(confirm); | |
63 | + return new MaterialListPage(driver); | |
64 | + } | |
65 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/ProjectListPage.java
0 → 100644
... | ... | @@ -0,0 +1,99 @@ |
1 | +package com.essa.pageObject.productDev; | |
2 | + | |
3 | +import com.essa.framework.BasePage; | |
4 | +import com.essa.framework.Model; | |
5 | +import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | |
6 | +import org.openqa.selenium.By; | |
7 | +import org.openqa.selenium.WebDriver; | |
8 | +import org.openqa.selenium.WebElement; | |
9 | +import org.openqa.selenium.support.FindBy; | |
10 | + | |
11 | +/** | |
12 | +* @Description: 项目立项书列表页面 | |
13 | +* @Author: ZengJin | |
14 | +* @CreateTime: 2018/10/29 | |
15 | +*/ | |
16 | +public class ProjectListPage extends BasePage { | |
17 | + /** | |
18 | + * 构造方法 | |
19 | + * | |
20 | + * @param driver | |
21 | + */ | |
22 | + public ProjectListPage(WebDriver driver) { | |
23 | + super(driver); | |
24 | + } | |
25 | + | |
26 | + /** | |
27 | + 元素定位 | |
28 | + */ | |
29 | + @FindBy (xpath = "//table[@class='tree-grid table table-hover table-even-striped no-border border-default text-center table-fixed ng-scope ng-table']//tbody//tr[1]") | |
30 | + WebElement firstResult;//第一个查询结果 | |
31 | + | |
32 | + @FindBy (xpath = "//*[@name='keyWord']") | |
33 | + WebElement keyword;//关键字查询 | |
34 | + | |
35 | + @FindBy (xpath = "//*[@name='keyWord']/../span/button") | |
36 | + WebElement search;//查询按钮 | |
37 | + | |
38 | + @FindBy (xpath = "//*[@ng-click='updateBom()']") | |
39 | + WebElement updateBom;//BOM更新 | |
40 | + | |
41 | + @FindBy (xpath = "//*[text()='确定']") | |
42 | + WebElement confirm;//确定按钮 | |
43 | + | |
44 | + @FindBy (xpath = "//*[@ng-click='singleGoodsPublic()']") | |
45 | + WebElement DevGoodPublic;//开发单品发布 | |
46 | + | |
47 | + @FindBy (xpath = "//*[contains(text(),'不选择SPU')]") | |
48 | + WebElement NotChooseSpu;//不选择SPU | |
49 | + | |
50 | + @FindBy (xpath = "//*[@data-ng-bind='item.publishSkuCode']") | |
51 | + WebElement DevGoodNo;//开发商品编号 | |
52 | + | |
53 | + /** | |
54 | + * 页面方法 | |
55 | + */ | |
56 | + /** | |
57 | + *BOM更新方法 | |
58 | + * @param | |
59 | + * @return 编辑BOM页面 | |
60 | + */ | |
61 | + public EditBOMPage updateBom(){ | |
62 | + mywait(firstResult); | |
63 | + sendKeys(keyword,Model.getProjectName()); | |
64 | + click(search); | |
65 | + dynamicLoad(); | |
66 | + click(firstResult); | |
67 | + click(updateBom); | |
68 | + return new EditBOMPage(driver); | |
69 | + } | |
70 | + | |
71 | + /** | |
72 | + *开发单品发布,由于这里只是点击一下保存,故共用新增原厂商品的一个保存方法 | |
73 | + * @param | |
74 | + * @return 确认开发商品档案页面 | |
75 | + */ | |
76 | + public AddOriginalGoodsPage publicDevGood(){ | |
77 | + click(confirm); | |
78 | + sendKeys(keyword,Model.getProjectName()); | |
79 | + dynamicWait(By.xpath("//table[@class='tree-grid table table-hover table-even-striped no-border border-default text-center table-fixed ng-scope ng-table']//tbody//tr[1]")); | |
80 | + click(search); | |
81 | + dynamicLoad(); | |
82 | + click(firstResult); | |
83 | + click(DevGoodPublic); | |
84 | + forceWait(1000); | |
85 | + click(NotChooseSpu); | |
86 | + return new AddOriginalGoodsPage(driver); | |
87 | + } | |
88 | + /** | |
89 | + *获取到开发商品的编号,并且传递到model的skuNo字段中 | |
90 | + * @param | |
91 | + * @return | |
92 | + */ | |
93 | + public void getDevGoodNo(){ | |
94 | + sendKeys(keyword,Model.getProjectName()); | |
95 | + click(search); | |
96 | + dynamicLoad(); | |
97 | + Model.setSkuNo(getText(DevGoodNo)); | |
98 | + } | |
99 | +} | ... | ... |
src/test/java/com/essa/testSuite/SendEmail.java renamed to src/main/java/com/essa/testSuite/SendEmail.java
... | ... | @@ -16,7 +16,11 @@ import javax.mail.internet.InternetAddress; |
16 | 16 | import javax.mail.internet.MimeBodyPart; |
17 | 17 | import javax.mail.internet.MimeMessage; |
18 | 18 | import javax.mail.internet.MimeMultipart; |
19 | - | |
19 | +/* | |
20 | +* @Description:发送邮件的demo | |
21 | +* @Author: ZengJin | |
22 | +* @CreateTime: 2018/10/29 | |
23 | +*/ | |
20 | 24 | public class SendEmail { |
21 | 25 | |
22 | 26 | public static void main(String[] args) { | ... | ... |
... | ... | @@ -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/TestAddDevGood.java
0 → 100644
... | ... | @@ -0,0 +1,83 @@ |
1 | +package com.essa.testSuite; | |
2 | + | |
3 | +import com.essa.pageObject.BaseTest; | |
4 | +import com.essa.pageObject.GoodsManage.*; | |
5 | +import com.essa.pageObject.HomePage; | |
6 | +import com.essa.pageObject.productDev.*; | |
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.Test; | |
12 | + | |
13 | + | |
14 | +/** | |
15 | +* @Description: 新增开发商品测试用例 | |
16 | +* @Author: ZengJin | |
17 | +* @CreateTime: 2018/10/29 | |
18 | +*/ | |
19 | +public class TestAddDevGood extends BaseTest { | |
20 | + | |
21 | + WebDriver driver; | |
22 | + | |
23 | + @BeforeClass | |
24 | + public void setUp() { | |
25 | + initsetUp(); | |
26 | + loginValid("linrong"); | |
27 | + } | |
28 | + | |
29 | + @AfterClass | |
30 | + public void tearDown() { | |
31 | + driver.quit(); | |
32 | + } | |
33 | + | |
34 | + | |
35 | + /** | |
36 | + *新增开发商品 | |
37 | + * @param | |
38 | + * @return void | |
39 | + */ | |
40 | + @Test | |
41 | + public void addDevGood(){ | |
42 | + this.driver = getDriver(); | |
43 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | |
44 | + AddProjectPage addProjectPage = PageFactory.initElements(driver,AddProjectPage.class); | |
45 | + AddMatterialPage addMatterialPage = PageFactory.initElements(driver,AddMatterialPage.class); | |
46 | + MaterialListPage materialListPage = PageFactory.initElements(driver,MaterialListPage.class); | |
47 | + ProjectListPage projectListPage = PageFactory.initElements(driver,ProjectListPage.class); | |
48 | + EditBOMPage editBOMPage = PageFactory.initElements(driver,EditBOMPage.class); | |
49 | + AddOriginalGoodsPage addOriginalGoodsPage = PageFactory.initElements(driver,AddOriginalGoodsPage.class); | |
50 | + homePage.toAddProject(); | |
51 | + addProjectPage.addProject();//新增立项书 | |
52 | + addMatterialPage.addBodyMat();//新增光身物料 | |
53 | + homePage.toMaterialPage(); | |
54 | + addMatterialPage.addMaterial();//新增物料 | |
55 | + materialListPage.setSupplierCatConfig();//设置核心供应商 | |
56 | + homePage.toProjectListPage(); | |
57 | + projectListPage.updateBom();//更新BOM | |
58 | + editBOMPage.editBom();//编辑BOM,设置集单物料 | |
59 | + projectListPage.publicDevGood();//发布开发单品 | |
60 | + addOriginalGoodsPage.addDevGood();//确认发布开发商品 | |
61 | + projectListPage.getDevGoodNo();//将新增的skuNo传递到model | |
62 | + } | |
63 | + /** | |
64 | + *审核开发商品 | |
65 | + * @param | |
66 | + * @return | |
67 | + */ | |
68 | + @Test | |
69 | + public void publicDevGood(){ | |
70 | + this.driver = getDriver(); | |
71 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | |
72 | + GoodsRelesePage goodsRelesePage = PageFactory.initElements(driver,GoodsRelesePage.class); | |
73 | + UpdatePicPage updatePicPage = PageFactory.initElements(driver,UpdatePicPage.class); | |
74 | + AuditDevGoodsPage auditDevGoodsPage = PageFactory.initElements(driver,AuditDevGoodsPage.class); | |
75 | + AuditOriginalOpreatePage auditOriginalOpreatePage = PageFactory.initElements(driver,AuditOriginalOpreatePage.class); | |
76 | + homePage.tGoodsRelesePage(); | |
77 | + goodsRelesePage.toUpdateDevGoodPic();//更新开发商品图片 | |
78 | + updatePicPage.upDatePic(); | |
79 | + homePage.toAuditDevgoodsPage();//进入开发商品发布审核 | |
80 | + auditDevGoodsPage.auditDevGood(); | |
81 | + auditOriginalOpreatePage.auditDevGoodPass();//审核通过 | |
82 | + } | |
83 | +} | ... | ... |
src/test/java/com/essa/testSuite/TestAddMarketGoods.java renamed to src/main/java/com/essa/testSuite/TestAddMarketGoods.java
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 | -} | |
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/test/java/com/essa/testSuite/TestAddOriginalGoods.java renamed to src/main/java/com/essa/testSuite/TestAddOriginalGoods.java
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 | -} | |
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 | +} | ... | ... |