From c30a6629cde73a29922758712a8702ecd420eab0 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Fri, 8 Dec 2017 18:14:55 -0500 Subject: [PATCH] chore(snapshot): get snapshot comparisons with v3 working http://ionic-snapshot-go.appspot.com/ionic-core/snapshots/v3-master/hbe/ chrome_400x800 --- packages/core/scripts/e2e/index.js | 2 +- packages/core/scripts/e2e/snapshot.js | 15 +++++++++++++-- .../src/components/action-sheet/test/basic/e2e.js | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/core/scripts/e2e/index.js b/packages/core/scripts/e2e/index.js index 57f881f96a..1b6203a773 100644 --- a/packages/core/scripts/e2e/index.js +++ b/packages/core/scripts/e2e/index.js @@ -59,7 +59,7 @@ function registerE2ETest(desc, tst) { await tst(driver); if (takeScreenshots) { await snapshot.takeScreenshot(driver, { - name: this.test.fullTitle(), + name: this.test.fullTitle().replace(/(^[\w-]+\/[\w-]+)/, '$1:'), specIndex: specIndex++ }); } diff --git a/packages/core/scripts/e2e/snapshot.js b/packages/core/scripts/e2e/snapshot.js index 7345e7d7e4..7352519040 100644 --- a/packages/core/scripts/e2e/snapshot.js +++ b/packages/core/scripts/e2e/snapshot.js @@ -93,13 +93,24 @@ class Snapshot { async _takeScreenshot(driver, options) { const capabilities = await driver.getCapabilities(); + const png = await driver.takeScreenshot(); - const url = await driver.getCurrentUrl(); + let url = await driver.getCurrentUrl(); + + // TODO remove the modified url/description once we're happy with the comparison to v3 + let platform = 'android'; + + let replacedUrl = url.replace('3333', '8876').replace('src/components', '/e2e').replace('test/', ''); + url = replacedUrl + `/index.html?ionicplatform=${platform}&ionicOverlayCreatedDiff=0&snapshot=true`; + console.log('url', url); + + let description = options.name.replace(': ', `: ${platform} `) + '.'; + console.log('description', description); return Promise.resolve({ app_id: this.appId, group_id: this.groupId, - description: options.name, + description: description, spec_index: options.specIndex, total_specs: this.totalSpecs, test_id: this.testId, diff --git a/packages/core/src/components/action-sheet/test/basic/e2e.js b/packages/core/src/components/action-sheet/test/basic/e2e.js index bbb8b65e66..cedce9f4d5 100644 --- a/packages/core/src/components/action-sheet/test/basic/e2e.js +++ b/packages/core/src/components/action-sheet/test/basic/e2e.js @@ -5,7 +5,7 @@ const { register, Page } = require('../../../../../scripts/e2e'); class ActionSheetE2ETestPage extends Page { constructor(driver) { - super(driver, 'http://localhost:3333/src/components/action-sheet/test/basic/index.html'); + super(driver, 'http://localhost:3333/src/components/action-sheet/test/basic'); } present(buttonId) {