Skip to content

Commit

Permalink
Instrumentation for sync cli (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack authored Feb 6, 2024
1 parent 07bd7ce commit 413f06b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/webdriver-utils/src/providers/automateProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export default class AutomateProvider extends GenericProvider {
percyScreenshotUrl: this.buildInfo?.url,
status: error ? 'failure' : 'success',
statusMessage: error ? `${error}` : '',
state: 'end'
state: 'end',
sync: this.options?.sync
});
} catch (e) {
log.debug(`[${name}] : Could not execute percyScreenshot command for Automate`);
Expand Down
13 changes: 13 additions & 0 deletions packages/webdriver-utils/test/providers/automateProvider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ describe('AutomateProvider', () => {
args: []
});
});

it('passes sync options value to', async () => {
const automateProvider = new AutomateProvider('1234', 'https://localhost/command-executor', { platform: 'win' }, {}, 'client', 'environment', { sync: true }, percyBuildInfo);
await automateProvider.createDriver();
automateProvider.driver.executeScript = jasmine.createSpy().and.resolveTo('success');
await automateProvider.percyScreenshotEnd('abc', undefined);

expect(automateProvider.driver.executeScript).toHaveBeenCalledWith(
{
script: `browserstack_executor: {"action":"percyScreenshot","arguments":{"name":"abc","percyScreenshotUrl":"${percyBuildInfo.url}","status":"success","statusMessage":"","state":"end","sync":true}}`,
args: []
});
});
});

function tilesErrorResponseCheck(automateProvider) {
Expand Down

0 comments on commit 413f06b

Please sign in to comment.