1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Users;
4: use Azalea\Selenium\App\Components\Popup;
5:
6: class PopupTest extends ApplicationTestCase
7: {
8: public function testPopups()
9: {
10: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
11:
12: $app->popup->closeAll();
13:
14:
15: $this->javascript("awa.popup.message('Test Message');");
16: $this->assertElementExists(".awa-mvc-PopupView");
17: $this->filter(".awa-mvc-PopupView .popup_message_contents")
18: ->assertCanSee("Test Message");
19: $app->popup->closeAll();
20:
21:
22: $this->javascript("awa.popup.error('Test Error');");
23: $this->assertElementExists(".awa-mvc-PopupView.error");
24: $this->filter(".awa-mvc-PopupView.error .popup_message_contents")
25: ->assertCanSee("Test Error");
26: $app->popup->closeAll();
27:
28: $confirmScript =
29: "awa.popup.confirm('Test Confirm', function() {
30: awa.popup.message('Yes');
31: }, function() {
32: awa.popup.message('Cancel');
33: });";
34:
35:
36: $this->javascript($confirmScript);
37: $this->assertElementExists(".awa-mvc-PopupView");
38: $this->filter(".awa-mvc-PopupView")
39: ->assertCanSee("Test Confirm")
40: ->press("Yes");
41: $this->filter(".awa-mvc-PopupView .popup_content")
42: ->assertCanSee("Yes");
43: $app->popup->closeAll();
44:
45:
46: $this->javascript($confirmScript);
47: $this->filter(".awa-mvc-PopupView")
48: ->press("Cancel");
49: $this->filter(".awa-mvc-PopupView .popup_content")
50: ->assertCanSee("Cancel");
51: $app->popup->closeAll();
52: }
53: }
54:
55: ?>