-
-
Notifications
You must be signed in to change notification settings - Fork 294
130 lines (96 loc) · 3.36 KB
/
TestFirefox.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Browser 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: macos-latest
timeout-minutes: 15
strategy:
matrix:
browser: ['firefox', 'safari', 'chrome']
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@v2
with:
version: "1.10" # our lowest supported version
arch: x64
- name: Install Pluto.jl packages
run: |
julia --project=$GITHUB_WORKSPACE -e "using Pkg; Pkg.instantiate()"
- id: setup-firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: 'latest-esr'
- id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: 'latest'
- run: |
${{ steps.setup-firefox.outputs.firefox-path }} --version
- run: |
${{ steps.setup-chrome.outputs.chrome-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)
const browser = "${{ matrix.browser }}"
@info "Starting browser..." browser
@assert browser ∈ ["chrome", "firefox", "safari"]
browser_process = @async try
run(
if browser == "chrome"
`${{ steps.setup-chrome.outputs.chrome-path }} --no-first-run $(url)`
elseif browser == "firefox"
`${{ steps.setup-firefox.outputs.firefox-path }} -headless -private-window $(url)`
else
`open -a Safari $(url)`
end
)
catch e
@error "Browser task failed" e
end
tstart = time()
begin
while get_x() == "missing"
@info "Waiting..."
sleep(1)
if time() - tstart > 120
error("This took too long!")
end
end
@info "yay it worked!" get_x()
end'