@@ -45,12 +45,116 @@ jobs:
45
45
run : |
46
46
pre-commit run --all-files --show-diff-on-failure
47
47
48
+ e2e :
49
+ name : 🧪 E2E tests
50
+ needs : build
51
+ runs-on : ubuntu-latest
52
+ strategy :
53
+ matrix :
54
+ python : ["3.7", "3.12"]
55
+ steps :
56
+ - name : " ⬇ Checkout OctoPrint with E2E tests"
57
+ uses : actions/checkout@v4
58
+ with :
59
+ repository : OctoPrint/OctoPrint
60
+ path : OctoPrint
61
+
62
+ - name : ⬇ Download build result
63
+ uses : actions/download-artifact@v4
64
+ with :
65
+ name : dist
66
+ path : dist
67
+
68
+ - name : 🏗 Set up Python ${{ matrix.python }}
69
+ uses : actions/setup-python@v5
70
+ with :
71
+ python-version : ${{ matrix.python }}
72
+
73
+ - name : 🏗 Install OctoPrint
74
+ run : |
75
+ pip install dist/*.whl
76
+
77
+ cd OctoPrint
78
+ pip install .
79
+
80
+ - name : 🏗 Create base config for test server
81
+ run : |
82
+ mkdir e2econfig
83
+ cp -r OctoPrint/.github/fixtures/with_acl/* e2econfig
84
+
85
+ - name : 🏗 Install dummy mfa plugin
86
+ run : |
87
+ mkdir -p e2econfig/plugins
88
+ cp -r .github/fixtures/mfa_dummy e2econfig/plugins/mfa_dummy
89
+
90
+ - name : 🏗 Prepare Playwright env
91
+ working-directory : ./OctoPrint/tests/playwright
92
+ run : |
93
+ npm ci
94
+ PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version')
95
+ echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
96
+
97
+ - name : 🧰 Cache Playwright browser binaries
98
+ uses : actions/cache@v4
99
+ id : playwright-cache
100
+ with :
101
+ path : " ~/.cache/ms-playwright"
102
+ key : " ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}"
103
+ restore-keys : |
104
+ ${{ runner.os }}-playwright-
105
+
106
+ - name : 🏗 Install Playwright browser binaries & OS dependencies
107
+ if : steps.playwright-cache.outputs.cache-hit != 'true'
108
+ working-directory : ./OctoPrint/tests/playwright
109
+ run : |
110
+ sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
111
+ npx playwright install --with-deps
112
+
113
+ - name : 🏗 Install Playwright OS dependencies
114
+ if : steps.playwright-cache.outputs.cache-hit == 'true'
115
+ working-directory : ./OctoPrint/tests/playwright
116
+ run : |
117
+ sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
118
+ npx playwright install-deps
119
+
120
+ - name : 🎭 Run Playwright
121
+ working-directory : ./OctoPrint/tests/playwright
122
+ run : |
123
+ npx playwright test
124
+ env :
125
+ OCTOPRINT_SERVER_BASE : ${{ github.workspace }}/e2econfig
126
+ TEST_MFA : true
127
+
128
+ - name : 🔎 Check octoprint.log for errors
129
+ run : |
130
+ log=${{ github.workspace }}/e2econfig/logs/octoprint.log
131
+ if grep "\- ERROR \-" $log; then
132
+ echo "::error::Errors were logged to octoprint.log"
133
+ grep -Pazo '(?m)^\N+\- ERROR \-\N*\n(^\N*?\n)*?(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \- )' $log
134
+ exit 1
135
+ fi
136
+
137
+ - name : ⬆ Upload Playwright report
138
+ uses : actions/upload-artifact@v4
139
+ if : always()
140
+ with :
141
+ name : playwright-report-py${{ matrix.python }}
142
+ path : tests/playwright/playwright-report
143
+
144
+ - name : ⬆ Upload OctoPrint logs
145
+ uses : actions/upload-artifact@v4
146
+ if : failure()
147
+ with :
148
+ name : octoprint-logs-py${{ matrix.python }}
149
+ path : ${{ github.workspace }}/e2econfig/logs
150
+
48
151
publish-on-testpypi :
49
152
name : 📦 Publish on TestPyPI
50
153
if : github.event_name == 'release'
51
154
needs :
52
155
- build
53
156
- pre-commit
157
+ - e2e
54
158
runs-on : ubuntu-latest
55
159
steps :
56
160
- name : ⬇ Download build result
0 commit comments