Skip to content

Commit

Permalink
Merge pull request #578 from amtrack/fix/winter-24-hvs
Browse files Browse the repository at this point in the history
fix: Winter 24 changes in HighVelocitySales UI
  • Loading branch information
amtrack authored Oct 11, 2023
2 parents bcad3b4 + f930f5d commit f595555
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/plugins/high-velocity-sales-settings/index.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import assert from 'assert';
import { HighVelocitySalesSettings } from '.';
import { Config, HighVelocitySalesSettings } from '.';

describe(HighVelocitySalesSettings.name, function () {
let plugin;
let plugin: HighVelocitySalesSettings;
before(() => {
plugin = new HighVelocitySalesSettings(global.bf);
});

const configEnabled = {
const configEnabled: Config = {
setUpAndEnable: true
};
const configDisabled = {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/high-velocity-sales-settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HighVelocitySalesSetupPage } from './page';
const MSG_NOT_AVAILABLE = `HighVelocitySales is not available in this organization.
Please add 'HighVelocitySales' to your Scratch Org Features or purchase a license.`;

type Config = {
export type Config = {
setUpAndEnable: boolean;
};

Expand Down
17 changes: 12 additions & 5 deletions src/plugins/high-velocity-sales-settings/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { throwPageErrors } from '../../browserforce';

const SET_UP_AND_ENABLE_HVS_BUTTON = 'button.setupAndEnableButton';
const ENABLE_TOGGLE = '#toggleHighVelocitySalesPref';
const AUTOMATION_TAB_ITEM = 'pierce/#automationTab__item';

export class HighVelocitySalesSetupPage {
private page;
private page: Page;

constructor(page: Page) {
this.page = page;
Expand All @@ -16,12 +17,18 @@ export class HighVelocitySalesSetupPage {
}

public async setUpAndEnable(): Promise<void> {
await this.page.waitForSelector(SET_UP_AND_ENABLE_HVS_BUTTON, {
visible: true
});
// starting Winter 24 (v59.0) there is a new tab bar and the item is located in the "Automation" tab
// wait for tab item or the button directly
await this.page.waitForSelector(`${AUTOMATION_TAB_ITEM}, ${SET_UP_AND_ENABLE_HVS_BUTTON}`, { timeout: 60_000 });
if (await this.page.$(AUTOMATION_TAB_ITEM)) {
await Promise.all([
this.page.waitForSelector(SET_UP_AND_ENABLE_HVS_BUTTON, { timeout: 60_000 }),
this.page.click(AUTOMATION_TAB_ITEM)
])
}
await Promise.all([
this.page.waitForSelector(ENABLE_TOGGLE, { timeout: 60_000 }),
await this.page.click(SET_UP_AND_ENABLE_HVS_BUTTON)
this.page.click(SET_UP_AND_ENABLE_HVS_BUTTON)
]);
await throwPageErrors(this.page);
await this.page.close();
Expand Down

0 comments on commit f595555

Please sign in to comment.