Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run basic test on firefox #2962

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/FrontendTest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pluto frontend tests
name: Chrome frontend tests

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/TestFirefox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Firefox basic launch test

# same as the frontend tests
on:
push:
paths-ignore:
- "**.md"
branches:
- main
- release
pull_request:
paths-ignore:
- "**.md"
branches-ignore:
- release


jobs:
firefox-test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
firefox: ['latest-esr'] #, 'latest']
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Makes thes `julia` command available
- uses: julia-actions/setup-julia@v1
with:
version: "1.6" # our lowest supported version

- name: Install Pluto.jl packages
run: |
julia --project=$GITHUB_WORKSPACE -e "using Pkg; Pkg.instantiate()"

- name: Setup firefox
id: setup-firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: ${{ matrix.firefox }}

- run: |
echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }}
${{ steps.setup-firefox.outputs.firefox-path }} --version

- run: |
julia --project=$GITHUB_WORKSPACE -e 'import Pluto

nb = Pluto.Notebook([
Pluto.Cell("Text(x)"),
Pluto.Cell("""
@bind x html"\""
<script>
currentScript.value = "hello from " + navigator.userAgent
currentScript.dispatchEvent(new CustomEvent("input"))
</script>
"\""
""")
])

sesh = Pluto.ServerSession()

Pluto.SessionActions.add(sesh, nb)

@info "Running notebook..."
Pluto.update_save_run!(sesh, nb, nb.cells; run_async=false)
@info "Running notebook done"


get_x() = nb.cells[1].output.body

@info "Value before" get_x()

sesh.options.server.port = 1235

url = "http://localhost:$(sesh.options.server.port)/edit?secret=$(sesh.secret)&id=$(nb.notebook_id)"

process = Pluto.run!(sesh)

@info "Server started"
sleep(3)

@info "Starting firefox..."
browser_process = @async run(`${{ steps.setup-firefox.outputs.firefox-path }} -headless -private-window $(url)`)

tstart = time()

begin
while get_x() == "missing"
@info "Waiting..."
sleep(1)
if time() - tstart > 30
error("This took too long!")
end
end

@info "yay it worked!" get_x()
end'



Loading