Skip to content

Commit ce1d18e

Browse files
committed
refactor: add browser options to scripts
1 parent 2635314 commit ce1d18e

File tree

15 files changed

+208
-0
lines changed

15 files changed

+208
-0
lines changed

docs/sources/k6/next/javascript-api/jslib/testing/_index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ export default function () {
6363
import { browser } from 'k6/experimental/browser';
6464
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
6565

66+
export const options = {
67+
scenarios: {
68+
ui: {
69+
executor: 'shared-iterations',
70+
options: {
71+
browser: {
72+
type: 'chromium',
73+
},
74+
},
75+
},
76+
}
77+
};
78+
6679
export default async function () {
6780
const page = browser.newPage();
6881

docs/sources/k6/next/javascript-api/jslib/testing/configure.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ export default function () {
145145
import { browser } from 'k6/experimental/browser';
146146
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
147147

148+
export const options = {
149+
scenarios: {
150+
ui: {
151+
executor: 'shared-iterations',
152+
options: {
153+
browser: {
154+
type: 'chromium',
155+
},
156+
},
157+
},
158+
}
159+
};
160+
148161
// Create expect instance configured for browser testing with longer timeouts
149162
const browserExpect = expect.configure({
150163
timeout: 15000, // Longer timeout for browser operations

docs/sources/k6/next/javascript-api/jslib/testing/expect.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ Retrying assertions automatically retry until they pass or timeout. These are pa
5858
import { browser } from 'k6/experimental/browser';
5959
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
6060

61+
export const options = {
62+
scenarios: {
63+
ui: {
64+
executor: 'shared-iterations',
65+
options: {
66+
browser: {
67+
type: 'chromium',
68+
},
69+
},
70+
},
71+
}
72+
};
73+
6174
export default async function () {
6275
const page = browser.newPage();
6376
await page.goto('https://test.k6.io');

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/RetryConfig.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ You can pass a `RetryConfig` object as the last parameter to any retrying assert
4141
import { browser } from 'k6/browser';
4242
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4343

44+
export const options = {
45+
scenarios: {
46+
ui: {
47+
executor: 'shared-iterations',
48+
options: {
49+
browser: {
50+
type: 'chromium',
51+
},
52+
},
53+
},
54+
}
55+
};
56+
4457
export default async function () {
4558
const page = await browser.newPage();
4659
await page.goto('https://quickpizza.grafana.com/');
@@ -69,6 +82,19 @@ You can create a new expect instance with custom default configuration using `ex
6982
import { browser } from 'k6/browser';
7083
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
7184

85+
export const options = {
86+
scenarios: {
87+
ui: {
88+
executor: 'shared-iterations',
89+
options: {
90+
browser: {
91+
type: 'chromium',
92+
},
93+
},
94+
},
95+
}
96+
};
97+
7298
// Create a new expect instance with custom retry configuration
7399
const myExpect = expect.configure({
74100
timeout: 10000, // 10 seconds default timeout

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/_index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ All retrying assertions must be awaited since they return promises:
3737
import { browser } from 'k6/browser';
3838
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
3939

40+
export const options = {
41+
scenarios: {
42+
ui: {
43+
executor: 'shared-iterations',
44+
options: {
45+
browser: {
46+
type: 'chromium',
47+
},
48+
},
49+
},
50+
}
51+
};
52+
4053
export default async function () {
4154
const page = await browser.newPage();
4255
await page.goto('https://quickpizza.grafana.com/');

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/toBeChecked.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ This is a retrying assertion that will automatically re-check the element's stat
4545
import { browser } from 'k6/browser';
4646
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4747

48+
export const options = {
49+
scenarios: {
50+
ui: {
51+
executor: 'shared-iterations',
52+
options: {
53+
browser: {
54+
type: 'chromium',
55+
},
56+
},
57+
},
58+
}
59+
};
60+
4861
export default async function () {
4962
const page = await browser.newPage();
5063

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/toBeDisabled.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ This is a retrying assertion that will automatically re-check the element's disa
4545
import { browser } from 'k6/browser';
4646
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
4747

48+
export const options = {
49+
scenarios: {
50+
ui: {
51+
executor: 'shared-iterations',
52+
options: {
53+
browser: {
54+
type: 'chromium',
55+
},
56+
},
57+
},
58+
}
59+
};
60+
4861
export default async function () {
4962
const page = await browser.newPage();
5063
await page.goto('https://quickpizza.grafana.com/');

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/toBeEditable.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ This is a retrying assertion that will automatically re-check the element's edit
4949
import { browser } from 'k6/browser';
5050
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
5151

52+
export const options = {
53+
scenarios: {
54+
ui: {
55+
executor: 'shared-iterations',
56+
options: {
57+
browser: {
58+
type: 'chromium',
59+
},
60+
},
61+
},
62+
}
63+
};
64+
5265
export default async function () {
5366
const page = await browser.newPage();
5467

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/toBeEnabled.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ This is a retrying assertion that will automatically re-check the element's enab
5050
import { browser } from 'k6/browser';
5151
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
5252

53+
export const options = {
54+
scenarios: {
55+
ui: {
56+
executor: 'shared-iterations',
57+
options: {
58+
browser: {
59+
type: 'chromium',
60+
},
61+
},
62+
},
63+
}
64+
};
65+
5366
export default async function () {
5467
const page = await browser.newPage();
5568
await page.goto('https://quickpizza.grafana.com/');

docs/sources/k6/next/javascript-api/jslib/testing/retrying-assertions/toBeHidden.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ This is a retrying assertion that will automatically re-check the element's visi
5050
import { browser } from 'k6/browser';
5151
import { expect } from 'https://jslib.k6.io/k6-testing/{{< param "JSLIB_TESTING_VERSION" >}}/index.js';
5252

53+
export const options = {
54+
scenarios: {
55+
ui: {
56+
executor: 'shared-iterations',
57+
options: {
58+
browser: {
59+
type: 'chromium',
60+
},
61+
},
62+
},
63+
}
64+
};
65+
5366
export default async function () {
5467
const page = await browser.newPage();
5568
await page.goto('https://quickpizza.grafana.com/');

0 commit comments

Comments
 (0)