Skip to content

Commit

Permalink
test: snapshots for workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 20, 2024
1 parent 826638f commit 1a1b3b8
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dear {!Lead.Name},

Thank you for your inquiry about GenWatt's products.

A representative will contact you shortly.

Thanks,
The GenWatt Team
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
<available>true</available>
<description>Standard email response to website product inquiries</description>
<encodingKey>UTF-8</encodingKey>
<name>Marketing: Product Inquiry Response</name>
<style>none</style>
<subject>GenWatt: Thanks for your inquiry</subject>
<type>text</type>
<uiType>Aloha</uiType>
</EmailTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>emailtest/MarketingProductInquiryResponse</members>
<name>EmailTemplate</name>
</types>
<types>
<members>Account</members>
<name>Workflow</name>
</types>
<types>
<members>Account.emailalert1</members>
<name>WorkflowAlert</name>
</types>
<types>
<members>Account.fieldupdate1</members>
<name>WorkflowFieldUpdate</name>
</types>
<types>
<members>Account.outboundmsg1</members>
<name>WorkflowOutboundMessage</name>
</types>
<types>
<members>Account.task_1</members>
<name>WorkflowTask</name>
</types>
<version>60.0</version>
</Package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workflow xmlns="http://soap.sforce.com/2006/04/metadata">
<alerts>
<fullName>emailalert1</fullName>
<description>emailalert1</description>
<protected>false</protected>
<recipients>
<recipient>[email protected]</recipient>
<type>user</type>
</recipients>
<senderType>CurrentUser</senderType>
<template>emailtest/MarketingProductInquiryResponse</template>
</alerts>
<fieldUpdates>
<fullName>fieldupdate1</fullName>
<description>this is fieldupdate 1</description>
<field>BillingCountry</field>
<formula>&quot;USA&quot;</formula>
<name>fieldupdate1</name>
<notifyAssignee>false</notifyAssignee>
<operation>Formula</operation>
<protected>false</protected>
</fieldUpdates>
<outboundMessages>
<fullName>outboundmsg1</fullName>
<apiVersion>46.0</apiVersion>
<description>this is outbound message 1</description>
<endpointUrl>https://mobile1.t.salesforce.com/</endpointUrl>
<fields>AccountNumber</fields>
<fields>AccountSource</fields>
<fields>BillingCity</fields>
<fields>Id</fields>
<includeSessionId>false</includeSessionId>
<integrationUser>[email protected]</integrationUser>
<name>outboundmsg1</name>
<protected>false</protected>
<useDeadLetterQueue>false</useDeadLetterQueue>
</outboundMessages>
<tasks>
<fullName>task_1</fullName>
<assignedTo>[email protected]</assignedTo>
<assignedToType>user</assignedToType>
<description>This is task 1.</description>
<dueDateOffset>1</dueDateOffset>
<notifyAssignee>false</notifyAssignee>
<priority>High</priority>
<protected>false</protected>
<status>Not Started</status>
<subject>task 1</subject>
</tasks>
</Workflow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dear {!Lead.Name},

Thank you for your inquiry about GenWatt's products.

A representative will contact you shortly.

