Skip to content

Commit

Permalink
Merge pull request #533 from bugsnag/https
Browse files Browse the repository at this point in the history
run e2e tests over https
  • Loading branch information
djskinner authored Nov 26, 2024
2 parents 8aa66d1 + 46206c0 commit bfb189a
Show file tree
Hide file tree
Showing 35 changed files with 189 additions and 279 deletions.
1 change: 1 addition & 0 deletions .buildkite/browser-pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ steps:
run: browser-maze-runner-bs
use-aliases: true
command:
- --https
- --farm=bs
- --browser={{ matrix }}
artifacts#v1.5.0:
Expand Down
30 changes: 29 additions & 1 deletion .buildkite/browser-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ steps:
use-aliases: true
service-ports: true
command:
- --https
- --farm=bb
- --browser={{ matrix.browser }}_{{ matrix.version }}
- --appium-version=1.22
Expand Down Expand Up @@ -78,6 +79,7 @@ steps:
run: browser-maze-runner-legacy
use-aliases: true
command:
- --https
- --farm=bs
- --browser={{ matrix.browser }}_{{ matrix.version }}
artifacts#v1.5.0:
Expand All @@ -97,5 +99,31 @@ steps:
adjustments:
- with: { browser: firefox, version: 60 }
- with: { browser: edge, version: 80 }
- with: { browser: safari, version: 11 }
- with: { browser: edge, version: latest }

# BrowserStack non-https
- label: ":browserstack: :{{ matrix.browser }}: {{ matrix.version }} Browser non-https tests${EXTRA_STEP_LABEL}"
depends_on: "browser-maze-runner-legacy-${USE_CDN_BUILD}"
timeout_in_minutes: 30
plugins:
docker-compose#v4.12.0:
pull: browser-maze-runner-legacy
run: browser-maze-runner-legacy
use-aliases: true
command:
- --farm=bs
- --browser={{ matrix.browser }}_{{ matrix.version }}
artifacts#v1.5.0:
upload:
- "./test/browser/maze_output/failed/**/*"
test-collector#v1.10.2:
files: "reports/TEST-*.xml"
format: "junit"
branch: "^main|next$$"
api-token-env-name: "BROWSER_PERFORMANCE_BUILDKITE_ANALYTICS_TOKEN"
concurrency: 2
concurrency_group: "browserstack"
matrix:
setup:
browser: [safari]
version: [11]
128 changes: 0 additions & 128 deletions test/browser/Gemfile.lock

This file was deleted.

8 changes: 4 additions & 4 deletions test/browser/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ brew install chromedriver
To run all the tests, run the following in `test/browser`:

```sh
bundle exec maze-runner --farm=local --browser=chrome
bundle exec maze-runner --https --farm=local --browser=chrome
```

Or to run a single feature file:

```sh
bundle exec maze-runner --farm=local --browser=chrome features/device.feature
bundle exec maze-runner --https --farm=local --browser=chrome features/device.feature
```

