Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
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
edx
edx-platform
Commits
3e407b9d
Commit
3e407b9d
authored
Aug 25, 2015
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fix for flaky TeamDiscussionView js tests"
This reverts commit
d64c2b29
.
parent
6a1be48e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
73 deletions
+3
-73
lms/djangoapps/teams/static/teams/js/spec/views/team_discussion_spec.js
+3
-73
No files found.
lms/djangoapps/teams/static/teams/js/spec/views/team_discussion_spec.js
View file @
3e407b9d
...
...
@@ -38,20 +38,12 @@ define([
};
createPost
=
function
(
requests
,
view
,
title
,
body
,
threadID
)
{
runs
(
function
()
{
title
=
title
||
"Test title"
;
body
=
body
||
"Test body"
;
threadID
=
threadID
||
"999"
;
view
.
$
(
'.new-post-button'
).
click
();
view
.
$
(
'.js-post-title'
).
val
(
title
);
view
.
$
(
'.js-post-body textarea'
).
val
(
body
);
});
waitsFor
(
function
()
{
return
$
(
'.submit'
).
length
;
},
"Submit button never appeared"
,
1000
);
runs
(
function
()
{
view
.
$
(
'.submit'
).
click
();
AjaxHelpers
.
expectRequest
(
requests
,
'POST'
,
...
...
@@ -80,15 +72,9 @@ define([
}),
annotated_content_info
:
TeamSpecHelpers
.
createAnnotatedContentInfo
()
});
});
};
expandReplies
=
function
(
requests
,
view
,
threadID
)
{
waitsFor
(
function
()
{
return
$
(
'.forum-thread-expand'
).
length
;
},
"Forum expando link never appeared"
,
1000
);
runs
(
function
()
{
view
.
$
(
'.forum-thread-expand'
).
first
().
click
();
AjaxHelpers
.
expectRequest
(
requests
,
'GET'
,
...
...
@@ -106,20 +92,10 @@ define([
content
:
TeamSpecHelpers
.
createMockThreadResponse
(),
annotated_content_info
:
TeamSpecHelpers
.
createAnnotatedContentInfo
()
});
});
};
postReply
=
function
(
requests
,
view
,
reply
,
threadID
)
{
var
replyForm
;
runs
(
function
()
{
replyForm
=
view
.
$
(
'.discussion-reply-new'
).
first
();
});
waitsFor
(
function
()
{
return
replyForm
.
find
(
'.discussion-submit-post'
).
length
;
},
"submit reply button never appeared"
,
1000
);
runs
(
function
()
{
var
replyForm
=
view
.
$
(
'.discussion-reply-new'
).
first
();
replyForm
.
find
(
'.reply-body textarea'
).
val
(
reply
);
replyForm
.
find
(
'.discussion-submit-post'
).
click
();
AjaxHelpers
.
expectRequest
(
...
...
@@ -141,7 +117,6 @@ define([
}),
"annotated_content_info"
:
TeamSpecHelpers
.
createAnnotatedContentInfo
()
});
});
};
it
(
'can render itself'
,
function
()
{
...
...
@@ -152,96 +127,53 @@ define([
it
(
'can create a new post'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
view
,
view
=
createDiscussionView
(
requests
)
,
testTitle
=
'New Post'
,
testBody
=
'New post body'
,
newThreadElement
;
runs
(
function
()
{
view
=
createDiscussionView
(
requests
);
createPost
(
requests
,
view
,
testTitle
,
testBody
);
});
waitsFor
(
function
()
{
return
$
(
'.discussion-thread'
).
length
;
},
"Discussion thread never appeared"
,
1000
);
runs
(
function
()
{
// Expect the first thread to be the new post
expect
(
view
.
$
(
'.discussion-thread'
).
length
).
toEqual
(
4
);
newThreadElement
=
view
.
$
(
'.discussion-thread'
).
first
();
expect
(
newThreadElement
.
find
(
'.post-header-content h1'
).
text
().
trim
()).
toEqual
(
testTitle
);
expect
(
newThreadElement
.
find
(
'.post-body'
).
text
().
trim
()).
toEqual
(
testBody
);
});
});
it
(
'can post a reply'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
view
=
createDiscussionView
(
requests
),
testReply
=
"Test reply"
,
testThreadID
=
"1"
;
runs
(
function
()
{
expandReplies
(
requests
,
view
,
testThreadID
);
postReply
(
requests
,
view
,
testReply
,
testThreadID
);
});
waitsFor
(
function
()
{
return
view
.
$
(
'.discussion-response .response-body'
).
length
;
},
"Discussion response never made visible"
,
1000
);
runs
(
function
()
{
expect
(
view
.
$
(
'.discussion-response .response-body'
).
text
().
trim
()).
toBe
(
testReply
);
});
});
it
(
'can post a reply to a new post'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
view
=
createDiscussionView
(
requests
,
[]),
testReply
=
"Test reply"
;
runs
(
function
()
{
createPost
(
requests
,
view
);
expandReplies
(
requests
,
view
);
postReply
(
requests
,
view
,
testReply
);
});
waitsFor
(
function
()
{
return
view
.
$
(
'.discussion-response .response-body'
).
length
;
},
"Discussion response never made visible"
,
1000
);
runs
(
function
()
{
expect
(
view
.
$
(
'.discussion-response .response-body'
).
text
().
trim
()).
toBe
(
testReply
);
});
});
it
(
'cannot move an existing thread to a different topic'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
view
,
view
=
createDiscussionView
(
requests
)
,
postTopicButton
,
updatedThreadElement
,
updatedTitle
=
'Updated title'
,
updatedBody
=
'Updated body'
,
testThreadID
=
"1"
;
runs
(
function
()
{
view
=
createDiscussionView
(
requests
);
expandReplies
(
requests
,
view
,
testThreadID
);
});
waitsFor
(
function
()
{
return
view
.
$
(
'.action-more .icon'
).
length
;
},
"Expanding replies never finished"
,
1000
);
runs
(
function
()
{
view
.
$
(
'.action-more .icon'
).
first
().
click
();
view
.
$
(
'.action-edit'
).
first
().
click
();
postTopicButton
=
view
.
$
(
'.post-topic'
);
expect
(
postTopicButton
.
length
).
toBe
(
0
);
view
.
$
(
'.js-post-post-title'
).
val
(
updatedTitle
);
view
.
$
(
'.js-post-body textarea'
).
val
(
updatedBody
);
});
waitsFor
(
function
()
{
return
$
(
'.submit'
).
length
;
},
"submit button never appeared"
,
1000
);
runs
(
function
()
{
view
.
$
(
'.submit'
).
click
();
AjaxHelpers
.
expectRequest
(
requests
,
'POST'
,
...
...
@@ -262,13 +194,11 @@ define([
annotated_content_info
:
TeamSpecHelpers
.
createAnnotatedContentInfo
()
});
// Expect the thread to have been updated
updatedThreadElement
=
view
.
$
(
'.discussion-thread'
).
first
();
expect
(
updatedThreadElement
.
find
(
'.post-header-content h1'
).
text
().
trim
()).
toEqual
(
updatedTitle
);
expect
(
updatedThreadElement
.
find
(
'.post-body'
).
text
().
trim
()).
toEqual
(
updatedBody
);
});
});
it
(
'cannot move a new thread to a different topic'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
...
...
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