1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

running API tests with reporting qa nightly tests

This commit is contained in:
Martin McKeaveney 2023-02-15 23:38:59 +00:00
parent 5747963072
commit 6b5128a0bf
5 changed files with 38 additions and 100 deletions

View file

@ -7,7 +7,7 @@ on:
jobs: jobs:
nightly: nightly:
runs-on: ubuntu-latest runs-on: [self-hosted, qa]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -15,30 +15,11 @@ jobs:
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 14.x node-version: 14.x
- run: yarn - name: QA Core Integration Tests
- run: yarn bootstrap
- run: yarn build
- name: Pull from budibase-infra
run: | run: |
curl -H "Authorization: token ${{ secrets.GH_PERSONAL_TOKEN }}" \ cd qa-core
-H 'Accept: application/vnd.github.v3.raw' \ yarn
-o yarn api:test:ci
-L env:
wc -l BUDIBASE_HOST: budicloud.qa.budibase.net
BUDIBASE_ACCOUNTS_URL: https://account-portal.budicloud.qa.budibase.net
- uses: actions/upload-artifact@v3
with:
name: Test Reports
path:
# TODO: enable once running in QA test env
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: eu-west-1
# - name: Upload test results HTML
# uses: aws-actions/configure-aws-credentials@v1
# run: aws s3 cp packages/builder/cypress/reports/testReport.html s3://{{ secrets.BUDI_QA_REPORTS_BUCKET_NAME }}/$GITHUB_RUN_ID/index.html

View file

