@@ -55,6 +55,7 @@ class Modal extends Block
55
55
*/
56
56
public function acceptAlert ()
57
57
{
58
+ $ this ->waitModalAnimationFinished ();
58
59
$ this ->_rootElement ->find ($ this ->acceptButtonSelector )->click ();
59
60
}
60
61
@@ -65,6 +66,7 @@ public function acceptAlert()
65
66
*/
66
67
public function dismissAlert ()
67
68
{
69
+ $ this ->waitModalAnimationFinished ();
68
70
$ this ->_rootElement ->find ($ this ->dismissButtonSelector )->click ();
69
71
}
70
72
@@ -75,6 +77,7 @@ public function dismissAlert()
75
77
*/
76
78
public function closeAlert ()
77
79
{
80
+ $ this ->waitModalAnimationFinished ();
78
81
$ this ->_rootElement ->find ($ this ->closeButtonSelector )->click ();
79
82
}
80
83
@@ -85,6 +88,7 @@ public function closeAlert()
85
88
*/
86
89
public function getAlertText ()
87
90
{
91
+ $ this ->waitModalAnimationFinished ();
88
92
return $ this ->_rootElement ->find ($ this ->inputFieldSelector )->getValue ();
89
93
}
90
94
@@ -96,6 +100,7 @@ public function getAlertText()
96
100
*/
97
101
public function setAlertText ($ text )
98
102
{
103
+ $ this ->waitModalAnimationFinished ();
99
104
$ this ->_rootElement ->find ($ this ->inputFieldSelector )->setValue ($ text );
100
105
}
101
106
@@ -112,4 +117,15 @@ function () {
112
117
}
113
118
);
114
119
}
120
+
121
+ /**
122
+ * Waiting until CSS animation is done.
123
+ * Transition-duration is set at this file: "<magento_root>/lib/web/css/source/components/_modals.less"
124
+ *
125
+ * @return void
126
+ */
127
+ private function waitModalAnimationFinished ()
128
+ {
129
+ usleep (500000 );
130
+ }
115
131
}
0 commit comments