Skip to content

Commit

Permalink
support for first upload.
Browse files Browse the repository at this point in the history
Fail if chrome/chromium is not found
  • Loading branch information
sandorfr committed Jul 29, 2018
1 parent ca3d2d1 commit 3060a47
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Tasks/GhostThemeUploader/ghostThemeUploaderTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ async function themeUpload() {
}

if (!chromium) {
throw new Error('Chromium was not found. Please install it');
tl.setResult(tl.TaskResult.Failed, 'Chromium was not found. Please install it');
return;
}

const browser = await puppeteer.launch({ executablePath: chromium });
Expand Down Expand Up @@ -80,9 +81,16 @@ async function themeUpload() {
await themeUpload.uploadFile(themePath);
await takeScreenshot(page, 'theme.file.png');

await page.waitFor('button.gh-btn-red');
await page.click('button.gh-btn-red');
await takeScreenshot(page, 'theme.uploading.png');
try {
// if overwrite message
await page.waitFor('button.gh-btn-red', { timeout: 1000 });

await page.click('button.gh-btn-red');
await takeScreenshot(page, 'theme.uploading.png');
}
catch (err) {

}

await page.waitForXPath("//h1[contains(.,'Upload successful!')]", { timeout: uploadTimeout * 1000 })
await takeScreenshot(page, 'complete.png');
Expand All @@ -98,7 +106,7 @@ async function themeUpload() {

} finally {
browser.close();

if (takeScreenshotsEnabled) {
let data = {
artifacttype: "container",
Expand Down

0 comments on commit 3060a47

Please sign in to comment.