Skip to content

Commit 8819707

Browse files
authored
ci: use self-hosted runners in CI (#79)
* ci: use self-hosted runners in CI * chore: fix formatting
1 parent eb24967 commit 8819707

14 files changed

+51
-46
lines changed

.github/workflows/checks.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ on:
99
pull_request:
1010
branches: [master]
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
build:
14-
runs-on: ubuntu-latest
18+
runs-on: self-hosted-arc
1519

1620
strategy:
1721
matrix:
@@ -29,7 +33,7 @@ jobs:
2933
- run: npm test
3034

3135
deploy-static:
32-
runs-on: ubuntu-latest
36+
runs-on: self-hosted-arc
3337
environment: CI
3438

3539
strategy:

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616
jobs:
1717
# Build job
1818
build:
19-
runs-on: ubuntu-latest
19+
runs-on: self-hosted-arc
2020
steps:
2121
- uses: actions/checkout@v4
2222
- uses: actions/setup-node@v4
@@ -40,7 +40,7 @@ jobs:
4040
environment:
4141
name: github-pages
4242
url: ${{ steps.deployment.outputs.page_url }}
43-
runs-on: ubuntu-latest
43+
runs-on: self-hosted-arc
4444
needs: build
4545
steps:
4646
- name: Deploy to GitHub Pages

docs/guides/how-to-check-accessibility.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To obtain such a tree, _puppeteer_ has a special [Accessibility class][puppeteer
2020
Here's an example of how to use it:
2121

2222
```javascript
23-
it("should get accessibility tree of yandex.ru", async function ({browser}) {
23+
it("should get accessibility tree of yandex.ru", async function ({ browser }) {
2424
// Get puppeteer instance
2525
const puppeteer = await browser.getPuppeteer();
2626

docs/guides/how-to-hide-scrollbars-by-cdp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CDP has a special method [Emulation.setScrollbarsHidden][set-scrollbars-hidden]
2020
Here's how it looks:
2121

2222
```javascript
23-
it("should hide scrollbar", async function ({browser}) {
23+
it("should hide scrollbar", async function ({ browser }) {
2424
// Get puppeteer instance
2525
const puppeteer = await browser.getPuppeteer();
2626

docs/guides/how-to-intercept-requests-and-responses.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Let's try writing tests using this API and cover different cases. To clarify, al
3030
## Example 1: Mocking a Request to google.com and Returning Our Own Response {#example_1}
3131

3232
```javascript
33-
it("should mock google.com", async function ({browser}) {
33+
it("should mock google.com", async function ({ browser }) {
3434
// Mocking the request to google.com
3535
const mock = await browser.mock("https://google.com");
3636

@@ -46,7 +46,7 @@ it("should mock google.com", async function ({browser}) {
4646
From the graphical representation, you can see that we returned our text, although the browser's address bar shows we navigated to _google.com._ Also, it's clear that we didn't mock the favicon, which was fetched from an external source. We can write this same example using the puppeteer API. For this, _webdriverio_ has the [getPuppeteer()][get-puppeteer] command:
4747

4848
```javascript
49-
it("should mock google.com using puppeteer api", async function ({browser}) {
49+
it("should mock google.com using puppeteer api", async function ({ browser }) {
5050
// Get puppeteer instance
5151
const puppeteer = await browser.getPuppeteer();
5252

@@ -78,7 +78,7 @@ it("should mock google.com using puppeteer api", async function ({browser}) {
7878
Now, let's imagine that puppeteer doesn't yet have an API for mocking requests, but this is already implemented in the [Fetch][fetch] domain of CDP. In this case, we will use this domain's method by interacting with the CDP session directly. For this, puppeteer has the [CDPSession.send()][cdp-session-send] method:
7979

8080
```javascript
81-
it("should mock google.com using cdp fetch domain", async function ({browser}) {
81+
it("should mock google.com using cdp fetch domain", async function ({ browser }) {
8282
// Get puppeteer instance
8383
const puppeteer = await browser.getPuppeteer();
8484

@@ -122,7 +122,7 @@ Obviously, when using the _webdriverio_ API for mocking requests, the code is mu
122122
## Example 2: Canceling the Request for Google's Logo {#example_2}
123123

124124
```javascript
125-
it("should abort request to logo on google.com", async function ({browser}) {
125+
it("should abort request to logo on google.com", async function ({ browser }) {
126126
// You can use a mask for the URL
127127
const mock = await browser.mock("https://www.google.com/images/**/*.png");
128128

@@ -138,7 +138,7 @@ From the graphical representation, it is clear that the logo is not displayed, a
138138
## Example 3: Loading google.com Using a Fixture for the Response {#example_3}
139139

140140
```javascript
141-
it("should mock google.com and return answer from fixture", async function ({browser}) {
141+
it("should mock google.com and return answer from fixture", async function ({ browser }) {
142142
// Mocking the request to google.com
143143
const mock = await browser.mock("https://google.com");
144144

@@ -155,7 +155,7 @@ From the graphical representation, it is clear that instead of google.com's cont
155155
## Example 4: Redirecting the Request from google.com to yandex.ru {#example_4}
156156

157157
```javascript
158-
it("should redirect from google.com to yandex.ru", async function ({browser}) {
158+
it("should redirect from google.com to yandex.ru", async function ({ browser }) {
159159
// Mocking the request to google.com
160160
const mock = await browser.mock("https://google.com");
161161

@@ -173,7 +173,7 @@ Puppeteer still does not have an API for conveniently modifying responses. There
173173
Replace all occurrences of the string `Google` with `Yandex` in google.com's response:
174174

175175
```javascript
176-
it("should modify response from google.com", async function ({browser}) {
176+
it("should modify response from google.com", async function ({ browser }) {
177177
// Here, you need to mock with www because navigating to google.com
178178
// returns a 301 response without a body and redirects to www
179179
const mock = await browser.mock("https://www.google.com");
@@ -190,7 +190,7 @@ it("should modify response from google.com", async function ({browser}) {
190190
Additionally, we can modify responses from unknown sources in advance. For example, let's modify all scripts loaded on _google.com:_
191191

192192
```javascript
193-
it("should modify response from google.com", async function ({browser}) {
193+
it("should modify response from google.com", async function ({ browser }) {
194194
// The first argument specifies that we will intercept all requests
195195
const mock = await browser.mock("**", {
196196
headers: headers => {
@@ -217,7 +217,7 @@ it("should modify response from google.com", async function ({browser}) {
217217
Let's say we need to collect a list of all URLs loaded on the page. Using this information, we could determine if we have requests for external resources or neighboring services that we do not control. This means they could fail at any time and break our tests. Here's what our code might look like:
218218

219219
```javascript
220-
it("should mock yandex.ru and log all loaded urls", async function ({browser}) {
220+
it("should mock yandex.ru and log all loaded urls", async function ({ browser }) {
221221
// Intercept absolutely all requests
222222
const mock = await browser.mock("**");
223223

@@ -235,7 +235,7 @@ it("should mock yandex.ru and log all loaded urls", async function ({browser}) {
235235
Most likely, your tests are more complex than these examples and involve various clicks on elements that open in new tabs. In such cases, the previous code will not capture the opening of new tabs or that URLs need to be collected there as well. Therefore, in such cases, you need to use puppeteer's API:
236236

237237
```javascript
238-
it("should mock yandex.ru and log all loaded urls (using puppeteer)", async function ({browser}) {
238+
it("should mock yandex.ru and log all loaded urls (using puppeteer)", async function ({ browser }) {
239239
// Accumulative list of all URLs
240240
const urls = [];
241241

@@ -298,7 +298,7 @@ module.exports = {
298298
"testplane-global-hook": {
299299
enabled: true,
300300

301-
beforeEach: async function ({browser}) {
301+
beforeEach: async function ({ browser }) {
302302
// Check that the browser name starts with "chrome"
303303
if (!/^chrome$/i.test(browser.capabilities.browserName)) {
304304
return;
@@ -309,7 +309,7 @@ module.exports = {
309309
mock.respond("hello world", { fetchResponse: false });
310310
},
311311

312-
afterEach: function ({browser}) {
312+
afterEach: function ({ browser }) {
313313
// Clear all mocks in the current session
314314
browser.mockRestoreAll();
315315
},
@@ -327,7 +327,7 @@ The test code will now only contain the URL transition:
327327
```javascript
328328
// Explicitly indicate that the test is only executed in browsers whose name starts with chrome
329329
testplane.only.in(/^chrome/);
330-
it("should mock google.com inside global before each", async function ({browser}) {
330+
it("should mock google.com inside global before each", async function ({ browser }) {
331331
await browser.url("https://google.com");
332332
});
333333
```

docs/guides/how-to-manage-cpu-performance.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The CPU speed on mobile devices is significantly slower than on computers. There
1818
Let's use this method to slow down CPU speed by 8 times:
1919

2020
```javascript
21-
it("should open yandex.ru with emulation 8x slower CPU", async function ({browser}) {
21+
it("should open yandex.ru with emulation 8x slower CPU", async function ({ browser }) {
2222
// Get puppeteer instance
2323
const puppeteer = await browser.getPuppeteer();
2424

@@ -39,7 +39,7 @@ Initially, _webdriverio_ did not support the `page.emulateCPUThrottling` method
3939
However, this limitation could be bypassed using puppeteer's [CDPSession.send()][cdp-session-send] method by sending the browser the [Emulation.setCPUThrottlingRate][emulation-set-cpu-throttling-rate] command via CDP:
4040

4141
```javascript
42-
it("should open yandex.ru with emulation 8x slower CPU", async function ({browser}) {
42+
it("should open yandex.ru with emulation 8x slower CPU", async function ({ browser }) {
4343
// Get puppeteer instance
4444
const puppeteer = await browser.getPuppeteer();
4545

docs/guides/how-to-manage-network-bandwidth.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Besides custom settings, the [throttle][throttle] method supports the following
2828
Let's emulate a 2G connection and open yandex.ru in Chrome with phone emulation:
2929

3030
```javascript
31-
it("should open yandex.ru with emulation of 2G-connection", async function ({browser}) {
31+
it("should open yandex.ru with emulation of 2G-connection", async function ({ browser }) {
3232
// Emulate a 2G connection
3333
await browser.throttle("Good2G");
3434

@@ -41,7 +41,7 @@ it("should open yandex.ru with emulation of 2G-connection", async function ({bro
4141
We can also emulate a connection with specific characteristics:
4242

4343
```javascript
44-
it("should open yandex.ru with emulation of custom connection", async function ({browser}) {
44+
it("should open yandex.ru with emulation of custom connection", async function ({ browser }) {
4545
// Emulate a network connection with specified characteristics
4646
await browser.throttle({
4747
offline: false, // emulate offline state

docs/plugins/testplane-global-hook.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Add the plugin to the `plugins` section of the `testplane` config:
3030
module.exports = {
3131
plugins: {
3232
"testplane-global-hook": {
33-
beforeEach: async function ({browser}) {
33+
beforeEach: async function ({ browser }) {
3434
await browser.deleteCookie(); // Say, we want to always clear cookies before running a test
3535
},
36-
afterEach: async function ({browser}) {
36+
afterEach: async function ({ browser }) {
3737
await browser.execute(function () {
3838
try {
3939
localStorage.clear(); // And always clean up the localStorage after the test is completed

i18n/ru/docusaurus-plugin-content-docs/current/guides/how-to-check-accessibility.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Admonition from "@theme/Admonition";
2020
Вот пример, как его можно использовать:
2121

2222
```javascript
23-
it("should get accessibility tree of yandex.ru", async function ({browser}) {
23+
it("should get accessibility tree of yandex.ru", async function ({ browser }) {
2424
// Получаем инстанс puppeteer'а
2525
const puppeteer = await browser.getPuppeteer();
2626

i18n/ru/docusaurus-plugin-content-docs/current/guides/how-to-hide-scrollbars-by-cdp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Admonition from "@theme/Admonition";
2020
Вот как это будет выглядеть:
2121

2222
```javascript
23-
it("should hide scrollbar", async function ({browser}) {
23+
it("should hide scrollbar", async function ({ browser }) {
2424
// Получаем инстанс puppeteer'а
2525
const puppeteer = await browser.getPuppeteer();
2626

0 commit comments

Comments
 (0)