Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppeteer_tests: Use assert.match.
Anders Kaseorgc446435f544b
diff --git a/frontend_tests/puppeteer_lib/common.ts b/frontend_tests/puppeteer_lib/common.tsindex 7bc9b09720b..64c5c5e893b 100644--- a/frontend_tests/puppeteer_lib/common.ts+++ b/frontend_tests/puppeteer_lib/common.ts@@ -466,7 +466,7 @@ class CommonUtils {await page.waitForSelector("#settings_overlay_container.show", {visible: true});const url = await this.page_url_with_fragment(page);- assert(/^http:\/\/[^/]+\/#organization/.test(url), "Unexpected manage organization URL");+ assert.match(url, /^http:\/\/[^/]+\/#organization/, "Unexpected manage organization URL");const organization_settings_data_section = "li[data-section='organization-settings']";await page.click(organization_settings_data_section);diff --git a/frontend_tests/puppeteer_tests/settings.ts b/frontend_tests/puppeteer_tests/settings.tsindex 102937ac043..183e4029479 100644--- a/frontend_tests/puppeteer_tests/settings.ts+++ b/frontend_tests/puppeteer_tests/settings.ts@@ -90,12 +90,12 @@ async function test_get_api_key(page: Page): Promise<void> {await page.waitForSelector("#show_api_key", {visible: true});const api_key = await common.get_text_from_selector(page, "#api_key_value");- assert(/[\dA-Za-z]{32}/.test(api_key), "Incorrect API key format.");+ assert.match(api_key, /[\dA-Za-z]{32}/, "Incorrect API key format.");const download_zuliprc_selector = "#download_zuliprc";await page.click(download_zuliprc_selector);const zuliprc_decoded_url = await get_decoded_url_in_selector(page, download_zuliprc_selector);- assert(zuliprc_regex.test(zuliprc_decoded_url), "Incorrect zuliprc file");+ assert.match(zuliprc_decoded_url, zuliprc_regex, "Incorrect zuliprc file");await page.click("#api_key_modal .close");await common.wait_for_modal_to_close(page);}@@ -121,8 +121,9 @@ async function test_webhook_bot_creation(page: Page): Promise<void> {await page.click(download_zuliprc_selector);const zuliprc_decoded_url = await get_decoded_url_in_selector(page, download_zuliprc_selector);- assert(- outgoing_webhook_zuliprc_regex.test(zuliprc_decoded_url),+ assert.match(+ zuliprc_decoded_url,+ outgoing_webhook_zuliprc_regex,"Incorrect outgoing webhook bot zulirc format",);}@@ -147,7 +148,7 @@ async function test_normal_bot_creation(page: Page): Promise<void> {await page.waitForSelector(download_zuliprc_selector, {visible: true});await page.click(download_zuliprc_selector);const zuliprc_decoded_url = await get_decoded_url_in_selector(page, download_zuliprc_selector);- assert(zuliprc_regex.test(zuliprc_decoded_url), "Incorrect zuliprc format for bot.");+ assert.match(zuliprc_decoded_url, zuliprc_regex, "Incorrect zuliprc format for bot.");}async function test_botserverrc(page: Page): Promise<void> {@@ -159,7 +160,7 @@ async function test_botserverrc(page: Page): Promise<void> {);const botserverrc_regex =/^data:application\/octet-stream;charset=utf-8,\[]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;- assert(botserverrc_regex.test(botserverrc_decoded_url), "Incorrect botserverrc format.");+ assert.match(botserverrc_decoded_url, botserverrc_regex, "Incorrect botserverrc format.");}async function test_edit_bot_form(page: Page): Promise<void> {