mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	tests: Fix admin.test.ts failing puppeteer test using waitForFunction.
(cherry picked from commit f7129ae550)
			
			
This commit is contained in:
		@@ -10,17 +10,26 @@ async function submit_announcements_stream_settings(page: Page): Promise<void> {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const save_button = "#org-notifications .save-button";
 | 
					    const save_button = "#org-notifications .save-button";
 | 
				
			||||||
    const button_text = await common.get_text_from_selector(page, save_button);
 | 
					    await page.waitForFunction(
 | 
				
			||||||
    assert.strictEqual(button_text, "Save changes", "Save button has incorrect text.");
 | 
					        (save_button: string) => {
 | 
				
			||||||
 | 
					            const button = document.querySelector(save_button);
 | 
				
			||||||
 | 
					            return button && button.textContent?.trim() === "Save changes";
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {},
 | 
				
			||||||
 | 
					        save_button,
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    await page.click(save_button);
 | 
					    await page.click(save_button);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await page.waitForSelector('#org-notifications .save-button[data-status="saved"]', {
 | 
					    await page.waitForSelector('#org-notifications .save-button[data-status="saved"]', {
 | 
				
			||||||
        visible: true,
 | 
					        visible: true,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    assert.strictEqual(
 | 
					    await page.waitForFunction(
 | 
				
			||||||
        await common.get_text_from_selector(page, "#org-notifications .save-button"),
 | 
					        (save_button: string) => {
 | 
				
			||||||
        "Saved",
 | 
					            const button = document.querySelector(save_button);
 | 
				
			||||||
        "Saved text didn't appear after saving new stream notifications setting",
 | 
					            return button && button.textContent?.trim() === "Saved";
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {},
 | 
				
			||||||
 | 
					        save_button,
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await page.waitForSelector("#org-notifications .save-button", {hidden: true});
 | 
					    await page.waitForSelector("#org-notifications .save-button", {hidden: true});
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user