Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Cog and Run Test Scenarios in Circle CI #50

Merged
merged 7 commits into from Dec 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 74 additions & 1 deletion .circleci/config.yml
Expand Up @@ -5,6 +5,11 @@ executors:
IMAGE_NAME: automatoninc/salesforce
docker:
- image: circleci/buildpack-deps:stretch
docker-user:
environment:
IMAGE_NAME: automatoninc/salesforce
machine:
image: circleci/classic:latest

jobs:
test:
Expand Down Expand Up @@ -51,6 +56,48 @@ jobs:
root: .
paths:
- ./image.tar

install-built-cog:
executor: docker-user
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Load archived Docker image
command: docker load -i /tmp/workspace/image.tar
- run:
name: Install Crank and the built Cog
command: |
curl -s https://get.crank.run/install.sh | sh
docker tag $IMAGE_NAME:latest $IMAGE_NAME:local-test
crank cog:install $IMAGE_NAME:local-test --ignore-auth
- run:
name: List steps
command: crank registry:steps
- run:
name: Uninstall Cog
command: crank cog:uninstall $IMAGE_NAME --force

run-test-scenarios:
executor: docker-user
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Load archived Docker image
command: docker load -i /tmp/workspace/image.tar
- run:
name: Install Crank and required Cogs
command: |
curl -s https://get.crank.run/install.sh | sh
docker tag $IMAGE_NAME:latest $IMAGE_NAME:local-test
crank cog:install $IMAGE_NAME:local-test
crank cog:install automatoninc/web:0.3.1
- run:
name: Run all test scenarios
command: crank run ./test/scenarios

publish-dev:
executor: docker-publisher
steps:
Expand All @@ -67,6 +114,7 @@ jobs:
IMAGE_TAG="dev-v${CIRCLE_BUILD_NUM}"
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
docker push $IMAGE_NAME:$IMAGE_TAG

publish-tag:
executor: docker-publisher
steps:
Expand Down Expand Up @@ -96,6 +144,24 @@ workflows:
- master
tags:
ignore: /.*/
- build:
filters:
branches:
ignore:
- master
tags:
ignore: /.*/
- install-built-cog:
context: salesforce-cog-sandbox-env-credentials
requires:
- test
- build
filters:
branches:
ignore:
- master
tags:
ignore: /.*/

build-master:
jobs:
Expand All @@ -107,11 +173,18 @@ workflows:
filters:
branches:
only: master
- run-test-scenarios:
context: salesforce-cog-sandbox-env-credentials
requires:
- build
filters:
branches:
only: master
- publish-dev:
context: docker-creds-to-publish-cogs
requires:
- test
- build
- run-test-scenarios
filters:
branches:
only: master
Expand Down
23 changes: 0 additions & 23 deletions test/scenario/campaign-member-member.crank.yml

This file was deleted.

23 changes: 0 additions & 23 deletions test/scenario/campaign-member-success.crank.yml

This file was deleted.

29 changes: 0 additions & 29 deletions test/scenario/form-test-validated-in-salesforce.crank.yml

This file was deleted.

19 changes: 0 additions & 19 deletions test/scenario/salesforce-account-api-test.crank.yml

This file was deleted.

15 changes: 0 additions & 15 deletions test/scenario/salesforce-api-test.crank.yml

This file was deleted.

28 changes: 0 additions & 28 deletions test/scenario/salesforce-contact-api-test.crank.yml

This file was deleted.

15 changes: 0 additions & 15 deletions test/scenario/salesforce-contact.crank.yml

This file was deleted.

26 changes: 0 additions & 26 deletions test/scenario/salesforce-opportunity-api-test.crank.yml

This file was deleted.

20 changes: 20 additions & 0 deletions test/scenarios/Account API.crank.yml
@@ -0,0 +1,20 @@
scenario: Salesforce Account Test
description: This validates the behavior of Account creation, validation, and deletion.

steps:
- step: When I create a Salesforce Account
data:
account:
Name: Joshua2
Website: https://www.google.com/
Type: Prospect
Industry: Technology
NumberOfEmployees: 100
OwnerId: 0054P000009iu8WQAQ

- step: Then the Name field on Salesforce Account with Name Joshua2 should be Joshua2
- step: And the Website field on Salesforce Account with Name Joshua2 should be https://www.google.com/
- step: And the Type field on Salesforce Account with Name Joshua2 should be Prospect
- step: And the Industry field on Salesforce Account with Name Joshua2 should be Technology
- step: And the NumberOfEmployees field on Salesforce Account with Name Joshua2 should be 100
- step: Finally, delete the Salesforce Account with Name Joshua2
24 changes: 24 additions & 0 deletions test/scenarios/CampaignMember - Web-To-Lead - Default.crank.yml
@@ -0,0 +1,24 @@
scenario: Salesforce Campaign Member Test - Default Status
description: This validates the creation of Campaign Membership from a Web-To-Lead form.

tokens:
testEmail: jobelle@thisisjust.atomatest.com
testLastname: Garcia
testFirstname: Jobelle
testState: Washington
testCity: Seattle
testSubmit: input[type=submit]

steps:
- step: Given I navigate to https://www.automatoninc.com/dev-qa-sfdc-web-to-lead/
- step: When I fill out input[name=email] with {{testEmail}}
- step: And I fill out input[name=last_name] with {{testLastname}}
- step: And I fill out input[name=first_name] with {{testFirstname}}
- step: And I fill out input[name=state] with {{testState}}
- step: And I fill out input[name=city] with {{testCity}}
- step: And I submit the form by clicking {{testSubmit}}
- step: Then the Salesforce Lead {{testEmail}} should have Campaign Member Status set to Responded on Campaign 7014P000001T3u1QAC
failAfter: 60
- step: And the Salesforce Lead {{testEmail}} should have Campaign Member LastName set to {{testLastname}} on Campaign 7014P000001T3u1QAC
- step: And the Salesforce Lead {{testEmail}} should have Campaign Member Email set to {{testEmail}} on Campaign 7014P000001T3u1QAC
- step: Delete the {{testEmail}} Salesforce Lead
25 changes: 25 additions & 0 deletions test/scenarios/CampaignMember - Web-To-Lead - Overridden.crank.yml
@@ -0,0 +1,25 @@
scenario: Salesforce Campaign Member Test - Overridden Status
description: This validates the creation of Campaign Membership from a Web-To-Lead form with an overridden status.

tokens:
testEmail: jobelle@thisisjust.atomatest.com
testLastname: Garcia
testFirstname: Jobelle
testState: Washington
testCity: Seattle
testSubmit: input[type=submit]

steps:
- step: Given I navigate to https://www.automatoninc.com/dev-qa-sfdc-web-to-lead/
- step: And I fill fill out input[name=member_status] with Sent
- step: When I fill out input[name=email] with {{testEmail}}
- step: And I fill out input[name=last_name] with {{testLastname}}
- step: And I fill out input[name=first_name] with {{testFirstname}}
- step: And I fill out input[name=state] with {{testState}}
- step: And I fill out input[name=city] with {{testCity}}
- step: And I submit the form by clicking {{testSubmit}}
- step: Then the Salesforce Lead {{testEmail}} should have Campaign Member Status set to Sent on Campaign 7014P000001T3u1QAC
failAfter: 60
- step: And the Salesforce Lead {{testEmail}} should have Campaign Member LastName set to {{testLastname}} on Campaign 7014P000001T3u1QAC
- step: And the Salesforce Lead {{testEmail}} should have Campaign Member Email set to {{testEmail}} on Campaign 7014P000001T3u1QAC
- step: Delete the {{testEmail}} Salesforce Lead