Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
f08695c8
Commit
f08695c8
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: investigate issue with LTI selenium
parent
91121ee6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/org/olat/selenium/page/course/LTIPage.java
+17
-13
17 additions, 13 deletions
src/test/java/org/olat/selenium/page/course/LTIPage.java
src/test/java/org/olat/selenium/page/graphene/OOGraphene.java
+19
-0
19 additions, 0 deletions
...test/java/org/olat/selenium/page/graphene/OOGraphene.java
with
36 additions
and
13 deletions
src/test/java/org/olat/selenium/page/course/LTIPage.java
+
17
−
13
View file @
f08695c8
...
@@ -45,19 +45,23 @@ public class LTIPage {
...
@@ -45,19 +45,23 @@ public class LTIPage {
}
}
public
LTIPage
start
()
{
public
LTIPage
start
()
{
By
startBy
=
By
.
xpath
(
"//div[contains(@class,'o_button_group')]/a[contains(@onclick,'start')]"
);
try
{
OOGraphene
.
waitElement
(
startBy
,
browser
);
By
startBy
=
By
.
xpath
(
"//div[contains(@class,'o_button_group')]/a[contains(@onclick,'start')]"
);
browser
.
findElement
(
startBy
).
click
();
OOGraphene
.
waitElement
(
startBy
,
browser
);
browser
.
findElement
(
startBy
).
click
();
By
iframeBy
=
By
.
cssSelector
(
".o_iframedisplay iframe"
);
OOGraphene
.
waitElement
(
iframeBy
,
browser
);
By
iframeBy
=
By
.
cssSelector
(
".o_iframedisplay iframe"
);
OOGraphene
.
waitElement
(
iframeBy
,
browser
);
List
<
WebElement
>
iframes
=
browser
.
findElements
(
iframeBy
);
browser
=
browser
.
switchTo
().
frame
(
iframes
.
get
(
0
));
WebElement
iframe
=
browser
.
findElement
(
iframeBy
);
WebDriver
iframeBrowser
=
browser
.
switchTo
().
frame
(
iframe
);
By
launchedBy
=
By
.
xpath
(
"//p[contains(text(),'Launch Validated.')]"
);
OOGraphene
.
waitElement
(
launchedBy
,
browser
);
By
launchedBy
=
By
.
xpath
(
"//p[contains(text(),'Launch Validated.')]"
);
OOGraphene
.
waitElement
(
launchedBy
,
iframeBrowser
);
}
catch
(
Exception
e
)
{
OOGraphene
.
takeScreenshot
(
"LTIPage::start"
,
browser
);
throw
e
;
}
return
this
;
return
this
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/olat/selenium/page/graphene/OOGraphene.java
+
19
−
0
View file @
f08695c8
...
@@ -21,6 +21,7 @@ package org.olat.selenium.page.graphene;
...
@@ -21,6 +21,7 @@ package org.olat.selenium.page.graphene;
import
java.io.File
;
import
java.io.File
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -31,11 +32,13 @@ import java.util.function.Predicate;
...
@@ -31,11 +32,13 @@ import java.util.function.Predicate;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.olat.core.logging.Tracing
;
import
org.olat.core.logging.Tracing
;
import
org.olat.core.util.FileUtils
;
import
org.olat.core.util.StringHelper
;
import
org.olat.core.util.StringHelper
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.ElementNotVisibleException
;
import
org.openqa.selenium.ElementNotVisibleException
;
import
org.openqa.selenium.JavascriptExecutor
;
import
org.openqa.selenium.JavascriptExecutor
;
import
org.openqa.selenium.StaleElementReferenceException
;
import
org.openqa.selenium.StaleElementReferenceException
;
import
org.openqa.selenium.TakesScreenshot
;
import
org.openqa.selenium.TimeoutException
;
import
org.openqa.selenium.TimeoutException
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.WebElement
;
...
@@ -746,4 +749,20 @@ public class OOGraphene {
...
@@ -746,4 +749,20 @@ public class OOGraphene {
//e.printStackTrace();
//e.printStackTrace();
}
}
}
}
public
static
void
takeScreenshot
(
String
test
,
WebDriver
browser
)
{
TakesScreenshot
scrShot
=
((
TakesScreenshot
)
browser
);
File
screenFile
=
scrShot
.
getScreenshotAs
(
org
.
openqa
.
selenium
.
OutputType
.
FILE
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd'T'HHmmss"
);
String
filename
=
test
+
""
+
format
.
format
(
new
Date
())
+
".jpg"
;
File
path
=
new
File
(
"screenshots"
);
if
(!
path
.
exists
()
&&
!
path
.
mkdirs
())
{
path
=
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
),
"screenshots"
);
path
.
mkdirs
();
}
File
screenshotFile
=
new
File
(
path
,
filename
);
log
.
error
(
"Write screenshot: {} {}"
,
test
,
screenshotFile
);
FileUtils
.
copyFileToFile
(
screenFile
,
screenshotFile
,
true
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment