Skip to content

Commit e62118b

Browse files
committed
Add simple playwrite test harness
1 parent c844cce commit e62118b

11 files changed

Lines changed: 268 additions & 585 deletions

File tree

‎.github/workflows/playwright.yml‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Playwright Tests
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "30 02 * * *"
6+
pull_request:
7+
branches: [ main ]
8+
paths:
9+
- 'tests/**'
10+
- '.github/workflows/playwright.yml'
11+
- 'assets/js/**'
12+
jobs:
13+
test:
14+
timeout-minutes: 60
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Download prod build
19+
uses: dawidd6/action-download-artifact@master
20+
with:
21+
workflow: build.yaml
22+
branch: main
23+
name: github-pages
24+
path: _site
25+
- name: Extract prod
26+
run: |
27+
cd $GITHUB_WORKSPACE/_site
28+
tar -xf artifact.tar && rm artifact.tar
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: lts/*
32+
- name: Install dependencies
33+
run: npm ci
34+
- name: Install Playwright Browsers
35+
run: npx playwright install chromium --with-deps --only-shell
36+
- name: Run Playwright tests
37+
run: npx playwright test
38+
- uses: actions/upload-artifact@v4
39+
if: ${{ !cancelled() }}
40+
with:
41+
name: playwright-report
42+
path: playwright-report/
43+
retention-days: 30

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ _site
2121
.Rhistory
2222
*.swp
2323
obu/
24+
25+
# Playwright
26+
/test-results/
27+
/playwright-report/
28+
/blob-report/
29+
/playwright/.cache/
30+
/playwright/.auth/

‎CONTRIBUTING.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ bundle install
3838
bundle exec jekyll serve -tI
3939
```
4040

41-
Note that you can add the `--config _config.yml,_quick_build.yml` build flag to `jekyll serve` for a faster, but partial build of the site.
42-
4341
For more information on the build options, see [the Jekyll docs](https://jekyllrb.com/docs/usage/) and for the production build script, see [build.yaml](https://github.com/buddhist-uni/buddhist-uni.github.io/blob/main/.github/workflows/build.yaml).
4442

4543
### The Source Code

‎_config.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ exclude:
8686
- obu/
8787
- exports/
8888
- scripts/
89+
- tests/
90+
- playwright.config.ts
8991
- .github/
9092
- .obsidian/
9193
- assets/js/tests/

‎_layouts/author.html‎

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,73 @@ <h1 class="post-title">{{ page.title | escape }}</h1>
1212

1313
<div class="post-content">
1414
<div class="description">{{ content }}</div>
15-
{% unless site.partial_build %}
16-
<div class="content">
17-
{% capture filter %}c.authors contains '{{ page.slug }}'{% endcapture %}
18-
{% assign contents = site.content | where_exp: "c", filter %}
19-
{% capture filter %}c.translator contains " and {{page.slug}}" or c.translator contains "{{page.slug}} and " or c.translator == "{{page.slug}}"{% endcapture %}
20-
{% assign transcont = site.content | where_exp: "c", filter | where_exp: "c", "c.status != 'rejected'" | sort: "slug" %}
21-
{% capture filter %}c.editor contains " and {{page.slug}}" or c.editor contains "{{page.slug}} and " or c.editor == "{{page.slug}}"{% endcapture %}
22-
{% assign editcont = site.content | where_exp: "c", filter %}
23-
{% assign readcont = site.content | where: "reader", page.slug %}
15+
16+
<div class="content">
17+
{% capture filter %}c.authors contains '{{ page.slug }}'{% endcapture %}
18+
{% assign contents = site.content | where_exp: "c", filter %}
19+
{% capture filter %}c.translator contains " and {{page.slug}}" or c.translator contains "{{page.slug}} and " or c.translator == "{{page.slug}}"{% endcapture %}
20+
{% assign transcont = site.content | where_exp: "c", filter | where_exp: "c", "c.status != 'rejected'" | sort: "slug" %}
21+
{% capture filter %}c.editor contains " and {{page.slug}}" or c.editor contains "{{page.slug}} and " or c.editor == "{{page.slug}}"{% endcapture %}
22+
{% assign editcont = site.content | where_exp: "c", filter %}
23+
{% assign readcont = site.content | where: "reader", page.slug %}
2424

25-
{%- assign contents = contents | concat: editcont | concat: readcont | where_exp: "c", "c.status != 'rejected'" -%}
26-
{%- assign editcont = editcont | map: "url" -%}
27-
{%- assign c_by_year = contents | group_by: "year" | sort: "name" -%}
28-
{%- if contents.size > 0 -%}
29-
<h2>Selected Works by year</h2>
30-
<div>
31-
<p>
32-
{%- for year in c_by_year -%}
33-
<a href="#{{year.name}}">{{ year.name }}</a>
34-
{% unless forloop.last %}
35-
36-
{% endunless %}
37-
{%- endfor -%}
38-
{%- if transcont.size > 0 -%}
39-
40-
<a href="#translations">Translations</a>
41-
{%- endif -%}
42-
</p>
25+
{%- assign contents = contents | concat: editcont | concat: readcont | where_exp: "c", "c.status != 'rejected'" -%}
26+
{%- assign editcont = editcont | map: "url" -%}
27+
{%- assign c_by_year = contents | group_by: "year" | sort: "name" -%}
28+
{%- if contents.size > 0 -%}
29+
<h2>Selected Works by year</h2>
30+
<div>
31+
<p>
4332
{%- for year in c_by_year -%}
44-
<h3 id="{{year.name}}">{{ year.name }}</h3>
45-
{%- assign year_items = year.items | sort: 'title' -%}
46-
<div class="minimal_content_list">
47-
{% for c in year_items %}
48-
<div class="mb-3 inline_content">
49-
{% case c.stars %}
50-
{% when 5 %}
51-
<i class="fas fa-medal"></i>
52-
{% when 4 %}
53-
<i class="fas fa-star"></i>
54-
{% endcase %}
55-
{%- include_cached content_icon.html category=c.category subcat=c.subcat -%}
56-
<a href="{{c.url}}">{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
57-
{%- if editcont contains c.url -%}(edited){%- endif -%}
58-
</div>
59-
{% endfor %}
60-
</div>
33+
<a href="#{{year.name}}">{{ year.name }}</a>
34+
{% unless forloop.last %}
35+
36+
{% endunless %}
6137
{%- endfor -%}
62-
</div>
63-
{%- endif -%}
64-
{% if transcont.size > 0 %}
65-
<h3 id="translations">Translations by {{ page.title }}:</h3>
66-
<div class="minimal_content_list">
67-
{% for c in transcont %}
68-
<div class="mb-3 inline_content">
69-
{% case c.stars %}
70-
{% when 5 %}
71-
<i class="fas fa-medal"></i>
72-
{% when 4 %}
73-
<i class="fas fa-star"></i>
74-
{% endcase %}
75-
{%- include_cached content_icon.html category=c.category subcat=c.subcat -%}
76-
<a href="{{c.url}}">{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
77-
</div>
78-
{% endfor %}
79-
</div>
80-
{% endif %}
81-
</div>
82-
{% endunless %}
38+
{%- if transcont.size > 0 -%}
39+
40+
<a href="#translations">Translations</a>
41+
{%- endif -%}
42+
</p>
43+
{%- for year in c_by_year -%}
44+
<h3 id="{{year.name}}">{{ year.name }}</h3>
45+
{%- assign year_items = year.items | sort: 'title' -%}
46+
<div class="minimal_content_list">
47+
{% for c in year_items %}
48+
<div class="mb-3 inline_content">
49+
{% case c.stars %}
50+
{% when 5 %}
51+
<i class="fas fa-medal"></i>
52+
{% when 4 %}
53+
<i class="fas fa-star"></i>
54+
{% endcase %}
55+
{%- include_cached content_icon.html category=c.category subcat=c.subcat -%}
56+
<a href="{{c.url}}">{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
57+
{%- if editcont contains c.url -%}(edited){%- endif -%}
58+
</div>
59+
{% endfor %}
60+
</div>
61+
{%- endfor -%}
62+
</div>
63+
{%- endif -%}
64+
{% if transcont.size > 0 %}
65+
<h3 id="translations">Translations by {{ page.title }}:</h3>
66+
<div class="minimal_content_list">
67+
{% for c in transcont %}
68+
<div class="mb-3 inline_content">
69+
{% case c.stars %}
70+
{% when 5 %}
71+
<i class="fas fa-medal"></i>
72+
{% when 4 %}
73+
<i class="fas fa-star"></i>
74+
{% endcase %}
75+
{%- include_cached content_icon.html category=c.category subcat=c.subcat -%}
76+
<a href="{{c.url}}">{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
77+
</div>
78+
{% endfor %}
79+
</div>
80+
{% endif %}
81+
</div>
8382
</div>
8483

8584
</article>

0 commit comments

Comments
 (0)