Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mablhq/github-run-tests-action
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedpair committed May 12, 2021
2 parents 78aa532 + 3dea08d commit d2fca10
Show file tree
Hide file tree
Showing 10 changed files with 373 additions and 102 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: Mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@main

- name: Install dependencies
run: npm ci
Expand All @@ -29,4 +29,11 @@ jobs:
with:
application-id: D6uz-lhAGBYuTTc6Jj_w0Q-a
environment-id: I9tfo2dWd7WSigXcO91feA-e
browser-types: chrome
browser-types: |
chrome
plan-labels: |
canary
smoke-test
http-headers: |
X-Test-Header-1: 1234
X-Test-Header-2: 5678
12 changes: 10 additions & 2 deletions .github/workflows/push-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@main

- name: Install dependencies
run: npm ci
Expand All @@ -30,4 +30,12 @@ jobs:
with:
application-id: D6uz-lhAGBYuTTc6Jj_w0Q-a
environment-id: I9tfo2dWd7WSigXcO91feA-e
browser-types: chrome
browser-types: |
chrome
plan-labels: |
canary
smoke-test
http-headers: |
X-Test-Header-1: 1234
X-Test-Header-2: 5678
59 changes: 53 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ test runs associated with that deployment and waiting for their results.

For more complex use cases, see the [setup-mabl-cli](https://github.com/marketplace/actions/setup-mabl-cli) Action to access the CLI directly.

### Example workflow:
### Example workflow: Simple

```
on: [push]
name: mabl
name: mabl Simple Example
jobs:
test:
Expand All @@ -32,6 +32,50 @@ jobs:
environment-id: <your-environment-id-e>
```

### Example workflow: Complete

Using all available flags.

```
on: [push]
name: mabl Complex Example
jobs:
test:
name: mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Functional test deployment
id: mabl-test-deployment
uses: mablhq/github-run-tests-action@v1
env:
MABL_API_KEY: ${{ secrets.MABL_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
application-id: <your-application-id-a>
environment-id: <your-environment-id-e>
uri: <your-override-url>
mabl-branch: <your-mabl-branch-name>
# Runs for both browsers
browser-types: |
chrome
firefox
# Runs plans matching ANY of the following labels AND the environment/application IDs above
plan-labels: |
canary
smoke-test
http-headers: |
My-Header:the-value
My-Other-Header:the-second-value
continue-on-failure: true
rebaseline-images: true
set-static-baseline: true
event-time: <your-event-time-epoch-milliseconds>
```

### Environment variables

- `MABL_API_KEY` {string} - Your mabl API key
Expand All @@ -55,18 +99,21 @@ jobs:
Use the
[curl builder](https://app.mabl.com/workspaces/-/settings/apis#api-docs-selector-dropdown-button)
to find the id.
- `browser-types` {string} {optional}: comma separated override for browser
- `browser-types` {string} (optional): comma or new line separated override for browser
types to test e.g. `chrome, firefox, safari, internet_explorer`. If not
provided, mabl will test the browsers configured on the triggered test.
- `uri` {string} {optional} the base uri to test against. If provided, this will
- `plan-labels` {string} (optional): comma or new line separated plan labels to test. Plans matching **any** label will be run. e.g. `smoke-test, beta-feature`. Note: additional selection criteria must also be met like application-id or environment-id, if supplied.
- `uri` {string} (optional) the base uri to test against. If provided, this will
override the default uri associated with the environment in mabl
- `mabl-branch` {string} (optional) run tests on the mabl branch of tests with this name. Defaults to `master`.
- `http-headers` {string} (optional) Headers to add to all requests e.g. "My-Header:the-value" (comma or new line delimited).
- `rebaseline-images` {boolean} (optional) - Set `true` to reset the visual
baseline to the current deployment
- `set-static-baseline` {boolean} {optional} - Set `true` to use current
- `set-static-baseline` {boolean} (optional) - Set `true` to use current
deployment as an exact static baseline. If set, mabl will **not** model
dynamic areas and will use the current deployment as the pixel-exact visual
baseline.
- `continue-on-failure` {boolean} {optional} - Set to true to continue the build
- `continue-on-failure` {boolean} (optional) - Set to true to continue the build
even if there are test failures
- `event-time` {int64} (optional) - Event time the deployment occurred in UTC
epoch milliseconds. Defaults to now.
Expand Down
38 changes: 25 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,38 @@ branding:
inputs:
application-id:
description: ^
'the mabl id for the deployed application. You can get the id using the
'Mabl id for the deployed application. You can get the id using the
curl builder at https://app.mabl.com/workspaces/-/settings/apis. Either
this or environment-id must be provided'
required: false
environment-id:
description: ^
'the mabl id for the deployed environment. You can get the id using the
'Mabl id for the deployed environment. You can get the id using the
curl builder at https://app.mabl.com/workspaces/-/settings/apis. Either
this or application-id must be provided'
required: false
browser-types:
description: ^
'override for the browser types to test (comma separated). If not provided, mabl will test
the browsers configured on the triggered test plans.'
'Override browser types to test. If not provided, mabl will test
the browsers configured on the triggered test plans (comma or new line delimited).'
required: false
plan-labels:
description: ^
'Include all plans with ANY of the supplied labels (comma or new line delimited).'
required: false
uri:
description: ^
'the base uri to test against. If provided, this will override the default uri
'Base URI to test against. If provided, this will override the default URI
associated with the environment in mabl'
required: false
mabl-branch:
description: ^
'Run tests on the mabl branch of tests with this name. Defaults to "master".'
required: false
http-headers:
description: ^
'Headers to add to all requests e.g. "My-Header:the-value" (comma or new line delimited).'
required: false
rebaseline-images:
description: ^
'Set to true to reset the visual baseline to the current deployment'
Expand All @@ -44,23 +56,23 @@ inputs:
required: false
default: false
event-time:
description: "The event time the deployment happened at. Defaults to now."
description: "Event time the deployment occurred. Defaults to now."
required: false
outputs:
mabl-deployment-id:
description: "mabl deployment event id"
description: "Mabl deployment event id"
plans_run:
description: "total number of mabl plans run against this deployment. A mabl plan is a collection of similarly configured tests."
description: "Total number of mabl plans run against this deployment. A mabl plan is a collection of similarly configured tests."
plans_passed:
description: "number of mabl plans that passed against this deployment. A mabl plan is a collection of similarly configured tests."
description: "Number of mabl plans that passed against this deployment. A mabl plan is a collection of similarly configured tests."
plans_failed:
description: "number of mabl plans that failed against this deployment. A mabl plan is a collection of similarly configured tests."
description: "Number of mabl plans that failed against this deployment. A mabl plan is a collection of similarly configured tests."
tests_run:
description: "total number of mabl tests run against this deployment."
description: "Total number of mabl tests run against this deployment."
tests_passed:
description: "number of mabl tests that passed against this deployment."
description: "Number of mabl tests that passed against this deployment."
tests_failed:
description: "number of mabl tests that failed against this deployment."
description: "Number of mabl tests that failed against this deployment."

runs:
using: "node12"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mabl-github-deployments-action",
"version": "1.9.0",
"version": "1.10.0",
"description": "mabl github action for GitHub pipelines integration",
"main": "lib/src/index.js",
"scripts": {
Expand Down
26 changes: 26 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const USER_AGENT = 'mabl-github-run-tests-action';

export enum ActionInputs {
ApplicationId = 'application-id',
BrowserTypes = 'browser-types',
ContinueOnFailure = 'continue-on-failure',
EnvironmentId = 'environment-id',
EventTime = 'event-time',
HttpHeaders = 'http-headers',
MablBranch = 'mabl-branch',
PlanLabels = 'plan-labels',
RebaselineImages = 'rebaseline-images',
SetStaticBaseline = 'set-static-baseline',
Uri = 'uri',
}

export enum ActionOutputs {
DeploymentId = 'mabl-deployment-id',
// Note: from here down is snake case, not dash case
PlansRun = 'plans_run',
PlansPassed = 'plans_passed',
PlansFailed = 'plans_failed',
TestsRun = 'tests_run',
TestsPassed = 'tests_passed',
TestsFailed = 'tests_failed',
}
9 changes: 9 additions & 0 deletions src/entities/Environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface Environment {
id: string;
created_time: number;
created_by_id: string;
last_updated_time: number;
last_updated_by_id: string;
organization_id: string;
name: string;
}
Loading

0 comments on commit d2fca10

Please sign in to comment.