Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

all_steps.rb: trying to use domain specific language in my steps rath…

…er than just click this, look here, follow this link
  • Loading branch information...
commit bc4c94734b4e4c9858ccec56ab9b9d8315fc0030 1 parent af37fea
@jorahood authored
View
76 features/editor-drafts-new-doc.feature
@@ -0,0 +1,76 @@
+Feature: Editor creates a new doc
+Possible scenarios:
+
+ Editor attends service meeting and learns of a service change that requires additional documentation
+ Editor receives a comment from an end user about something undocumented
+ Editor reads post to SC listserv concerning something new and undocumented.
+
+
+
+These scenarios involve so much outside the KMS system itself that they are hard to differentiate as separate tests. So I'm going to start small with what I know can be done within the KMS.
+
+Background:
+
+Given I am logged in as "editor1"
+
+Scenario: Editor can submit doc for Editor approval directly, bypassing the Owner approval workflow.
+
+Given a document with filename "xaaa.dita" exists with content
+"""
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE topic PUBLIC "urn:pubid:org.kuali.kits.kms:doctypes:dita:topic"
+"http://www.indiana.edu/~worklist/dita-prototypes/org.kuali.kits.kms/doctypes/topic/dtd/kbtopic.dtd">
+<topic id="kbdoc">
+ <title id="default">test default title</title>
+ <prolog>
+ <author type="creator">jorahood</author>
+ <critdates>
+ <created date="2008-09-12 12:22" user="mligget"/>
+ <revised modified="2009-05-05 01:23" user="madalton"/>
+ <approved modified="2011-05-25 23:21" user="bolte" note="just change the date every year"/>
+ <expires modified="2011-06-04 10:34" expiry="2011-11-11 22:12" user="jthatche" note="because of that new thing"/>
+ </critdates>
+ <visibility view="visible"/>
+ <docid id="xaaa"/>
+ <owner>ONCOURSE-SME</owner>
+ </prolog>
+ <body>
+ <p>First, try <xref href="http://google.com">Google</xref>.</p>
+ </body>
+</topic>
+"""
+When I submit the document
+Then I should see document "xaaa.dita" in my action list
+
+Scenario: Editor can submit doc for Owner approval
+
+Given a document with filename "xaab.dita" exists with content
+"""
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE topic PUBLIC "urn:pubid:org.kuali.kits.kms:doctypes:dita:topic"
+"http://www.indiana.edu/~worklist/dita-prototypes/org.kuali.kits.kms/doctypes/topic/dtd/kbtopic.dtd">
+<topic id="kbdoc">
+ <title id="default">test default title</title>
+ <prolog>
+ <author type="creator">jorahood</author>
+ <critdates>
+ <created date="2008-09-12 12:22" user="mligget"/>
+ <revised modified="2009-05-05 01:23" user="madalton"/>
+ <approved modified="2011-05-25 23:21" user="bolte" note="just change the date every year"/>
+ <expires modified="2011-06-04 10:34" expiry="2011-11-11 22:12" user="jthatche" note="because of that new thing"/>
+ </critdates>
+ <visibility view="visible"/>
+ <docid id="xaab"/>
+ <owner>ONCOURSE-SME</owner>
+ </prolog>
+ <body>
+ <p>First, try <xref href="http://google.com">Google</xref>.</p>
+ </body>
+</topic>
+"""
+And user "sme1" is a member of the "ONCOURSE-SME" owner group
+When I route the document for SME approval
+And I impersonate user "sme1"
+Then I should see document "xaab.dita" in my action list
+
+
View
33 features/step_definitions/all_steps.rb
@@ -11,6 +11,10 @@ def frame_id
}
end
+When /^I am backdoor logged in as "([^"]*)"$/ do |username|
+ fill_in('backdoorId', :with=> 'username')
+end
+
Given /^document "([^"]*)" does not exist$/ do |docid|
steps %{
Given I go to delete a document
@@ -56,7 +60,7 @@ def frame_id
steps %{
* I follow "Main Menu"
* I follow "New content"
- * fill in "document.documentHeader.documentDescription" with "an automated test doc" in the frame
+ * fill in "document.documentHeader.documentDescription" with "#{filename}" in the frame
* fill in "document.kmsDocument.kmsFileName.fileName" with "#{name}" in the frame
* I select "#{extension}" from "document.kmsDocument.kmsFileName.fileTypeCode" in the frame}
end
@@ -178,6 +182,9 @@ def frame_id
end
end
+Given /^user "([^"]*)" is a member of the "([^"]*)" owner group$/ do |arg1, arg2|
+end
+
When /^I add document "([^"]*)" to the worklist$/ do |docid|
within_frame frame_id() do
fill_in('document.documentHeader.documentDescription', :with => "another test list")
@@ -322,6 +329,30 @@ def frame_id
}
end
+Then /^I should see document "([^"]*)" in my action list$/ do |filename|
+ click_link('Action List')
+ within_frame frame_id() do
+ page.should have_content(filename)
+ end
+end
+
+When /^I submit the document$/ do
+ within_frame frame_id() do
+ click_button('submit')
+ end
+end
+
+When /^I route the document for SME approval$/ do
+ within_frame frame_id() do
+ click_button('click here to route for SME approval')
+ end
+end
+
+When /^I impersonate user "([^"]*)"$/ do |username|
+ fill_in("backdoorId", :with=> 'username')
+ click_button('Login')
+end
+
Then /^I should see "([^"]*)" in the preview window$/ do |string|
# from http://blog.kshitizgurung.info/2011/07/detecting-popup-window-and-implementing-test-on-in-capybara-selenium/
within_window(page.driver.browser.window_handles.last) do
Please sign in to comment.
Something went wrong with that request. Please try again.