From 21d390ec6cf65800615cfcdf773a5bbc477ff8fc Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Thu, 13 Feb 2025 18:26:44 -0500 Subject: [PATCH] Improve JS Test Docs for macOS and Fix Flaky Test (#320) * Add note for Rosetta needed * Fix img is not defined --- CONTRIBUTING.rst | 4 ++++ nbclassic/tests/notebook/attachments.js | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 28be6f62f..e43d4899d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -195,6 +195,10 @@ or to run just ``nbclassic/tests/notebook/deletecell.js``:: python -m nbclassic.jstest notebook/deletecell.js +.. note:: + If you are getting spawn errors with an ARM Mac on macOS, make sure you + have Rosetta installed. + Building the Documentation -------------------------- diff --git a/nbclassic/tests/notebook/attachments.js b/nbclassic/tests/notebook/attachments.js index ce332a655..69a37ef50 100644 --- a/nbclassic/tests/notebook/attachments.js +++ b/nbclassic/tests/notebook/attachments.js @@ -42,6 +42,15 @@ casper.notebook_test(function () { // Validate and render the markdown cell this.thenClick('#btn_ok'); + + // Wait for cell content to update before rendering + this.waitFor(function() { + return this.evaluate(function() { + var cell = Jupyter.notebook.get_cell(0); + return cell.get_text().indexOf('![') >= 0; + }); + }); + this.thenEvaluate(function() { Jupyter.notebook.get_cell(0).render(); });