diff --git a/Gemfile b/Gemfile index 5f33a06..dde583b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,6 @@ gem "jekyll", "~> 4.4.1" gem "jekyll-report-dashboard" -group :jekyll_plugins do - gem "jekyll-tailwindcss" -end # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem # and associated library. diff --git a/Gemfile.lock b/Gemfile.lock index 60390a3..12cf845 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,22 +24,22 @@ GEM ffi (1.17.1-x86_64-linux-gnu) ffi (1.17.1-x86_64-linux-musl) forwardable-extended (2.6.0) - google-protobuf (4.30.1) + google-protobuf (4.30.2) bigdecimal rake (>= 13) - google-protobuf (4.30.1-aarch64-linux) + google-protobuf (4.30.2-aarch64-linux) bigdecimal rake (>= 13) - google-protobuf (4.30.1-arm64-darwin) + google-protobuf (4.30.2-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.30.1-x86-linux) + google-protobuf (4.30.2-x86-linux) bigdecimal rake (>= 13) - google-protobuf (4.30.1-x86_64-darwin) + google-protobuf (4.30.2-x86_64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.30.1-x86_64-linux) + google-protobuf (4.30.2-x86_64-linux) bigdecimal rake (>= 13) http_parser.rb (0.8.0) @@ -64,7 +64,9 @@ GEM safe_yaml (~> 1.0) terminal-table (>= 1.8, < 4.0) webrick (~> 1.7) - jekyll-report-dashboard (0.1.0) + jekyll-report-dashboard (0.1.7) + jekyll (~> 4.4.1) + jekyll-tailwindcss jekyll-sass-converter (3.1.0) sass-embedded (~> 1.75) jekyll-tailwindcss (0.6.2) @@ -162,7 +164,6 @@ DEPENDENCIES http_parser.rb (~> 0.6.0) jekyll (~> 4.4.1) jekyll-report-dashboard - jekyll-tailwindcss tzinfo (>= 1, < 3) tzinfo-data wdm (~> 0.1) diff --git a/_config.yml b/_config.yml index ff1845c..106cd41 100644 --- a/_config.yml +++ b/_config.yml @@ -29,9 +29,21 @@ github_username: thetif github_url: "https://github.com/FearlessSolutions/publish-playwright" # Build settings -# theme: +theme: jekyll-report-dashboard # plugins: +coverage: + pass: + lines: 90 + functions: 85 + statements: 90 + branches: 80 + fail: + lines: 70 + functions: 65 + statements: 70 + branches: 60 + # Exclude from processing. # The following items will not be processed, by default. # Any item listed under the `exclude:` key here will be automatically added to diff --git a/_data/coverage/thresholds.yml b/_data/coverage/thresholds.yml deleted file mode 100644 index c9b40c1..0000000 --- a/_data/coverage/thresholds.yml +++ /dev/null @@ -1,11 +0,0 @@ -pass: - lines: 90 - functions: 85 - statements: 90 - branches: 80 - -fail: - lines: 70 - functions: 65 - statements: 70 - branches: 60 diff --git a/_includes/coverage-summary.html b/_includes/coverage-summary.html index efa3d3c..dad20f1 100644 --- a/_includes/coverage-summary.html +++ b/_includes/coverage-summary.html @@ -14,8 +14,17 @@ {{ name | capitalize }} + {%- capture status -%} + {%- if values.pct >= site.coverage.pass.[name] -%} + text-pass + {%- elsif values.pct > site.coverage.fail.[name] -%} + text-warn + {%- else -%} + text-fail + {%- endif -%} + {%- endcapture -%} -
+
{{ values.pct | round: 1 }}%
diff --git a/_includes/playwright-branch-list.html b/_includes/playwright-branch-list.html index e4c945d..3e7b70e 100644 --- a/_includes/playwright-branch-list.html +++ b/_includes/playwright-branch-list.html @@ -11,8 +11,13 @@

{{ branch_name }}

