diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxnone-globalpkg-addwebpart.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxnone-globalpkg-addwebpart.test.ts index da2faf68ec..cafc96007b 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxnone-globalpkg-addwebpart.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxnone-globalpkg-addwebpart.test.ts @@ -14,6 +14,7 @@ import { import { RemoteDebugTestContext, configSpfxGlobalEnv, + runDeploy, } from "./remotedebugContext"; import { execCommandIfExist, @@ -79,16 +80,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); const teamsAppId = await remoteDebugTestContext.getTeamsAppId( projectPath diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-addwebpart.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-addwebpart.test.ts index 0f8204ed2d..d0313faa8f 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-addwebpart.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-addwebpart.test.ts @@ -13,7 +13,7 @@ import { Timeout, Notification, } from "../../utils/constants"; -import { RemoteDebugTestContext } from "./remotedebugContext"; +import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext"; import { execCommandIfExist, getNotification, @@ -76,16 +76,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); const teamsAppId = await remoteDebugTestContext.getTeamsAppId( projectPath diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-globalpkg.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-globalpkg.test.ts index 0a8448a5d2..54a2efeb34 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-globalpkg.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-globalpkg.test.ts @@ -14,6 +14,7 @@ import { import { RemoteDebugTestContext, configSpfxGlobalEnv, + runDeploy, } from "./remotedebugContext"; import { execCommandIfExist, @@ -73,16 +74,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); const teamsAppId = await remoteDebugTestContext.getTeamsAppId( projectPath diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-minimal.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-minimal.test.ts index f7f88b8d0a..06fd70d55e 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-minimal.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-minimal.test.ts @@ -13,7 +13,7 @@ import { Timeout, Notification, } from "../../utils/constants"; -import { RemoteDebugTestContext } from "./remotedebugContext"; +import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext"; import { execCommandIfExist, getNotification, @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); // Verify the sppkg file path const sppkgFolderPath = path.resolve( diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-none.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-none.test.ts index 17a71e41f7..97e038b375 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-none.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact-none.test.ts @@ -13,7 +13,7 @@ import { Timeout, Notification, } from "../../utils/constants"; -import { RemoteDebugTestContext } from "./remotedebugContext"; +import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext"; import { execCommandIfExist, getNotification, @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); const teamsAppId = await remoteDebugTestContext.getTeamsAppId( projectPath diff --git a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact.test.ts b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact.test.ts index 9af6861c51..098417396c 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact.test.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebug-spfxreact.test.ts @@ -13,7 +13,7 @@ import { Timeout, Notification, } from "../../utils/constants"; -import { RemoteDebugTestContext } from "./remotedebugContext"; +import { RemoteDebugTestContext, runDeploy } from "./remotedebugContext"; import { execCommandIfExist, getNotification, @@ -70,16 +70,7 @@ describe("Remote debug Tests", function () { Notification.ProvisionSucceeded, Timeout.shortTimeWait ); - await clearNotifications(); - await execCommandIfExist(CommandPaletteCommands.DeployCommand); - try { - const deployConfirmInput = await InputBox.create(); - await deployConfirmInput.confirm(); - } catch (error) { - console.log("No need to confirm to deploy."); - } - await driver.sleep(Timeout.spfxDeploy); - await getNotification(Notification.DeploySucceeded, Timeout.longTimeWait); + await runDeploy(); const teamsAppId = await remoteDebugTestContext.getTeamsAppId( projectPath diff --git a/packages/tests/src/ui-test/remotedebug/remotedebugContext.ts b/packages/tests/src/ui-test/remotedebug/remotedebugContext.ts index 3fabf2a5ef..3df95b540f 100644 --- a/packages/tests/src/ui-test/remotedebug/remotedebugContext.ts +++ b/packages/tests/src/ui-test/remotedebug/remotedebugContext.ts @@ -265,22 +265,17 @@ export async function reRunProvision() { await driver.sleep(waitTime); } -export async function runDeploy( - waitTime: number = Timeout.tabDeploy, - spfx = false -) { +export async function runDeploy(waitTime: number = Timeout.tabDeploy) { const driver = VSBrowser.instance.driver; await clearNotifications(); console.log("start to deploy"); await execCommandIfExist(CommandPaletteCommands.DeployCommand); await driver.sleep(Timeout.shortTimeWait); - if (!spfx) { - const dialog = new ModalDialog(); - console.log("click deploy button"); - await dialog.pushButton("Deploy"); - await driver.sleep(waitTime); - } + const dialog = new ModalDialog(); + console.log("click deploy button"); + await dialog.pushButton("Deploy"); + await driver.sleep(waitTime); try { await getNotification( diff --git a/packages/tests/src/ui-test/samples/sampleCaseFactory.ts b/packages/tests/src/ui-test/samples/sampleCaseFactory.ts index 0747538fbf..9b202c70d7 100644 --- a/packages/tests/src/ui-test/samples/sampleCaseFactory.ts +++ b/packages/tests/src/ui-test/samples/sampleCaseFactory.ts @@ -396,7 +396,7 @@ export abstract class CaseFactory { options?.type === "spfx" ); try { - await runDeploy(Timeout.tabDeploy, options?.type === "spfx"); + await runDeploy(Timeout.tabDeploy); } catch (error) { await reRunDeploy(Timeout.tabDeploy); }