Skip to content

Commit

Permalink
Rename the JS fields back to url and name
Browse files Browse the repository at this point in the history
Leaving the names as in the go code.
  • Loading branch information
ankur22 committed Oct 7, 2024
1 parent 94e6971 commit f6dd73c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions common/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ type URLTagPatterns struct {
// if a match is found.
type URLTagPattern struct {
// This is a regex that will be compared against the existing url tag.
URLRegEx string `js:"urlRegEx"`
URLRegEx string `js:"url"`
// The name to send back to the caller of the handler.
TagName string `js:"tagName"`
TagName string `js:"name"`
}

type k6BrowserCheckRegEx func(pattern, url string) (bool, error)
Expand Down
2 changes: 1 addition & 1 deletion examples/pageon-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function() {
page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, tagName:'test'},
{url: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, name:'test'},
]
});
});
Expand Down
16 changes: 8 additions & 8 deletions tests/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ func TestPageOnMetric(t *testing.T) {
fun: `page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-1'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-1'},
]
});
});`,
Expand All @@ -1938,12 +1938,12 @@ func TestPageOnMetric(t *testing.T) {
fun: `page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-1'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-1'},
]
});
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-2'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-2'},
]
});
});`,
Expand All @@ -1955,19 +1955,19 @@ func TestPageOnMetric(t *testing.T) {
fun: `page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-1'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-1'},
]
});
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-2'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-2'},
]
});
});
page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-3'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-3'},
]
});
});`,
Expand All @@ -1979,13 +1979,13 @@ func TestPageOnMetric(t *testing.T) {
fun: `page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-1'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-1'},
]
});
page.on('metric', (metric) => {
metric.Tag({
urls: [
{urlRegEx: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, tagName:'ping-4'},
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, name:'ping-4'},
]
});
});
Expand Down

0 comments on commit f6dd73c

Please sign in to comment.