Business Website QA Automation

Run Business Website test scenarios using the Crank BDD framework.

A Browser Logo

Your website is the front door to your sales and marketing process. Don't just test your website in isolation: validate that you're capturing the right data in the right systems.

Lead Generation Form QA

Fill out a form, then check Marketing Automation for the lead.

- step: Given I navigate to https://example.com
- step: When I enter {{test}} into input[name=Email]
- step: And I submit the form by clicking button[value=Subscribe]
- step: Then the source field on Marketo Lead {{test}} should be Web
Marketing Tag and Pixel QA

Perform a key action, then check that a tag fired.

- step: Given I navigate to https://example.com
- step: When I click the page element a.primary-cta
- step: Then Google Analytics should have tracked an event with category Link and action Click for tracking ID UA-1234-5

What is Crank?

Crank is a BDD test automation framework for SaaS-based business technology.

Developer Getting StartedHosted QA Automation for Business Users

Installing this Cog

Once you've successfully installed Crank you can install this Cog by running the following:

$ crank cog:install automatoninc/web

That's it! No further installation steps.

Business Website Test Steps

Click an element on a page Action

Use this step in a Scenario file like this:

- step: When I click the page element {{domQuerySelector}}
Expected Step Input
IDTypeDescription
domQuerySelector *StringElement's DOM Query Selector

Fill out a form field Action

Use this step in a Scenario file like this:

- step: When I fill out {{domQuerySelector}} with {{value}}
Expected Step Input
IDTypeDescription
domQuerySelector *StringField's DOM Query Selector
value *Any ScalarField Value

Focus on Frame Action

Use this step in a Scenario file like this:

- step: When I focus on the {{domQuerySelector}} frame
Expected Step Input
IDTypeDescription
domQuerySelector *StringThe iframe's DOM query selector, or "main" for the main frame

Scroll to a percentage depth of a web page Action

Use this step in a Scenario file like this:

- step: When I scroll to {{depth}}% of the page
Expected Step Input
IDTypeDescription
depth *NumberPercent Depth

Submit a form by clicking a button Action

Use this step in a Scenario file like this:

- step: When I submit the form by clicking {{domQuerySelector}}
Expected Step Input
IDTypeDescription
domQuerySelector *StringButton's DOM Query Selector

Check a page's Lighthouse performance score Assertion

Use this step in a Scenario file like this:

- step: Then the {{throttleTo}} lighthouse performance score should be {{expectedScore}} or higher
Expected Step Input
IDTypeDescription
throttleTo *StringThrottle Level (mobile or desktop)
expectedScore *NumberExpected Score
Exposed Dynamic Tokens
TokenTypeDescription
{{web.labData.actualScore}}NumberPerformance Score
{{web.labData.firstContentfulPaint}}NumberFirst Contentful Paint
{{web.labData.firstMeaningfulPaint}}NumberFirst Meaningful Paint
{{web.labData.speedIndex}}NumberSpeed Index
{{web.labData.firstCpuIdle}}NumberFirst CPU Idle
{{web.labData.timeToInteractive}}NumberTime to Interactive
{{web.labData.maxPotentialFirstInputDelay}}NumberMax Potential First Input Delay

Check current page info Assertion

Use this step in a Scenario file like this:

- step: Then the {{field}} of the current page should {{operator}} {{expectation}}
Expected Step Input
IDTypeDescription
field *StringPage Detail (status, text, or url)
operator *StringCheck Logic (contain, not contain, or be)
expectation *Any ScalarExpected Value

Check current page meta tag Assertion

Use this step in a Scenario file like this:

- step: Then the {{metaName}} meta tag on the current page should {{operator}} {{expectation}}
Expected Step Input
IDTypeDescription
metaName *StringMeta Tag name
operator *StringCheck Logic (be, contain, not contain, not be longer than, exist)
expectation Any ScalarExpected Value

Check for a specific network request Assertion

Use this step in a Scenario file like this:

