1515# specific language governing permissions and limitations
1616# under the License.
1717
18- import os
19-
2018import pytest
2119
2220from selenium .common .exceptions import NoAlertPresentException
2321
2422
25- @pytest .mark .xfail_safari (reason = "FedCM not supported" )
26- @pytest .mark .xfail_firefox (reason = "FedCM not supported" )
27- @pytest .mark .xfail_ie (reason = "FedCM not supported" )
28- @pytest .mark .xfail_edge (reason = "FedCM not supported" )
2923class TestFedCM :
3024 @pytest .fixture (autouse = True )
31- def setup (self , driver ):
32- html_file_path = os .path .abspath (
33- "/Users/navinchandra/Documents/Projects/selenium/common/src/web/fedcm/fedcm.html"
34- )
35- print ("File path is: " , html_file_path )
36-
37- driver .get (f"file://{ html_file_path } " )
38- # driver.get('fedcm/fedcm.html')
25+ def setup (self , driver , webserver ):
26+ driver .get (webserver .where_is ("fedcm/fedcm.html" , localhost = True ))
3927 self .dialog = driver .fedcm_dialog
4028
4129 def test_no_dialog_present (self , driver ):
@@ -52,7 +40,8 @@ def test_no_dialog_present(self, driver):
5240 with pytest .raises (NoAlertPresentException ):
5341 self .dialog .cancel ()
5442
55- def test_dialog_present (self , driver ):
43+ def test_dialog_present (self , driver , webserver ):
44+
5645 driver .execute_script ("triggerFedCm();" )
5746 dialog = driver .wait_for_fedcm_dialog ()
5847
@@ -64,6 +53,8 @@ def test_dialog_present(self, driver):
6453 assert accounts [0 ].name == "John Doe"
6554
6655 dialog .select_account (1 )
56+ # wait for the dialog to become interactable after selecting the account
57+ driver .wait_for_fedcm_dialog ()
6758 dialog .cancel ()
6859
6960 with pytest .raises (NoAlertPresentException ):
@@ -121,8 +112,12 @@ def test_fedcm_dialog_flow(self, driver):
121112 # Test account selection
122113 dialog .select_account (1 )
123114
124- # Test dialog button click
125- dialog .click_continue ()
115+ # Wait for the dialog to become interactable
116+ driver .wait_for_fedcm_dialog ()
117+
118+ # # Test dialog button click
119+ # dialog.click_continue()
120+ # driver.wait_for_fedcm_dialog()
126121
127122 # Test dialog cancellation
128123 dialog .cancel ()
0 commit comments