From d5bdf2a661f92620b9c7ad95374e4c64cbec612c Mon Sep 17 00:00:00 2001 From: avi12 Date: Thu, 20 May 2021 22:14:09 +0300 Subject: [PATCH] Opera deploy: Attempting to fix the deployment --- src/stores/opera/opera-deploy.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/stores/opera/opera-deploy.ts b/src/stores/opera/opera-deploy.ts index 310893e..c5af696 100644 --- a/src/stores/opera/opera-deploy.ts +++ b/src/stores/opera/opera-deploy.ts @@ -12,6 +12,7 @@ const store = "Opera"; const gSelectors = { listErrors: ".alert-danger", + tabs: `[ng-click="select($event)"]`, buttonSubmit: "[ng-click*=submit]", buttonUploadNewVersion: `[ng-click*="upload()"]`, buttonCancel: "[ng-click*=cancel]", @@ -74,10 +75,7 @@ async function uploadZip({ const elInputFile = await page.$(gSelectors.inputFile); await elInputFile.uploadFile(zip); - await page.$eval( - gSelectors.buttonUploadNewVersion, - (elSubmit: HTMLButtonElement) => elSubmit.click() - ); + await page.click(gSelectors.buttonUploadNewVersion); return getErrorsOrNone({ page, packageId }); } @@ -89,9 +87,16 @@ async function openRelevantExtensionPage({ page: Page; packageId: number; }) { - const urlExtension = `${getBaseDashboardUrl(packageId)}?tab=versions`; + const switchToTabVersions = async () => { + await page.waitForSelector(gSelectors.tabs); + const elTabs = await page.$$(gSelectors.tabs); + const elTabVersions = elTabs[1]; + await elTabVersions.click(); + }; + + const urlExtension = getBaseDashboardUrl(packageId); return new Promise(async (resolve, reject) => { - const resonseListener = response => { + const responseListener = response => { if ( response.url() !== `https://addons.opera.com/api/developer/packages/${packageId}/` @@ -121,10 +126,10 @@ async function openRelevantExtensionPage({ ); return; } - page.off("response", resonseListener); - resolve(true); + page.off("response", responseListener); + switchToTabVersions().then(() => resolve(true)); }; - page.on("response", resonseListener); + page.on("response", responseListener); page.goto(urlExtension).catch(() => {}); });