Skip to content

Commit 2a0957f

Browse files
Add pixel threshold to UI tests
1 parent 193ad80 commit 2a0957f

File tree

7 files changed

+4
-3
lines changed

7 files changed

+4
-3
lines changed

.github/workflows/ui_notebooks_test.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ jobs:
8686
jq -r 'del(.cells[] | select(.source[] | contains("Create authentication object for user permissions")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb
8787
jq -r 'del(.cells[] | select(.source[] | contains("auth.logout()")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb
8888
# Set explicit namespace as SDK need it (currently) to resolve local queues
89-
sed -i "s|head_memory_limits=2,|head_memory_limits=2, namespace='default',|" 3_widget_example.ipynb
89+
kubectl create namespace "ui-test-namespace"
90+
sed -i "s|head_memory_limits=2,|head_memory_limits=2, namespace='ui-test-namespace',|" 3_widget_example.ipynb
9091
sed -i "s|view_clusters()|view_clusters('default')|" 3_widget_example.ipynb
9192
working-directory: demo-notebooks/guided-demos
9293

ui-tests/tests/widget_notebook_example.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.describe("Visual Regression", () => {
3030
tmpPath,
3131
}) => {
3232
const notebook = "3_widget_example.ipynb";
33-
const namespace = 'default';
33+
const namespace = 'ui-test-namespace';
3434
await page.notebook.openByPath(`${tmpPath}/${notebook}`);
3535
await page.notebook.activate(notebook);
3636

@@ -60,7 +60,7 @@ test.describe("Visual Regression", () => {
6060
const image = `widgets-cell-${i}.png`;
6161

6262
if (captures[i]) {
63-
expect.soft(captures[i]).toMatchSnapshot(image); // Compare pre-existing capture
63+
expect.soft(captures[i]).toMatchSnapshot(image, { threshold: 0.7}); // Compare pre-existing capture
6464
continue;
6565
}
6666
}
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)