Skip to content

Add Puppeteer end-to-end tests#487

Open
Nandos0804 wants to merge 28 commits intocsound:developfrom
Nandos0804:puppeteer
Open

Add Puppeteer end-to-end tests#487
Nandos0804 wants to merge 28 commits intocsound:developfrom
Nandos0804:puppeteer

Conversation

@Nandos0804
Copy link
Copy Markdown
Contributor

Description

Introduce end-to-end tests using Puppeteer to enhance testing coverage for the application.

This includes configurations, test scripts, and utility functions to facilitate browser interactions and assertions.

The setup supports multiple environments and integrates with the existing CI/CD workflow.

@Nandos0804 Nandos0804 marked this pull request as draft April 18, 2026 13:09
@Nandos0804 Nandos0804 marked this pull request as ready for review April 18, 2026 13:27
@Nandos0804 Nandos0804 marked this pull request as draft April 18, 2026 13:32
@hlolli
Copy link
Copy Markdown
Member

hlolli commented Apr 18, 2026

off the bat without deep review, I recommend using nodejs24 (or later), nodejs20 will be deprecated soon afaict

@Nandos0804
Copy link
Copy Markdown
Contributor Author

Nandos0804 commented Apr 18, 2026

off the bat without deep review, I recommend using nodejs24 (or later), nodejs20 will be deprecated soon afaict

@hlolli do you think we are going to merge this? i was just archiving my progress so far. There is interest for this? Either way, updated node to newer version.

uncovered question:

  • should action be disposable manually?
  • url support from action dispatch?
  • specific test target?

@Nandos0804 Nandos0804 marked this pull request as ready for review April 18, 2026 13:51
Comment thread puppeteer-tests/eslint.config.js Outdated
Comment thread puppeteer-tests/tests/editor.js Outdated
let browser, page;

before(async () => {
browser = await launchBrowser();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a shared global setup that launches one browser once, for speed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm always in favor of speed. But, if you agree, i would like to avoid a one browser fit all. While opening and closing browser is an expensive task it cleans cache. I also don't like parallelism on test. If we should simulate real user, i don't expect them to have multiple live session running in the backgroud and 2 or 4 pages or even browser instance with web-ide opened doing different jobs.

I think that 1 browser per file (where file are a group of test) and on page context per test is a good compromise.

But i'm happy to rework if needed or if my vision is unrealistic.

Comment thread puppeteer-tests/tests/home.js Outdated
let browser, page;

before(async () => {
browser = await launchBrowser();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a shared global setup that launches one browser once, for speed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as editor. Another point is: what if we need a subset of all test, maybe we want to test mobile, or safari, or another browser launch with different args?

Otherwise, i'm ok with adding a pre-test step where we launch a global browser.

Comment thread puppeteer-tests/utils/config.js Outdated
Comment thread puppeteer-tests/utils/browser.js Outdated
Comment thread puppeteer-tests/utils/browser.js Outdated
Comment thread puppeteer-tests/tests/editor.js
Comment thread puppeteer-tests/package.json Outdated
Comment thread puppeteer-tests/package.json Outdated
Comment thread .github/workflows/puppeteer-tests.yml Outdated
@hlolli
Copy link
Copy Markdown
Member

hlolli commented Apr 18, 2026

@Nandos0804

do you think we are going to merge this?  There is interest for this? yes and yes

should action be disposable manually? yes, that way we can run it on any branch.

url support from action dispatch? I don't know, maybe overkill for now. Optional I'd say.

specific test target? If you have tests ready on public project, we could hardcode them somehow later. We don't need to over-engineer these tests. They'll be most useful for catching blunders in the most common user stories.

@Nandos0804 Nandos0804 marked this pull request as draft April 18, 2026 14:31
Giuseppe Ernandez added 16 commits April 18, 2026 16:31
- Switch gotoProject from networkidle2 to domcontentloaded for local
  target — Vite's on-demand module transforms cause unpredictable
  network activity that can stall or race with the idle heuristic
- Add preliminary #root children check in waitForEditor to surface
  React bootstrap failures early instead of a generic 60s timeout
- Add debug helpers (screenshot, browser logs, page HTML) that dump
  on failure for CI visibility
- Upload puppeteer-tests/screenshots/ as GitHub Actions artifact on
  test failure
@Nandos0804 Nandos0804 marked this pull request as ready for review April 18, 2026 21:26
@Nandos0804
Copy link
Copy Markdown
Contributor Author

Nandos0804 commented Apr 18, 2026

should action be disposable manually? yes, that way we can run it on any branch.

I think we can only trigger action that are already on develop branch

If you have tests ready on public project

Target url are stored on config.js

const TARGETS = {
    local: {
        baseUrl: "http://localhost:3000",
        projectUrl: "http://localhost:3000/editor/ElPGLLOOc5qWNM4VmfVV"
    },
    dev: {
        baseUrl: "https://csound-ide-dev.web.app",
        projectUrl: "https://csound-ide-dev.web.app/editor/ElPGLLOOc5qWNM4VmfVV"
    },
    prod: {
        baseUrl: "https://ide.csound.com",
        projectUrl: "https://ide.csound.com/editor/oRl3K1TaYnICnAxv7bUg"
    }
};

there is a problem that when opening a develop url like https://csound-ide-dev.web.app/editor/ElPGLLOOc5qWNM4VmfVV i get

Error: Forbidden
Your client does not have permission to get URL /editor/ElPGLLOOc5qWNM4VmfVV from this server.

nit: for the author of the project, if i'm using your test and you want the test to be removed i will do it asap. Thank you in advance and sorry if i did not sent an email. I was opening random project and looking at good candidates.

@Nandos0804
Copy link
Copy Markdown
Contributor Author

Nandos0804 commented Apr 18, 2026

@hlolli on failed test we upload artifacts (for now screnshoot, in the future maybe traces or similar, maybe a video recording of the sesion) https://github.com/csound/web-ide/actions/runs/24613771266/job/71972560249. Does this cost money? I'm not sure if github charges for storage. Safe to remove in that case. If this has no cost, than i would suggest to keep it. It helped me a lot during this debug session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants