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

feat: add workflow summary #566

Merged
merged 40 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
03567e0
feat(summary): add gh summary of results
Jun 3, 2022
5eed799
update table rows
Jun 3, 2022
856cc77
export result table to env var
Jun 3, 2022
eb92a36
add function to build summary
Jun 3, 2022
4e369d9
add function to build summary
Jun 3, 2022
5d4ffba
add function to build summary
Jun 3, 2022
af99648
add function to build summary
Jun 3, 2022
b46bf08
add function to build summary
Jun 3, 2022
9724517
add function to build summary
Jun 3, 2022
8d0aa49
add function to build summary
Jun 3, 2022
8d8a15c
add function to build summary
Jun 3, 2022
d234bf0
add data to summary
Jun 3, 2022
060ca47
testing data
Jun 3, 2022
57eeeb9
testing data
Jun 3, 2022
209274f
testing data
Jun 3, 2022
a8be4ab
testing data
Jun 3, 2022
016e338
testing data
Jun 3, 2022
cad3921
testing data
Jun 3, 2022
af9dffa
testing data
Jun 3, 2022
d1587c1
testing data
Jun 3, 2022
2981065
testing data
Jun 3, 2022
66197d9
debug results
Jun 6, 2022
bb8d223
debug test results on failure
Jun 6, 2022
c229c7c
testing generate summary in diff location
Jun 6, 2022
611eb0a
testing summary on failure
Jun 6, 2022
d060b03
testing failuers
Jun 6, 2022
dce555e
chore: cleanup summary PR
Jun 6, 2022
1879d22
remove returned results from run function as they're not needed.
Jun 6, 2022
dd6abf2
add debug to run data. add default to cell data.
Jun 6, 2022
315138a
add spec.name as fallback if baseName not present. add debug for gene…
Jun 6, 2022
0e4feb5
test adding dashboard link
Jun 7, 2022
9f58c25
test dashboard link
Jun 7, 2022
e6a46c3
update testUrl to runUrl
Jun 7, 2022
4092487
reduce header to h2. remove log
Jun 7, 2022
2d6cab4
test general summary instead of granular results.
Jun 7, 2022
eb7ed62
run build. update dashboard link.
Jun 7, 2022
fd767db
remove destructuring.
Jun 7, 2022
ab2d4d6
add template literals
Jun 7, 2022
aa6e409
remove dead code.
Jun 7, 2022
3a65c0d
remove log
Jun 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/example-component-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@4
uses: cypress-io/github-action@v4
with:
working-directory: examples/v10/component-tests
component: true
48 changes: 48 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75355,9 +75355,57 @@ const runTests = async () => {
process.chdir(workingDirectory)
return cypress
.run(cypressOptions)
.then(generateSummary)
.then(onTestsFinished, onTestsError)
}

const generateSummary = async (testResults) => {
console.log(
'🚀 ~ file: index.js ~ line 753 ~ generateSummary ~ testResults',
testResults
)
const headers = [
{ data: 'Spec :microscope:', header: true },
{ data: 'Result', header: true },
{ data: 'Passed :white_check_mark:', header: true },
{ data: 'Failed :x:', header: true },
{ data: 'Pending :hand:', header: true },
{ data: 'Skipped :leftwards_arrow_with_hook:', header: true },
{ data: 'Duration :clock8:', header: true }
]

const generateSummaryRow = (run) => {
const { spec, stats } = run
const status =
stats.failures === 0
? 'Passing :white_check_mark:'
: 'Failing :red_circle:'

return [
spec.baseName || spec.name || '',
status || '',
stats.passes.toString() || '',
stats.failures.toString() || '',
stats.pending.toString() || '',
stats.skipped.toString() || '',
`${stats.duration / 1000}s` || ''
]
}

const summaryRows = []

testResults.runs.map((run) => {
summaryRows.push(generateSummaryRow(run))
})

await core.summary
.addHeading('Cypress Results')
.addTable([headers, ...summaryRows])
.write()

return testResults
}

const installMaybe = () => {
const installParameter = getInputBool('install', true)
if (!installParameter) {
Expand Down
48 changes: 48 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,57 @@ const runTests = async () => {
process.chdir(workingDirectory)
return cypress
.run(cypressOptions)
.then(generateSummary)
.then(onTestsFinished, onTestsError)
}

const generateSummary = async (testResults) => {
console.log(
admah marked this conversation as resolved.
Show resolved Hide resolved
'🚀 ~ file: index.js ~ line 753 ~ generateSummary ~ testResults',
testResults
)
const headers = [
{ data: 'Spec :microscope:', header: true },
{ data: 'Result', header: true },
{ data: 'Passed :white_check_mark:', header: true },
{ data: 'Failed :x:', header: true },
{ data: 'Pending :hand:', header: true },
{ data: 'Skipped :leftwards_arrow_with_hook:', header: true },
{ data: 'Duration :clock8:', header: true }
]

const generateSummaryRow = (run) => {
const { spec, stats } = run
const status =
stats.failures === 0
? 'Passing :white_check_mark:'
: 'Failing :red_circle:'

return [
spec.baseName || spec.name || '',
status || '',
stats.passes.toString() || '',
stats.failures.toString() || '',
stats.pending.toString() || '',
stats.skipped.toString() || '',
`${stats.duration / 1000}s` || ''
]
}

const summaryRows = []

testResults.runs.map((run) => {
summaryRows.push(generateSummaryRow(run))
})

await core.summary
.addHeading('Cypress Results')
.addTable([headers, ...summaryRows])
.write()

return testResults
}

const installMaybe = () => {
const installParameter = getInputBool('install', true)
if (!installParameter) {
Expand Down