Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
52d67fab
Commit
52d67fab
authored
Nov 20, 2018
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
57e0a8e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
test.java
src/test/java/ui/cases/test.java
+12
-2
No files found.
src/test/java/ui/cases/test.java
View file @
52d67fab
...
...
@@ -21,6 +21,8 @@ import ui.common.WebDriverType;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Date
;
import
static
com
.
codeborne
.
selenide
.
Condition
.
text
;
import
static
com
.
codeborne
.
selenide
.
Selenide
.
$
;
...
...
@@ -76,6 +78,7 @@ public class test {
}
@AfterMethod
(
alwaysRun
=
true
)
public
void
afterMethod
(
ITestResult
result
)
throws
Exception
{
if
(!
result
.
isSuccess
())
...
...
@@ -85,9 +88,16 @@ public class test {
File
file
=
new
File
(
"C:/image"
);
Reporter
.
setCurrentTestResult
(
result
);
Reporter
.
log
(
file
.
getAbsolutePath
());
Reporter
.
log
(
"<img src='"
+
"http://172.16.80.106"
+
"/"
+
result
.
getName
()
+
".jpg' hight='400' width='400'/>"
);
String
time
=
String
.
valueOf
(
System
.
currentTimeMillis
());
Reporter
.
log
(
"<img src='"
+
"http://172.16.80.106"
+
"/"
+
result
.
getName
()
+
"_"
+
time
+
".jpg' hight='600' width='600'/>"
);
File
srcFile
=
((
TakesScreenshot
)
driver
).
getScreenshotAs
(
OutputType
.
FILE
);
//执行屏幕截取
FileUtils
.
copyFile
(
srcFile
,
new
File
(
file
.
getAbsolutePath
()
+
"/"
+
result
.
getName
()
+
".jpg"
));
FileUtils
.
copyFile
(
srcFile
,
new
File
(
file
.
getAbsolutePath
()
+
"/"
+
result
.
getName
()
+
"_"
+
time
+
".jpg"
));
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
System
.
currentTimeMillis
());
System
.
out
.
println
(
Calendar
.
getInstance
().
getTimeInMillis
());
System
.
out
.
println
(
new
Date
().
getTime
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment