19 public function testLoginInvitation()
21 $this->open(
'widgetsTests/commentsComments');
22 $this->assertElementPresent(
'css=#comments-form-12300123');
23 $this->assertElementNotPresent(
'css=#comments-form-12300123 .comments-form-widget-login');
25 $this->assertElementPresent(
'css=#comments-form-12300124');
26 $this->assertElementPresent(
'css=#comments-form-12300124 .comments-form-widget-login');
29 public function testValidationErrors()
31 $this->open(
'widgetsTests/commentsComments');
32 $this->clickAndWait(
'css=#comments-form-12300123 input[value="Submit"]');
34 $this->assertTextPresent(
'First name cannot be blank');
35 $this->assertTextPresent(
'Last name cannot be blank');
36 $this->assertTextPresent(
'The verification code is incorrect');
37 $this->assertTextPresent(
'Email cannot be blank');
38 $this->assertTextPresent(
'Subject cannot be blank');
39 $this->assertTextPresent(
'Description cannot be blank');
42 public function testEmailValidationError()
44 $this->open(
'widgetsTests/commentsComments');
46 $this->type(
'css=#comments-form-12300123 [name="Comment[firstname]"]',
'John');
47 $this->type(
'css=#comments-form-12300123 [name="Comment[lastname]"]',
'Malkovitch');
48 $this->type(
'css=#comments-form-12300123 [name="Comment[email]"]',
'malkovitch');
49 $this->type(
'css=#comments-form-12300123 [name="Comment[subject]"]',
'TEST');
50 $this->type(
'css=#comments-form-12300123 [name="Comment[description]"]',
'TEST');
51 $this->type(
'css=#comments-form-12300123 [name="Comment[verifyCode]"]', Yii::app()->params[
'captcha']);
53 $this->clickAndWait(
'css=#comments-form-12300123 input[value="Submit"]');
55 $this->assertTextPresent(
'Email is not a valid email address');
58 public function testAnonymousComment()
60 $this->open(
'widgetsTests/commentsComments');
62 $this->type(
'css=#comments-form-12300123 [name="Comment[firstname]"]',
'John');
63 $this->type(
'css=#comments-form-12300123 [name="Comment[lastname]"]',
'Malkovitch');
64 $this->type(
'css=#comments-form-12300123 [name="Comment[email]"]',
'malkovitch@malkovitch.com');
65 $this->type(
'css=#comments-form-12300123 [name="Comment[subject]"]',
'TEST');
66 $this->type(
'css=#comments-form-12300123 [name="Comment[description]"]',
'TEST');
67 $this->type(
'css=#comments-form-12300123 [name="Comment[verifyCode]"]', Yii::app()->params[
'captcha']);
69 $this->clickAndWait(
'css=#comments-form-12300123 input[value="Submit"]');
70 $this->assertTextPresent(
'Your comment added successfully and will be displayed');
74 public function testLoggedInComment()
76 $this->open(
'widgetsTests/commentsComments');
77 $this->clickAndWait(
'link=Log in to leave a Comment');
79 $this->type(
'name=UserLogin[authField]',
'webmaster@example.com');
80 $this->type(
'name=UserLogin[password]',
'admin');
81 $this->clickAndWait(
"//input[@value='Login']");
82 $this->assertElementNotPresent(
'css=#comments-form-12300124 .comments-form-widget-login');
84 $this->type(
'css=#comments-form-12300124 [name="Comment[subject]"]',
'TEST');
85 $this->type(
'css=#comments-form-12300124 [name="Comment[description]"]',
'TEST');
86 $this->type(
'css=#comments-form-12300124 [name="Comment[verifyCode]"]', Yii::app()->params[
'captcha']);
87 $this->clickAndWait(
'css=#comments-form-12300124 input[value="Submit"]');
88 $this->assertTextPresent(
'Your comment added successfully and will be displayed');
90 $this->type(
'css=#comments-form-12300123 [name="Comment[subject]"]',
'TEST');
91 $this->type(
'css=#comments-form-12300123 [name="Comment[description]"]',
'TEST');
92 $this->type(
'css=#comments-form-12300123 [name="Comment[verifyCode]"]', Yii::app()->params[
'captcha']);
93 $this->clickAndWait(
'css=#comments-form-12300123 input[value="Submit"]');
94 $this->assertTextPresent(
'Your comment added successfully and will be displayed');
97 public function testModerator()
99 $this->open(
'widgetsTests/commentsComments');
100 $this->clickAndWait(
'link=Log in to leave a Comment');
102 $this->type(
'name=UserLogin[authField]',
'webmaster@example.com');
103 $this->type(
'name=UserLogin[password]',
'admin');
104 $this->clickAndWait(
"//input[@value='Login']");
106 $this->assertTextPresent(
'Approve');
107 $this->assertTextPresent(
'Not approve');
108 $this->assertTextPresent(
'Delete');
111 public function testDelete()
113 $this->open(
'widgetsTests/commentsComments');
114 $this->clickAndWait(
'link=Log in to leave a Comment');
116 $this->type(
'name=UserLogin[authField]',
'webmaster@example.com');
117 $this->type(
'name=UserLogin[password]',
'admin');
118 $this->clickAndWait(
"//input[@value='Login']");
120 $this->assertElementPresent(
'link=Delete');
121 $this->clickAndWait(
'link=Delete');
122 $this->assertTextPresent(
'Comment deleted successfully');
126 public function testApprove()
128 $this->open(
'widgetsTests/commentsComments');
129 $this->clickAndWait(
'link=Log in to leave a Comment');
131 $this->type(
'name=UserLogin[authField]',
'webmaster@example.com');
132 $this->type(
'name=UserLogin[password]',
'admin');
133 $this->clickAndWait(
"//input[@value='Login']");
135 $this->assertElementPresent(
'link=Approve');
136 $this->clickAndWait(
'link=Approve');
137 $this->assertTextPresent(
'Comment approved');
141 public function testNotApprove()
143 $this->open(
'widgetsTests/commentsComments');
144 $this->clickAndWait(
'link=Log in to leave a Comment');
146 $this->type(
'name=UserLogin[authField]',
'webmaster@example.com');
147 $this->type(
'name=UserLogin[password]',
'admin');
148 $this->clickAndWait(
"//input[@value='Login']");
150 $this->assertElementPresent(
'link=Not approve');
151 $this->clickAndWait(
'link=Not approve');
152 $this->assertTextPresent(
'Comment not approved');