Skip to content

Commit 8a76f81

Browse files
authored
Merge pull request #59 from Webperf-se/7h3Rabbit-patch-1
GitHub Actions - Make it possible to run test against url
2 parents f0947c8 + 2901b6d commit 8a76f81

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/workflows/manual-start.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Manual - Run test against url"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
url:
6+
description: 'Webpage url to test'
7+
required: true
8+
default: 'https://webperf.se/'
9+
type: string
10+
env:
11+
TEST_TAG: webperfse/webperf-core:test
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20.x'
21+
- name: Install latest Chrome
22+
run: |
23+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
24+
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
25+
sudo apt-get update
26+
sudo apt-get --only-upgrade install google-chrome-stable
27+
google-chrome --version
28+
- name: Browser versions
29+
run: |
30+
google-chrome --version
31+
- name: Install sitespeed.io
32+
run: |
33+
npm install sitespeed.io -g
34+
cd ../plugin-accessibility-statement
35+
npm install
36+
- name: Start local HTTP server
37+
run: (npm run start-server&)
38+
- name: Lint
39+
run: npm run lint
40+
- name: Show sitespeed.io version
41+
run: sitespeed.io --version
42+
- name: Run tests using plugin
43+
run: sitespeed.io --plugins.add ./lib/index.js --browsertime.chrome.includeResponseBodies all --xvfb -n 1 --javascript.terminal.showresults true ${{ github.event.inputs.url }}

lib/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
2222
const libFolder = fileURLToPath(new URL('..', import.meta.url));
2323
this.pluginFolder = path.resolve(libFolder);
2424
this.options = options;
25+
this.log = context.log;
2526

2627
this.pug = await fsp.readFile(
2728
path.resolve(this.pluginFolder, 'pug', 'index.pug'),
@@ -111,6 +112,10 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
111112
super.sendMessage(pluginname + '.summary', summary.groups[group], {
112113
group
113114
});
115+
116+
if (this.options.javascript && this.options.javascript.terminal && this.options.javascript.terminal.showresults) {
117+
this.log.info('plugin-javascript', group, JSON.stringify(summary.groups[group], false, ' '));
118+
}
114119
}
115120
break;
116121
}
@@ -119,4 +124,4 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
119124
// close(options, errors) {
120125
// // Cleanup if necessary
121126
// }
122-
}
127+
}

0 commit comments

Comments
 (0)