View Previous Runs
- - {% assign latest_run_id = site.data.playwright-reports.branches[branch_name] | key_list | reverse | first %} + + {% assign runs = "" | split: ',' %} + {% for run_id in site.data.playwright-reports.branches[branch_name] %} + {% assign runs = runs | push: run_id %} + {% endfor %} + + {% assign latest_run_id = runs | reverse | first %} {% assign data = site.data.playwright-reports.branches[branch_name][latest_run_id] %} {% capture report_link %}/playwright-reports/branches/{{branch_name}}/{{latest_run_id}}.html{% endcapture %} diff --git a/_includes/playwright-summary.html b/_includes/playwright-summary.html index 3c82183..e26ca7b 100644 --- a/_includes/playwright-summary.html +++ b/_includes/playwright-summary.html @@ -1,7 +1,7 @@ {% if include.data %} - - {% assign results = include.data | normalize_playwright %} + {% assign results = include.data %} + {% assign total = results.stats.expected + results.stats.unexpected + results.stats.skipped + results.stats.flaky %}
@@ -14,13 +14,28 @@ {% endif %} - Run At: {{ results.startTime | date: "%Y-%m-%d %H:%M %Z" }} + Run At: {{ results.stats.startTime | date: "%Y-%m-%d %H:%M %Z" }}
- - {{ results.status | status_icon }} + + {% capture status_icon %} + {% if results.stats.unexpected > 0 %} + + {% else %} + + {% endif %} + {% endcapture %} + {{ status_icon }}
- {% if results.status == "warn" %} + {% if status == "warn" %}
{% for error in results.errors %} @@ -31,11 +46,11 @@ {% else %}
- {% include playwright-stat.html label="All" value=results.total %} - {% include playwright-stat.html label="Passed" value=results.expected %} - {% include playwright-stat.html label="Failed" value=results.unexpected %} - {% include playwright-stat.html label="Flaky" value=results.flaky %} - {% include playwright-stat.html label="Skipped" value=results.skipped %} + {% include playwright-stat.html label="All" value=total %} + {% include playwright-stat.html label="Passed" value=results.stats.expected %} + {% include playwright-stat.html label="Failed" value=results.stats.unexpected %} + {% include playwright-stat.html label="Flaky" value=results.stats.flaky %} + {% include playwright-stat.html label="Skipped" value=results.stats.skipped %}
{% endif %} diff --git a/_layouts/page.html b/_layouts/page.html index 156621f..2486cdc 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -1,6 +1,7 @@ --- layout: default --- +
diff --git a/_layouts/playwright-branch.html b/_layouts/playwright-branch.html index e555cb0..42f1480 100644 --- a/_layouts/playwright-branch.html +++ b/_layouts/playwright-branch.html @@ -2,8 +2,13 @@ layout: page --- - -{% assign run_ids = site.data.playwright-reports.branches[page.branch] | key_list | reverse %} + +{% assign unsorted_runs = "" | split: ',' %} +{% for run_id in site.data.playwright-reports.branches[page.branch] %} + {% assign unsorted_runs = unsorted_runs | push: run_id %} +{% endfor %} + +{% assign run_ids = unsorted_runs | reverse %} {% for run_id in run_ids %} {% assign data = site.data.playwright-reports.branches[page.branch][run_id] %} diff --git a/_layouts/post.html b/_layouts/post.html index 39526d2..946da3d 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,6 +1,7 @@ --- layout: default --- +
diff --git a/_plugins/coverage-results-filter.rb b/_plugins/coverage-results-filter.rb deleted file mode 100644 index 49e02f8..0000000 --- a/_plugins/coverage-results-filter.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Jekyll - module CoverageResultFilter - def coverage_status(input, name) - if input >= @context.registers[:site].data["coverage"]["thresholds"]["pass"][name] - "pass" - elsif input >= @context.registers[:site].data["coverage"]["thresholds"]["fail"][name] - "warn" - else - "fail" - end - end - end -end - -Liquid::Template.register_filter(Jekyll::CoverageResultFilter) diff --git a/_plugins/icon-filter.rb b/_plugins/icon-filter.rb deleted file mode 100644 index 7b8dd51..0000000 --- a/_plugins/icon-filter.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Jekyll - module IconFilter - def status_icon(input) - case input - when "pass" - "" - when "fail" - "" - when "warn" - "" - end - end - end -end - -Liquid::Template.register_filter(Jekyll::IconFilter) diff --git a/_plugins/key-list-filter.rb b/_plugins/key-list-filter.rb deleted file mode 100644 index 743cff9..0000000 --- a/_plugins/key-list-filter.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Jekyll - module KeyFilter - def key_list(input) - return if input.nil? - keys = [] - input.each_key do |key| - keys.push(key) - end - keys - end - end -end - -Liquid::Template.register_filter(Jekyll::KeyFilter) diff --git a/_plugins/playwright-branch-index-generator.rb b/_plugins/playwright-branch-index-generator.rb index 9acffdb..c9658d4 100644 --- a/_plugins/playwright-branch-index-generator.rb +++ b/_plugins/playwright-branch-index-generator.rb @@ -6,9 +6,13 @@ def initialize(site, base, dir, branch) @dir = dir @name = 'index.html' - self.process(@name) - self.read_yaml(File.join(base, '_layouts'), 'playwright-branch.html') - self.data['branch'] = branch + process(@name) + + @data = site.layouts['playwright-branch'].data + @content = site.layouts['playwright-branch'].content + + @data['branch'] = branch + @data['title'] = branch end end diff --git a/_plugins/playwright-results-filter.rb b/_plugins/playwright-results-filter.rb deleted file mode 100644 index 87bd36b..0000000 --- a/_plugins/playwright-results-filter.rb +++ /dev/null @@ -1,36 +0,0 @@ -module Jekyll - module PlaywrightResultFilter - def normalize_playwright(input) - status = playwright_status(input) - total = playwright_total(input) - stats = input["stats"] - stats["errors"] = input["errors"] - stats["total"] = total - stats["status"] = status - stats - end - - def playwright_total(input) - if input["errors"].size > 0 - 0 - else - input["stats"]["expected"] + input["stats"]["unexpected"] + input["stats"]["skipped"] + input["stats"]["flaky"] - end - end - - def playwright_status(input) - if input["stats"]["unexpected"] > 0 - # if the unexpected results is greater than one, return fail - "fail" - elsif input["errors"].size == 0 - # if there are no unexpected results and no errors, return pass - "pass" - else - # otherwise if there are errors, return error - "warn" - end - end - end -end - -Liquid::Template.register_filter(Jekyll::PlaywrightResultFilter) diff --git a/assets/css/styles.css b/assets/css/styles.css index 4e8957a..f3b42b9 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -16,6 +16,10 @@ --color-highlight: var(--color-gray-100); --color-outline: var(--color-gray-300); + --color-pass: var(--color-green-700); + --color-fail: var(--color-red-600); + --color-warn: var(--color-amber-400); + --breakpoint-sm: 40rem; /* 640px */ --breakpoint-md: 48rem; /* 768px */ --breakpoint-lg: 64rem; /* 1024px */ @@ -214,18 +218,6 @@ } } - .pass { - color: var(--color-green-700); - } - - .fail { - color: var(--color-red-600); - } - - .warn { - color: var(--color-amber-400); - } - .gh-markdown-content { width: 100%; overflow-x: auto; diff --git a/playwright-branches.markdown b/playwright-branches.markdown index f91bbd3..fe83e1e 100644 --- a/playwright-branches.markdown +++ b/playwright-branches.markdown @@ -1,4 +1,5 @@ --- +layout: page # the header for the page title: "Playwright Reports for Branches" # the link to page https://jekyllrb.com/docs/permalinks/