Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
beat
beat.web
Commits
453f415e
Commit
453f415e
authored
7 years ago
by
Jaden Diefenbaugh
Browse files
Options
Downloads
Patches
Plain Diff
add test for adding experiments to report
parent
ff6f6ce4
No related branches found
No related tags found
1 merge request
!223
Reports overhaul
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/reports/static/reports/test/report-spec.js
+64
-17
64 additions, 17 deletions
beat/web/reports/static/reports/test/report-spec.js
with
64 additions
and
17 deletions
beat/web/reports/static/reports/test/report-spec.js
+
64
−
17
View file @
453f415e
// general tests for the reports app
describe
(
'
reports app
'
,
function
(){
const
until
=
protractor
.
ExpectedConditions
;
browser
.
ignoreSynchronization
=
true
;
// just to make sure the window is maximized
browser
.
driver
.
manage
().
window
().
maximize
();
// login to the default user ('user') once before running all these tests
beforeAll
(
function
(){
browser
.
get
(
'
http://localhost:8000/login/?next=/
'
);
//browser.findElement(by.partialLinkText('Sign-in')).click();
browser
.
findElement
(
by
.
id
(
'
id_username
'
)).
sendKeys
(
'
user
'
);
browser
.
findElement
(
by
.
id
(
'
id_password
'
)).
sendKeys
(
'
user
'
);
browser
.
findElement
(
by
.
partialButtonText
(
'
Sign-in
'
)).
click
();
return
browser
.
wait
(
function
(){
return
browser
.
getCurrentUrl
().
then
(
function
(
url
){
const
rxUserLoggedIn
=
/events
\/
user
\/
/
;
return
rxUserLoggedIn
.
test
(
url
);
});
});
});
// if there's an error in the web browser's console,
// fail the test and print the error
...
...
@@ -23,33 +41,19 @@ describe('reports app', function(){
// /reports
describe
(
'
home
'
,
function
(){
beforeEach
(
function
(){
browser
.
get
(
'
http://localhost:8000/reports
'
);
browser
.
get
(
'
http://localhost:8000/reports
/user
'
);
});
it
(
'
should load
'
,
function
(){
expect
(
browser
.
getTitle
()).
toEqual
(
'
BEAT -
Public
Reports
'
);
expect
(
browser
.
getTitle
()).
toEqual
(
"
BEAT -
user's
Reports
"
);
});
});
// /reports/user
describe
(
'
home for the test user
'
,
function
(){
// login to the default user ('user') once before running all these tests
beforeAll
(
function
(){
browser
.
get
(
'
http://localhost:8000/login/?next=/
'
);
//browser.findElement(by.partialLinkText('Sign-in')).click();
browser
.
findElement
(
by
.
id
(
'
id_username
'
)).
sendKeys
(
'
user
'
);
browser
.
findElement
(
by
.
id
(
'
id_password
'
)).
sendKeys
(
'
user
'
);
browser
.
findElement
(
by
.
partialButtonText
(
'
Sign-in
'
)).
click
();
return
browser
.
wait
(
function
(){
return
browser
.
getCurrentUrl
().
then
(
function
(
url
){
const
rxUserLoggedIn
=
/events
\/
user
\/
/
;
return
rxUserLoggedIn
.
test
(
url
);
});
});
});
// go to user's reports page before each test
before
Each
(
function
(){
before
All
(
function
(){
browser
.
get
(
'
http://localhost:8000/reports/user/
'
);
});
...
...
@@ -82,4 +86,47 @@ describe('reports app', function(){
expect
(
browser
.
getTitle
()).
toBe
(
'
BEAT - Report
'
);
});
});
describe
(
'
adding experiments to the "test" report
'
,
function
(){
// go to experiments page
beforeAll
(
function
(){
browser
.
get
(
'
http://localhost:8000/experiments/user/
'
);
});
it
(
'
should show the experiments list page
'
,
function
(){
expect
(
browser
.
getTitle
()).
toEqual
(
"
BEAT - user's Experiments
"
);
});
it
(
'
should list successfully-ran experiments accessible by user
'
,
function
(){
expect
(
browser
.
isElementPresent
(
by
.
css
(
'
.Done
'
))).
toBeTruthy
();
});
it
(
'
should add up to the first 5 experiments to the "test" report
'
,
function
(){
let
finishedExpTableRows
=
element
.
all
(
by
.
css
(
'
.Done
'
));
let
addButton
=
element
(
by
.
css
(
'
#add-to-report
'
));
expect
(
addButton
.
getAttribute
(
'
disabled
'
)).
toBe
(
'
true
'
);
let
fiveRows
=
finishedExpTableRows
.
filter
((
r
,
i
)
=>
i
<
5
);
fiveRows
.
then
(
rs
=>
Promise
.
all
(
rs
.
map
(
r
=>
r
.
element
(
by
.
css
(
'
.report-checkbox
'
)).
element
(
by
.
css
(
'
input
'
)).
click
())))
.
then
(()
=>
{
browser
.
wait
(
until
.
elementToBeClickable
(
addButton
),
5000
,
'
Button still isnt clickable!
'
);
return
browser
.
executeScript
(
'
arguments[0].click();
'
,
addButton
.
getWebElement
());
})
.
then
(()
=>
browser
.
wait
(
until
.
presenceOf
(
element
(
by
.
css
(
'
.modal
'
))),
5000
,
'
Element taking too long to appear in the DOM
'
))
.
then
(()
=>
element
(
by
.
css
(
'
.chosen-single
'
)).
click
())
.
then
(()
=>
element
(
by
.
css
(
'
.chosen-results
'
)).
element
(
by
.
css
(
'
.active-result
'
)).
click
())
.
then
(()
=>
{
let
submitButton
=
element
(
by
.
buttonText
(
'
Add
'
));
return
submitButton
.
click
();
})
.
then
(()
=>
browser
.
wait
(
until
.
presenceOf
(
element
(
by
.
buttonText
(
"
View Report
"
))),
5000
))
.
then
(()
=>
{
let
headerText
=
element
(
by
.
css
(
'
.report-results > h5
'
));
expect
(
headerText
.
getText
()).
toContain
(
'
Successfully added
'
);
})
;
});
});
});
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