Thanks,
The GenWatt Team
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
<available>true</available>
<description>Standard email response to website product inquiries</description>
<encodingKey>UTF-8</encodingKey>
<name>Marketing: Product Inquiry Response</name>
<style>none</style>
<subject>GenWatt: Thanks for your inquiry</subject>
<type>text</type>
<uiType>Aloha</uiType>
</EmailTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workflow xmlns="http://soap.sforce.com/2006/04/metadata">
<alerts>
<fullName>emailalert1</fullName>
<description>emailalert1</description>
<protected>false</protected>
<recipients>
<recipient>[email protected]</recipient>
<type>user</type>
</recipients>
<senderType>CurrentUser</senderType>
<template>emailtest/MarketingProductInquiryResponse</template>
</alerts>
<fieldUpdates>
<fullName>fieldupdate1</fullName>
<description>this is fieldupdate 1</description>
<field>BillingCountry</field>
<formula>&quot;USA&quot;</formula>
<name>fieldupdate1</name>
<notifyAssignee>false</notifyAssignee>
<operation>Formula</operation>
<protected>false</protected>
</fieldUpdates>
<outboundMessages>
<fullName>outboundmsg1</fullName>
<apiVersion>46.0</apiVersion>
<description>this is outbound message 1</description>
<endpointUrl>https://mobile1.t.salesforce.com/</endpointUrl>
<fields>AccountNumber</fields>
<fields>AccountSource</fields>
<fields>BillingCity</fields>
<fields>Id</fields>
<includeSessionId>false</includeSessionId>
<integrationUser>[email protected]</integrationUser>
<name>outboundmsg1</name>
<protected>false</protected>
<useDeadLetterQueue>false</useDeadLetterQueue>
</outboundMessages>
<tasks>
<fullName>task_1</fullName>
<assignedTo>[email protected]</assignedTo>
<assignedToType>user</assignedToType>
<description>This is task 1.</description>
<dueDateOffset>1</dueDateOffset>
<notifyAssignee>false</notifyAssignee>
<priority>High</priority>
<protected>false</protected>
<status>Not Started</status>
<subject>task 1</subject>
</tasks>
</Workflow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dear {!Lead.Name},

Thank you for your inquiry about GenWatt's products.

A representative will contact you shortly.

Thanks,
The GenWatt Team
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
<available>true</available>
<description>Standard email response to website product inquiries</description>
<encodingKey>UTF-8</encodingKey>
<name>Marketing: Product Inquiry Response</name>
<style>none</style>
<subject>GenWatt: Thanks for your inquiry</subject>
<type>text</type>
<uiType>Aloha</uiType>
</EmailTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workflow xmlns="http://soap.sforce.com/2006/04/metadata">
<alerts>
<fullName>emailalert1</fullName>
<description>emailalert1</description>
<protected>false</protected>
<recipients>
<recipient>[email protected]</recipient>
<type>user</type>
</recipients>
<senderType>CurrentUser</senderType>
<template>emailtest/MarketingProductInquiryResponse</template>
</alerts>
<fieldUpdates>
<fullName>fieldupdate1</fullName>
<description>this is fieldupdate 1</description>
<field>BillingCountry</field>
<formula>&quot;USA&quot;</formula>
<name>fieldupdate1</name>
<notifyAssignee>false</notifyAssignee>
<operation>Formula</operation>
<protected>false</protected>
</fieldUpdates>
<outboundMessages>
<fullName>outboundmsg1</fullName>
<apiVersion>46.0</apiVersion>
<description>this is outbound message 1</description>
<endpointUrl>https://mobile1.t.salesforce.com/</endpointUrl>
<fields>AccountNumber</fields>
<fields>AccountSource</fields>
<fields>BillingCity</fields>
<fields>Id</fields>
<includeSessionId>false</includeSessionId>
<integrationUser>[email protected]</integrationUser>
<name>outboundmsg1</name>
<protected>false</protected>
<useDeadLetterQueue>false</useDeadLetterQueue>
</outboundMessages>
<tasks>
<fullName>task_1</fullName>
<assignedTo>[email protected]</assignedTo>
<assignedToType>user</assignedToType>
<description>This is task 1.</description>
<dueDateOffset>1</dueDateOffset>
<notifyAssignee>false</notifyAssignee>
<priority>High</priority>
<protected>false</protected>
<status>Not Started</status>
<subject>task 1</subject>
</tasks>
</Workflow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>pkg3</fullName>
<types>
<members>emailtest</members>
<members>emailtest/MarketingProductInquiryResponse</members>
<name>EmailTemplate</name>
</types>
<types>
<members>Account.emailalert1</members>
<name>WorkflowAlert</name>
</types>
<types>
<members>Account.fieldupdate1</members>
<name>WorkflowFieldUpdate</name>
</types>
<types>
<members>Account.outboundmsg1</members>
<name>WorkflowOutboundMessage</name>
</types>
<types>
<members>Account.task_1</members>
<name>WorkflowTask</name>
</types>
<types>
<members>*</members>
<name>Workflow</name>
</types>
<version>60.0</version>
</Package>
12 changes: 12 additions & 0 deletions test/snapshot/sampleProjects/workflow/sfdx-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "workflowProject",
"namespace": "",
"packageDirectories": [
{
"default": true,
"path": "force-app"
}
],
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "52.0"
}
45 changes: 45 additions & 0 deletions test/snapshot/sampleProjects/workflow/snapshots.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import { dirsAreIdentical, fileSnap, mdapiToSource, sourceToMdapi } from '../../helper/conversions';