- step: Then there should be {{reqCount}} matching network requests for {{baseUrl}}
Expected Step Input
IDTypeDescription
reqCount *Number# of Requests
baseUrl *URLBase URL Is
pathContains StringPath Contains
withParameters Map/ObjectParameters Include

Check that a Google Floodlight tag fired Assertion

Use this step in a Scenario file like this:

- step: Then a floodlight tag should have fired for advertiser {{aid}}, group {{group}}, and activity {{atag}}
Expected Step Input
IDTypeDescription
aid *NumberAdvertiser ID
group *StringGroup Tag String
atag *StringActivity Tag String
cMethod StringCounting Method (standard, unique, per session)
withVariables Map/ObjectCustom Variables, an optional map of variable names and their expected values

Check that Google Analytics tracked a pageview Assertion

Use this step in a Scenario file like this:

- step: Then google analytics should have tracked a pageview for tracking id {{id}}
Expected Step Input
IDTypeDescription
id *StringTracking / Measurement ID associated with the GA instance/property (e.g. UA-75228722-5)
withParameters Map/ObjectParameter Checks, an optional map of Google Analytics Measurement Protocol Parameters and their expected values.
Exposed Dynamic Tokens
TokenTypeDescription
{{web.googleAnalyticsRequest.cid}}StringGoogle Analytics Client ID
{{web.googleAnalyticsRequest.*}}*This step may expose additional dynamic tokens representing values on the googleAnalyticsRequest, depending on how you've configured the underlying system.

Check that Google Analytics tracked an event Assertion

Use this step in a Scenario file like this:

- step: Then google analytics should have tracked an event with category {{ec}} and action {{ea}} for tracking id {{id}}
Expected Step Input
IDTypeDescription
ec *StringEvent Category
ea *StringEvent Action
id *StringTracking / Measurement ID associated with the GA instance/property (e.g. UA-75228722-5)
withParameters Map/ObjectParameter Checks, an optional map of Google Analytics Measurement Protocol Parameters and their expected values.
Exposed Dynamic Tokens
TokenTypeDescription
{{web.googleAnalyticsRequest.cid}}StringGoogle Analytics Client ID
{{web.googleAnalyticsRequest.*}}*This step may expose additional dynamic tokens representing values on the googleAnalyticsRequest, depending on how you've configured the underlying system.

Check that Marketo Munchkin tracking loads Assertion

Use this step in a Scenario file like this:

- step: Then the tracking code for munchkin account id {{id}} should load
Expected Step Input
IDTypeDescription
id *StringMunchkin Account ID associated with the user's Marketo instance (e.g. 460-tdh-945)

Check that Pardot tracking loads Assertion

Use this step in a Scenario file like this:

- step: Then the tracking code for pardot account {{aid}} and campaign {{cid}} should have loaded
Expected Step Input
IDTypeDescription
aid *NumberPardot Account ID
cid *NumberPardot Campaign ID
customDomain URLCustom Tracker Domain
withParameters Map/ObjectParameter Checks, an optional map of query parameters and their expected values.
Exposed Dynamic Tokens
TokenTypeDescription
{{web.pardotTrackingRequest.visitor_id}}NumberVisitor ID
{{web.pardotTrackingRequest.*}}*This step may expose additional dynamic tokens representing values on the pardotTrackingRequest, depending on how you've configured the underlying system.

Check that the LinkedIn Conversion Pixel fired Assertion

Use this step in a Scenario file like this:

- step: Then the linkedin conversion pixel for partner id {{pid}} should have fired
  data:
    cid: 123
Expected Step Input
IDTypeDescription
pid *NumberLinkedIn Partner ID
cid *NumberLinkedIn Conversion ID

Check that the LinkedIn Insight tag fired Assertion

Use this step in a Scenario file like this:

- step: Then the linkedin insight tag for partner id {{pid}} should have fired
Expected Step Input
IDTypeDescription
pid *NumberLinkedIn Partner ID

Missing a Step You Need?

This Cog is open source! Your contributions are welcome and encouraged.

Contribute on GitHubJoin the Crank Spectrum Community