Vincent Massol wrote:
> On Jun 12, 2008, at 1:50 AM, sdumitriu (SVN) wrote:
> 
>> Author: sdumitriu
>> Date: 2008-06-12 01:50:00 +0200 (Thu, 12 Jun 2008)
>> New Revision: 10268
>>
>> Modified:
>>   xwiki-products/xwiki-enterprise/trunk/distribution-test/selenium- 
>> tests/src/test/it/com/xpn/xwiki/it/selenium/WikiEditorTest.java
>> Log:
>> XWIKI-1007: Removing all content in page has no effect & the content  
>> of a wiki page is not allowed to be completely empty
>> Added integration test
>>
>>
>> Modified: xwiki-products/xwiki-enterprise/trunk/distribution-test/ 
>> selenium-tests/src/test/it/com/xpn/xwiki/it/selenium/ 
>> WikiEditorTest.java
>> ===================================================================
>> --- xwiki-products/xwiki-enterprise/trunk/distribution-test/selenium- 
>> tests/src/test/it/com/xpn/xwiki/it/selenium/WikiEditorTest.java       
>> 2008-06-11 23:49:28 UTC (rev 10267)
>> +++ xwiki-products/xwiki-enterprise/trunk/distribution-test/selenium- 
>> tests/src/test/it/com/xpn/xwiki/it/selenium/WikiEditorTest.java       
>> 2008-06-11 23:50:00 UTC (rev 10268)
>> @@ -158,4 +158,20 @@
>>             getFieldValue("content"));
>>         // TODO: We need to find out how to make a text selection in  
>> Selenium
>>     }
>> +
>> +    public void testEmptyContent()
> 
> I'd suggest: testEmptyDocumentContentIsAllowed

Done.

>> +    {
>> +        open("/xwiki/bin/edit/Test/EmptyWikiContent?editor=wiki");
>> +        setFieldValue("content", "this is some content");
>> +        clickEditSaveAndView();
>> +        assertFalse(getSelenium().isAlertPresent());
> 
> Why do we test for not having a dialog box present? There's content so  
> why should that happen? If it's required the test should have some  
> comments to explain it.

No, this was just to make sure that the first change really works. You are 
right, there are other 
tests that prove this works, so I removed it.

>> +        assertEquals(-1, getSelenium().getLocation().indexOf("/ 
>> edit/"));
> 
> I don't understand this either since we have clicked on save, we're no  
> longer in edit and the url has view. Why verify this in this test  
> which is about verifying that empty content is allowed.

Removed, too.

>> +        assertTextPresent("this is some content");
> 
> Again why test this. The ability to enter content is already tested in  
> other tests AFAIK.

Removed. I don't like to count on other tests, but I think I'm wrong here. I 
should learn to focus 
tests on one specific issue, right?

>> +        open("/xwiki/bin/edit/Test/EmptyWikiContent?editor=wiki");
>> +        setFieldValue("content", "");
>> +        clickEditSaveAndView();
>> +        assertFalse(getSelenium().isAlertPresent());
>> +        assertEquals(-1, getSelenium().getLocation().indexOf("/ 
>> edit/"));
>> +        assertTextNotPresent("this is some content");
> 
> Is there a need to do the 3 tests which seem to be about the same  
> verification?

Well, the previous way was to alert when the content was empty and cancel the 
form submission, so 
you would:
- get an alert
- remain in the /edit/ page
- and even if you went back to the view page, you still had the old content.

The test needs to make sure that both the UI works (lets the save go through), 
and the core works 
(accepts empty saves). I had to make changes in both places for this issue.
-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to