// we don't want failing tests outputting over each other
/* eslint-disable no-await-in-loop */

describe('Workflow and children', () => {
const testDir = path.join('test', 'snapshot', 'sampleProjects', 'workflow');
let sourceFiles: string[];
let mdFiles: string[];

before(async () => {
await fs.promises.mkdir(path.join(testDir, 'force-app'), { recursive: true });
sourceFiles = await mdapiToSource(testDir);
mdFiles = await sourceToMdapi(testDir);
});
it('verify source files', async () => {
for (const file of sourceFiles) {
await fileSnap(file, testDir);
}
dirsAreIdentical(
path.join(testDir, 'force-app'),
path.join(testDir, '__snapshots__', 'verify-source-files.expected', 'force-app')
);
});
it('verify md files', async () => {
for (const file of mdFiles) {
await fileSnap(file, testDir);
}
});

after(async () => {
await Promise.all([
fs.promises.rm(path.join(testDir, 'force-app'), { recursive: true, force: true }),
fs.promises.rm(path.join(testDir, 'mdapiOutput'), { recursive: true, force: true }),
]);
});
});

2 comments on commit 1a1b3b8

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 1a1b3b8 Previous: 29c8979 Ratio
eda-componentSetCreate-linux 214 ms 233 ms 0.92
eda-sourceToMdapi-linux 2017 ms 2004 ms 1.01
eda-sourceToZip-linux 1717 ms 1650 ms 1.04
eda-mdapiToSource-linux 2938 ms 3083 ms 0.95
lotsOfClasses-componentSetCreate-linux 378 ms 387 ms 0.98
lotsOfClasses-sourceToMdapi-linux 3592 ms 3546 ms 1.01
lotsOfClasses-sourceToZip-linux 2765 ms 2730 ms 1.01
lotsOfClasses-mdapiToSource-linux 3345 ms 3479 ms 0.96
lotsOfClassesOneDir-componentSetCreate-linux 624 ms 641 ms 0.97
lotsOfClassesOneDir-sourceToMdapi-linux 6393 ms 6231 ms 1.03
lotsOfClassesOneDir-sourceToZip-linux 5422 ms 5210 ms 1.04
lotsOfClassesOneDir-mdapiToSource-linux 6344 ms 6154 ms 1.03

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 1a1b3b8 Previous: 29c8979 Ratio
eda-componentSetCreate-win32 401 ms 402 ms 1.00
eda-sourceToMdapi-win32 3441 ms 3481 ms 0.99
eda-sourceToZip-win32 2486 ms 2555 ms 0.97
eda-mdapiToSource-win32 5697 ms 5996 ms 0.95
lotsOfClasses-componentSetCreate-win32 888 ms 943 ms 0.94
lotsOfClasses-sourceToMdapi-win32 7600 ms 7647 ms 0.99
lotsOfClasses-sourceToZip-win32 4882 ms 4863 ms 1.00
lotsOfClasses-mdapiToSource-win32 7468 ms 7381 ms 1.01
lotsOfClassesOneDir-componentSetCreate-win32 1478 ms 1471 ms 1.00
lotsOfClassesOneDir-sourceToMdapi-win32 13883 ms 13627 ms 1.02
lotsOfClassesOneDir-sourceToZip-win32 8536 ms 8312 ms 1.03
lotsOfClassesOneDir-mdapiToSource-win32 13527 ms 13435 ms 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.