@ -18,7 +18,6 @@
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants" import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
import { import {
FIELDS, FIELDS,
AUTO_COLUMN_SUB_TYPES,
RelationshipTypes, RelationshipTypes,
ALLOWABLE_STRING_OPTIONS, ALLOWABLE_STRING_OPTIONS,
ALLOWABLE_NUMBER_OPTIONS, ALLOWABLE_NUMBER_OPTIONS,
@ -132,12 +131,6 @@
: availableAutoColumns : availableAutoColumns
// used to select what different options can be displayed for column type // used to select what different options can be displayed for column type
$: canBeSearched =
editableColumn?.type !== LINK_TYPE &&
editableColumn?.type !== JSON_TYPE &&
editableColumn?.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY &&
editableColumn?.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY &&
editableColumn?.type !== FORMULA_TYPE
$: canBeDisplay = $: canBeDisplay =
editableColumn?.type !== LINK_TYPE && editableColumn?.type !== LINK_TYPE &&
editableColumn?.type !== AUTO_TYPE && editableColumn?.type !== AUTO_TYPE &&
@ -254,18 +247,6 @@
} }
} }
function onChangePrimaryIndex(e) {
indexes = e.detail ? [editableColumn.name] : []
}
function onChangeSecondaryIndex(e) {
if (e.detail) {
indexes[1] = editableColumn.name
} else {
indexes = indexes.slice(0, 1)
}
}
function openJsonSchemaEditor() { function openJsonSchemaEditor() {
jsonSchemaModal.show() jsonSchemaModal.show()
} }
@ -460,24 +441,6 @@
</div> </div>
{/if} {/if}
{#if canBeSearched && !external}
<div>
<Label>Search Indexes</Label>
<Toggle
value={indexes[0] === editableColumn.name}
disabled={indexes[1] === editableColumn.name}
on:change={onChangePrimaryIndex}
text="Primary"
/>
<Toggle
value={indexes[1] === editableColumn.name}
disabled={!indexes[0] || indexes[0] === editableColumn.name}
on:change={onChangeSecondaryIndex}
text="Secondary"
/>
</div>
{/if}
{#if editableColumn.type === "string"} {#if editableColumn.type === "string"}
<Input <Input
type="number" type="number"

View file

@ -9,7 +9,7 @@
"url": "https://github.com/Budibase/budibase.git" "url": "https://github.com/Budibase/budibase.git"
}, },
"scripts": { "scripts": {
"test": "env-cmd jest --runInBand", "test": "env-cmd jest --runInBand --json --outputFile=testResults.json",
"test:watch": "env-cmd jest --watch", "test:watch": "env-cmd jest --watch",
"test:debug": "DEBUG=1 jest", "test:debug": "DEBUG=1 jest",
"docker:up": "docker-compose up -d", "docker:up": "docker-compose up -d",

View file

@ -5,36 +5,29 @@ const path = require("path")
const fs = require("fs") const fs = require("fs")
const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL
const DASHBOARD_URL = process.env.CYPRESS_DASHBOARD_URL
const GIT_SHA = process.env.GITHUB_SHA const GIT_SHA = process.env.GITHUB_SHA
const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
async function generateReport() { async function generateReport() {
// read the report file // read the report file
const REPORT_PATH = path.resolve( const REPORT_PATH = path.resolve(__dirname, "..", "testReport.json")
__dirname,
"..",
"cypress",
"reports",
"testReport.json"
)
const report = fs.readFileSync(REPORT_PATH, "utf-8") const report = fs.readFileSync(REPORT_PATH, "utf-8")
return JSON.parse(report) return JSON.parse(report)
} }
async function discordCypressResultsNotification(report) { async function discordResultsNotification(report) {
const { const {
suites, numTotalTestSuites,
tests, numTotalTests,
passes, numPassedTests,
pending, numPendingTests,
failures, numFailedTests,
duration, success,
passPercent, startTime,
skipped, endTime,
} = report.stats } = report
const OUTCOME = failures > 0 ? "failure" : "success" const OUTCOME = success ? "success" : "failure"
const options = { const options = {
method: "POST", method: "POST",
@ -68,51 +61,51 @@ async function discordCypressResultsNotification(report) {
name: "Commit", name: "Commit",
value: `https://github.com/Budibase/budibase/commit/${GIT_SHA}`, value: `https://github.com/Budibase/budibase/commit/${GIT_SHA}`,
}, },
{
name: "Cypress Dashboard URL",
value: DASHBOARD_URL || "None Supplied",
},
{ {
name: "Github Actions Run URL", name: "Github Actions Run URL",
value: GITHUB_ACTIONS_RUN_URL || "None Supplied", value: GITHUB_ACTIONS_RUN_URL || "None Supplied",
}, },
{ {
name: "Test Suites", name: "Test Suites",
value: suites, value: numTotalTestSuites,
}, },
{ {
name: "Tests", name: "Tests",
value: tests, value: numTotalTests,
}, },
{ {
name: "Passed", name: "Passed",
value: passes, value: numPassedTests,
}, },
{ {
name: "Pending", name: "Pending",
value: pending, value: numPendingTests,
},
{
name: "Skipped",
value: skipped,
}, },
{ {
name: "Failures", name: "Failures",
value: failures, value: numFailedTests,
}, },
{ {
name: "Duration", name: "Duration",
value: `${duration / 1000} Seconds`, value: endTime
? `${(endTime - startTime) / 1000} Seconds`
: "DNF",
}, },
{ {
name: "Pass Percentage", name: "Pass Percentage",
value: Math.floor(passPercent), value: Math.floor((numPassedTests / numTotalTests) * 100),
}, },
], ],
}, },
], ],
}), }),
} }
// Only post in discord when tests fail
if (success) {
return
}
const response = await fetch(WEBHOOK_URL, options) const response = await fetch(WEBHOOK_URL, options)
if (response.status >= 201) { if (response.status >= 201) {
@ -125,7 +118,7 @@ async function discordCypressResultsNotification(report) {
async function run() { async function run() {
const report = await generateReport() const report = await generateReport()
await discordCypressResultsNotification(report) await discordResultsNotification(report)
} }
run() run()

1
qa-core/testReport.json Normal file

File diff suppressed because one or more lines are too long