## Running the end-to-end tests with BrowserStack
Expand All @@ -34,11 +34,11 @@ The browsers available to test on are the keys in [`browsers.yml`](https://githu
To run all the tests, run the following in `test/browser`:

```sh
bundle exec maze-runner --farm=bs --browser=chrome_latest
bundle exec maze-runner --https --farm=bs --browser=chrome_latest
```

Or to run a single feature file:

```sh
bundle exec maze-runner --farm=bs --browser=chrome_latest features/manual-spans.feature
bundle exec maze-runner --https --farm=bs --browser=chrome_latest features/manual-spans.feature
```
4 changes: 2 additions & 2 deletions test/browser/features/angular.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Feature: Angular

Scenario: Angular route change spans are automatically instrumented
Given I navigate to the test URL "/angular/dist"
Given I navigate to the test URL "/docs/angular/dist"
And the element "customers" is present
And I click the element "customers"
When I wait to receive 1 trace
Expand All @@ -25,7 +25,7 @@ Feature: Angular
| bugsnag.browser.page.route_change.trigger | stringValue | imperative |

Scenario: Route with a custom URL matcher
Given I navigate to the test URL "/angular/dist"
Given I navigate to the test URL "/docs/angular/dist"
And the element "customMatching" is present
And I click the element "customMatching"
When I wait to receive 1 trace
Expand Down
2 changes: 1 addition & 1 deletion test/browser/features/custom-attributes.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Custom attributes

Scenario: Custom attributes can be added to spans
Given I navigate to the test URL "/custom-attributes"
Given I navigate to the test URL "/docs/custom-attributes"
And I wait for 1 span

Then a span named "Custom/CustomAttributesScenario" contains the attributes:
Expand Down
4 changes: 2 additions & 2 deletions test/browser/features/device-id.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Feature: Device ID persistence

Scenario: persisted device ID is used if present
# load the page and persist an ID
Given I navigate to the test URL "/retry-scenario"
Given I navigate to the test URL "/docs/retry-scenario"
And I wait to receive a sampling request
And I store the device ID "c1234567890abcdefghijklmnop"

# reload the page to prove the ID was persisted and not just available in
# memory somehow
When I navigate to the test URL "/retry-scenario"
When I navigate to the test URL "/docs/retry-scenario"
And I wait to receive a sampling request
And I click the element "send-first-span"
And I wait for 1 span
Expand Down
4 changes: 2 additions & 2 deletions test/browser/features/enabled-release-stages.feature
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Feature: Configuration

Scenario: Delivery is prevented when releaseStage is not in enabledReleaseStages
Given I navigate to the test URL "/enabled-release-stages-disabled"
Given I navigate to the test URL "/docs/enabled-release-stages-disabled"
Then I should receive no traces

Scenario: Delivery is allowed when releaseStage is present in enabledReleaseStages
Given I navigate to the test URL "/enabled-release-stages"
Given I navigate to the test URL "/docs/enabled-release-stages"
And I wait to receive at least 1 trace
Then the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.name" equals "Custom/Should send"
And the trace payload field "resourceSpans.0.resource" string attribute "deployment.environment" equals "test"
6 changes: 3 additions & 3 deletions test/browser/features/error-correlation.feature
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Feature: Error Correlation

Scenario: Error does not include the correlation property when no spans are open
Given I navigate to the test URL "/error-correlation"
Given I navigate to the test URL "/docs/error-correlation"
And I wait to receive a sampling request
And I click the element "send-error"
And I wait to receive an error
Then the error is a valid browser payload for the error reporting API
And the error payload field "events.0.correlation" is null

Scenario: Reported errors include the current trace and span id
Given I navigate to the test URL "/error-correlation"
Given I navigate to the test URL "/docs/error-correlation"
And I wait to receive a sampling request
Then I click the element "start-span"
And I wait for 1 second
Expand All @@ -33,7 +33,7 @@ Feature: Error Correlation
And the error payload field "events.0.correlation.traceId" equals the stored value "traceId"

Scenario: Reported errors do not include the trace and span id if the span is not the current context
Given I navigate to the test URL "/error-correlation"
Given I navigate to the test URL "/docs/error-correlation"
And I wait to receive a sampling request
Then I click the element "start-span"
And I wait for 1 second
Expand Down
2 changes: 1 addition & 1 deletion test/browser/features/fixed-sampling-probability.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Fixed Sampling Probability

Scenario: Uses configured sampling probability
Given I navigate to the test URL "/fixed-sampling-probability"
Given I navigate to the test URL "/docs/fixed-sampling-probability"
And I enter unmanaged traces mode
When I click the element "send-span"
And I wait to receive 1 trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="utf-8">
<link href="/favicon.png" rel="shortcut icon" type="image/x-icon">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" rel="icon" type="image/x-icon">
<title>Angular</title>
<base href="/angular/dist/">
<base href="/docs/angular/dist/">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<link href="/favicon.png" rel="shortcut icon" type="image/x-icon">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" rel="icon" type="image/x-icon">
<title>React router
</title>
<script src="./dist/bundle.js" type="module"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const parameters = new URLSearchParams(window.location.search)
const apiKey = parameters.get('api_key')
const endpoint = parameters.get('endpoint')

const basename = '/react-router'
const basename = '/docs/react-router'

function Root() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html>
<head>
<meta charset="utf-8" />
<!-- disable caching to ensure image resoure has consistent body size -->
<!-- disable caching to ensure image resource has consistent body size -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<!-- use base64 encoded favicon to present resource load -->
<!-- use base64 encoded favicon to prevent resource load -->
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" rel="icon" type="image/x-icon">
<title>Resource load spans</title>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ document.getElementById("end-span").addEventListener("click", () => {
const node = document.getElementById("image-container")
const img = new Image()
node.appendChild(img)
img.src = "/favicon.png?height=100&width=100"
img.src = "/docs/favicon.png?height=100&width=100"
img.onload = () => {
span.end()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<link href="/favicon.png" rel="shortcut icon" type="image/x-icon">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" rel="icon" type="image/x-icon">
<title>Route change spans</title>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Navigation() {
<div>
<nav>
<li>
<Link to="/route-change-spans">Home</Link>
<Link to="/docs/route-change-spans">Home</Link>
</li>
<li>
<Link to="/new-route" id="change-route">Change Route</Link>
Expand All @@ -27,7 +27,7 @@ function App() {
<Router>
<Navigation />
<Switch>
<Route path="/route-change-spans">
<Route path="/docs/route-change-spans">
<Home />
</Route>
<Route path="/new-route">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" rel="icon" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue router</title>
</head>
Expand Down
Loading

0 comments on commit bfb189a

Please sign in to comment.