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
2a0e2fd3
Commit
2a0e2fd3
authored
Sep 18, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify static page acceptance tests
parent
d35a03a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
47 deletions
+21
-47
cms/djangoapps/contentstore/features/static-pages.feature
+5
-5
cms/djangoapps/contentstore/features/static-pages.py
+16
-42
No files found.
cms/djangoapps/contentstore/features/static-pages.feature
View file @
2a0e2fd3
...
...
@@ -5,16 +5,16 @@ Feature: Static Pages
Given
I have opened a new course in Studio
And
I go to the static pages page
When
I add a new page
Then
I should see a
"Empty"
static page
Then
I should see a
static page named
"Empty"
Scenario
:
Users can delete static pages
Given
I have opened a new course in Studio
And
I go to the static pages page
And
I add a new page
And
I
"delete"
the
"Empty"
page
And
I
"delete"
the
static
page
Then
I am shown a prompt
When
I confirm the prompt
Then
I should not see a
"Empty"
static page
Then
I should not see a
ny static pages
# Safari won't update the name properly
@skip_safari
...
...
@@ -22,6 +22,6 @@ Feature: Static Pages
Given
I have opened a new course in Studio
And
I go to the static pages page
And
I add a new page
When
I
"edit"
the
"Empty"
page
When
I
"edit"
the
static
page
And
I change the name to
"New"
Then
I should see a
"New"
static page
Then
I should see a
static page named
"New"
cms/djangoapps/contentstore/features/static-pages.py
View file @
2a0e2fd3
...
...
@@ -2,10 +2,10 @@
#pylint: disable=W0621
from
lettuce
import
world
,
step
from
nose.tools
import
assert_
true
# pylint: disable=E0611
from
nose.tools
import
assert_
equal
# pylint: disable=E0611
@step
(
u'I go to the static pages page'
)
@step
(
u'I go to the static pages page
$
'
)
def
go_to_static
(
step
):
menu_css
=
'li.nav-course-courseware'
static_css
=
'li.nav-course-courseware-pages a'
...
...
@@ -13,42 +13,29 @@ def go_to_static(step):
world
.
css_click
(
static_css
)
@step
(
u'I add a new page'
)
@step
(
u'I add a new page
$
'
)
def
add_page
(
step
):
button_css
=
'a.new-button'
world
.
css_click
(
button_css
)
@step
(
u'I should not see a "([^"]*)" static page$'
)
def
not_see_page
(
step
,
page
):
# Either there are no pages, or there are pages but
# not the one I expect not to exist.
@step
(
u'I should see a static page named "([^"]*)"$'
)
def
see_a_static_page_named_foo
(
step
,
name
):
pages_css
=
'section.xmodule_StaticTabModule'
page_name_html
=
world
.
css_html
(
pages_css
)
assert_equal
(
page_name_html
,
'
\n
{name}
\n
'
.
format
(
name
=
name
))
# Since our only test for deletion right now deletes
# the only static page that existed, our success criteria
# will be that there are no static pages.
# In the future we can refactor if necessary.
tabs_css
=
'li.component'
assert
(
world
.
is_css_not_present
(
tabs_css
,
wait_time
=
30
))
@step
(
u'I should not see any static pages$'
)
def
not_see_any_static_pages
(
step
):
pages_css
=
'section.xmodule_StaticTabModule'
assert
(
world
.
is_css_not_present
(
pages_css
,
wait_time
=
30
))
@step
(
u'I should see a "([^"]*)" static page$'
)
def
see_page
(
step
,
page
):
# Need to retry here because the element
# will sometimes exist before the HTML content is loaded
exists_func
=
lambda
(
driver
):
page_exists
(
page
)
world
.
wait_for
(
exists_func
)
assert_true
(
exists_func
(
None
))
@step
(
u'I "([^"]*)" the "([^"]*)" page$'
)
def
click_edit_delete
(
step
,
edit_delete
,
page
):
button_css
=
'a.
%
s-button'
%
edit_delete
index
=
get_index
(
page
)
assert
index
is
not
None
world
.
css_click
(
button_css
,
index
=
index
)
@step
(
u'I "(edit|delete)" the static page$'
)
def
click_edit_or_delete
(
step
,
edit_or_delete
):
button_css
=
'div.component-actions a.
%
s-button'
%
edit_or_delete
world
.
css_click
(
button_css
)
@step
(
u'I change the name to "([^"]*)"$'
)
...
...
@@ -61,16 +48,3 @@ def change_name(step, new_name):
world
.
trigger_event
(
input_css
)
save_button
=
'a.save-button'
world
.
css_click
(
save_button
)
def
get_index
(
name
):
page_name_css
=
'section[data-type="HTMLModule"]'
all_pages
=
world
.
css_find
(
page_name_css
)
for
i
in
range
(
len
(
all_pages
)):
if
world
.
retry_on_exception
(
lambda
:
all_pages
[
i
]
.
html
)
==
'
\n
{name}
\n
'
.
format
(
name
=
name
):
return
i
return
None
def
page_exists
(
page
):
return
get_index
(
page
)
is
not
None
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