Repository: mwouts/jupytext (language: python)

Issue:
Add CI workflow to update playwright snapshots automatically
We should look into integrating [this action](https://github.com/jupyterlab/maintainer-tools#update-snapshots) to update playwright snapshots automatically from CI.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/step_build.yml b/.github/workflows/step_build.yml
index f41e2078..cf97ff2d 100644
--- a/.github/workflows/step_build.yml
+++ b/.github/workflows/step_build.yml
@@ -32,7 +32,7 @@ jobs:
         run: HATCH_BUILD_HOOKS_ENABLE=true hatch build
 
       - name: Archive build artifacts
-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
         with:
           name: dist
           path: dist
diff --git a/.github/workflows/step_pre-commit.yml b/.github/workflows/step_pre-commit.yml
index a154d2b8..cc29b2a9 100644
--- a/.github/workflows/step_pre-commit.yml
+++ b/.github/workflows/step_pre-commit.yml
@@ -15,7 +15,7 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Set up Python
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: "3.x"
 
diff --git a/.github/workflows/update-playwright-snapshots.yml b/.github/workflows/update-playwright-snapshots.yml
new file mode 100644
index 00000000..06b2c476
--- /dev/null
+++ b/.github/workflows/update-playwright-snapshots.yml
@@ -0,0 +1,52 @@
+name: Update Playwright Snapshots
+
+on:
+  issue_comment:
+    types: [created, edited]
+
+permissions:
+  contents: write
+  pull-requests: write
+
+jobs:
+  update-snapshots:
+    if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'update playwright snapshots') }}
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: React to the triggering comment
+        run: |
+          hub api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Checkout the branch from the PR that triggered the job
+        run: |
+          # PR branch remote must be checked out using https URL
+          git config --global hub.protocol https
+          hub pr checkout ${{ github.event.issue.number }}
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Install your project
+        run: |
+          # Execute the required installation command
+
+      - name: Update snapshots
+        uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          # Test folder within your repository
+          test_folder: playwright-tests
+
+          # Optional npm scripts (the default values are displayed)
+          # Script to start the server or 'null' if Playwright is taking care of it
+          #   If not `null`, you must provide a `server_url` to listen to.
+          start_server_script: start
+          # Server url to wait for before updating the snapshots
+          #  See specification for https://github.com/iFaxity/wait-on-action `resource`
+          server_url: http-get://localhost:8888
+          update_script: test:update


Test patch:
diff --git a/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/playwright.config.js b/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/playwright.config.js
index 52f61336..f7dd7e35 100644
--- a/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/playwright.config.js
+++ b/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/playwright.config.js
@@ -33,6 +33,6 @@ module.exports = {
   },
   // Switch to 'always' to keep raw assets for all tests
   preserveOutput: 'failures-only', // Breaks HTML report if use.video == 'on'
-  // Try one retry as some tests are flaky
-  // retries: process.env.CI ? 1 : 0,
+  // Try 3 retries as some tests are flaky
+  retries: process.env.CI ? 3 : 0,
 };
diff --git a/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/tests/jupytext-settings.spec.ts b/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/tests/jupytext-settings.spec.ts
index 21d51230..a743617b 100644
--- a/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/tests/jupytext-settings.spec.ts
+++ b/jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/tests/jupytext-settings.spec.ts
@@ -7,9 +7,10 @@ test('Open the settings editor with a Jupytext query', async ({ page }) => {
     });
   });
 
-  expect(
-    await page.locator('.jp-PluginList .jp-FilterBox input').inputValue()
-  ).toEqual('Jupytext');
+  // Seems like this test is very flaky. Moreover it does not add a lot of value
+  // expect(
+  //   await page.locator('.jp-PluginList .jp-FilterBox input').inputValue()
+  // ).toEqual('Jupytext');
 
   await expect(page.locator('.jp-SettingsForm')).toHaveCount(1);