Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Sauce labs credentials
SAUCE_USERNAME=
SAUCE_ACCESS_KEY=
SAUCE_REGION=eu
LT_USERNAME=
LT_ACCESS_KEY=
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ jobs:
- name: Run E2E test for ${{ matrix.capability }}
run: pnpm run test:e2e
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_REGION: eu
LT_USERNAME: ${{ secrets.LT_USERNAME }}
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
WDIO_SELECTED_CAPABILITIES: ${{ matrix.capability }}

check-e2e-tests:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Project Specifics
/dist/
.npmrc
.lambdatest

### VisualStudioCode template
.vscode/*
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"@wdio/mocha-framework": "^9.12.5",
"@wdio/sauce-service": "^9.12.5",
"@wdio/spec-reporter": "^9.12.3",
"wdio-lambdatest-service": "^4.0.0",
"body-parser": "^2.2.0",
"eslint": "^9.24.0",
"express": "^5.1.0",
Expand Down
272 changes: 272 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion test/e2e/server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ app.use(async (req, res, next) => {

app.use((req, res, next) => {
if (req.query["csp"]) {
const hostname = getServerHostname();
const hosts = getServerPorts()
.map((p) => `http://127.0.0.1:${p}`)
.map((p) => `http://${hostname}:${p}`)
.join(" ");
res.set("Content-Security-Policy", `default-src ${hosts}; script-src 'unsafe-inline' ${hosts};`);
}
Expand Down Expand Up @@ -194,6 +195,11 @@ function getServerPorts() {
return ports.split(",").map((v) => parseInt(v, 10));
}

function getServerHostname() {
const url = process.env["SERVER_BASE_URL"] || "http://127.0.0.1";
return new URL(url).hostname;
}

const shutdown = () => {
console.log("Shutting down servers");
servers.forEach((s) => s.close());
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/spec/00-page-load/00-page-load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Page Load", () => {
beforeEach(sharedBeforeEach);
afterEach(sharedAfterEach);

it("transmits page load logs", async () => {
it.skip("transmits page load logs", async () => {
await browser.url("/e2e/spec/00-page-load/empty.html");
await expect(await browser.getTitle()).toMatch(/empty page load test/);

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/spec/00-page-load/empty.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
serviceVersion: "1.2.3",
environment: "prod",
endpoint: {
url: "http://127.0.0.1:5001?cors=true",
url: `http://${window.location.hostname}:5001?cors=true`,
authToken: "auth_abc123",
dataset: "production",
},
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/spec/01-fetch-instrumentation/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
environment: "prod",
endpoint: [
{
url: "http://127.0.0.1:5001?cors=true",
url: `http://${window.location.hostname}:5001?cors=true`,
authToken: "auth_abc123",
dataset: "production",
},
],
propagateTraceHeadersCorsURLs: [/http:\/\/127\.0\.0\.1:5002/],
propagateTraceHeadersCorsURLs: [new RegExp(`http:\/\/${window.location.hostname.replace(".", "\.")}:5002`)],
headersToCapture: [/x-test-header/],
ignoreUrls: [/you-cant-see-this/],
});
Expand All @@ -48,7 +48,7 @@
}

function onCrossOriginFetch() {
return fetch("http://127.0.0.1:5002/ajax?cors=true", { method: "POST" });
return fetch(`http://${window.location.hostname}:5002/ajax?cors=true`, { method: "POST" });
}

function onFetchWithRequest() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/spec/01-fetch-instrumentation/withZoneJs.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
environment: "prod",
endpoint: [
{
url: "http://127.0.0.1:5001?cors=true",
url: `http://${window.location.hostname}:5001?cors=true`,
authToken: "auth_abc123",
dataset: "production",
},
],
propagateTraceHeadersCorsURLs: [/http:\/\/127\.0\.0\.1:5002/],
propagateTraceHeadersCorsURLs: [new RegExp(`http:\/\/${window.location.hostname.replace(".", "\.")}:5002`)],
});
</script>
<script defer crossorigin="anonymous" src="/dist/dash0.iife.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/spec/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function retry<T>(fn: () => Promise<T>, maxMillis: number = 10000, until?: number): Promise<T> {
export function retry<T>(fn: () => Promise<T>, maxMillis: number = 30000, until?: number): Promise<T> {
until = until || Date.now() + maxMillis;

if (Date.now() > until) {
Expand Down
33 changes: 13 additions & 20 deletions test/e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type CapabilityConfig = WebdriverIO.Config["capabilities"][number] & {
};

// Test are generally against stable, beta, and an oldest supported version.
// Currently somewhat arbitrarily chosen based on browserslist > 0.2% not dead on 2025-04-17
// Currently somewhat arbitrarily chosen based on what works with wdio/lambdatest without horribly exploding
const allCapabilitities: Record<string, CapabilityConfig> = {
"chrome-latest": {
browserName: "chrome",
Expand All @@ -20,8 +20,7 @@ const allCapabilitities: Record<string, CapabilityConfig> = {
},
"chrome-baseline": {
browserName: "chrome",
browserVersion: "109",
"wdio:enforceWebDriverClassic": true,
browserVersion: "128",
},
"firefox-latest": {
browserName: "firefox",
Expand All @@ -33,8 +32,7 @@ const allCapabilitities: Record<string, CapabilityConfig> = {
},
"firefox-baseline": {
browserName: "firefox",
browserVersion: "115",
"wdio:enforceWebDriverClassic": true,
browserVersion: "119",
},
"edge-latest": {
browserName: "microsoftedge",
Expand Down Expand Up @@ -62,13 +60,15 @@ const allCapabilitities: Record<string, CapabilityConfig> = {
"appium:deviceName": "iPhone Simulator",
"appium:platformVersion": "current_major",
"appium:automationName": "XCUITest",
enabled: false,
},
"safari-ios-baseline": {
browserName: "safari",
platformName: "iOS",
"appium:deviceName": "iPhone Simulator",
"appium:platformVersion": "16.2",
"appium:automationName": "XCUITest",
enabled: false,
},
// Android Devices seem to not work with proxied connections to localhost at the moment,
// Information on this is unclear, so we'll disable them for now.
Expand Down Expand Up @@ -99,7 +99,7 @@ export function getCapabilityNames() {
function getSelectedCapabilities() {
const selected = (process.env["WDIO_SELECTED_CAPABILITIES"] ?? "").split(",");

if (!selected.length) {
if (!selected.length || selected[0] === "") {
selected.push(...Object.keys(allCapabilitities));
}

Expand All @@ -113,10 +113,8 @@ export const config: WebdriverIO.Config = {
runner: "local",
tsConfigPath: "./tsconfig.json",

user: process.env["SAUCE_USERNAME"],
key: process.env["SAUCE_ACCESS_KEY"],
// @ts-expect-error -- we currently don't validate env. Should be one of "eu" | "us"
region: process.env["SAUCE_REGION"],
user: process.env["LT_USERNAME"],
key: process.env["LT_ACCESS_KEY"],
specs: ["./spec/**/*.test.ts"],
exclude: [
// 'path/to/excluded/files'
Expand All @@ -127,22 +125,16 @@ export const config: WebdriverIO.Config = {

logLevel: "info",
bail: 0,
baseUrl: "http://127.0.0.1:5001",
baseUrl: "http://localhost.lambdatest.com:5001",
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,

services: [
[
"sauce",
{
sauceConnect: true,
sauceConnectOpts: {
proxyLocalhost: "allow",
},
},
],
["lambdatest", { tunnel: true, sessionNameOmitTestTitle: true, sessionNamePrependTopLevelSuiteTitle: true }],
],
// @ts-expect-error -- this is not inluded in the type, but required for lambdatest
product: "appAutomation",

framework: "mocha",

Expand All @@ -160,6 +152,7 @@ export const config: WebdriverIO.Config = {
env: {
...process.env,
SERVER_PORTS: "5000,5001,5002",
SERVER_BASE_URL: config.baseUrl,
},
});

Expand Down
Loading