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 button_text = await common.get_text_from_selector(page, save_button);
 | 
			
		||||
    assert.strictEqual(button_text, "Save changes", "Save button has incorrect text.");
 | 
			
		||||
    await page.waitForFunction(
 | 
			
		||||
        (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.waitForSelector('#org-notifications .save-button[data-status="saved"]', {
 | 
			
		||||
        visible: true,
 | 
			
		||||
    });
 | 
			
		||||
    assert.strictEqual(
 | 
			
		||||
        await common.get_text_from_selector(page, "#org-notifications .save-button"),
 | 
			
		||||
        "Saved",
 | 
			
		||||
        "Saved text didn't appear after saving new stream notifications setting",
 | 
			
		||||
    await page.waitForFunction(
 | 
			
		||||
        (save_button: string) => {
 | 
			
		||||
            const button = document.querySelector(save_button);
 | 
			
		||||
            return button && button.textContent?.trim() === "Saved";
 | 
			
		||||
        },
 | 
			
		||||
        {},
 | 
			
		||||
        save_button,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    await page.waitForSelector("#org-notifications .save-button", {hidden: true});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user