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
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: self-hosted-arc

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
jobs:
publish:
name: Publishing to NPM
runs-on: ubuntu-latest
runs-on: self-hosted-arc
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/standalone-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
integration-test:
runs-on: ubuntu-latest
runs-on: self-hosted-arc
strategy:
matrix:
node-version: [20.18.1]
Expand Down
20 changes: 20 additions & 0 deletions test/integration/standalone/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import _ from "lodash";
import { BrowserName } from "../../../src/browser/types";

export const BROWSER_NAME = (process.env.BROWSER || "chrome").toLowerCase() as keyof typeof BrowserName;

export const BROWSER_CONFIG = {
desiredCapabilities: {
browserName: BROWSER_NAME,
},
headless: true,
system: {
debug: Boolean(process.env.DEBUG) || false,
},
};

if (/chrome/i.test(BROWSER_NAME)) {
_.set(BROWSER_CONFIG.desiredCapabilities, "goog:chromeOptions", {
args: ["--no-sandbox", "--disable-dev-shm-usage"],
});
}
8 changes: 8 additions & 0 deletions test/integration/standalone/preload-browser.fixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { launchBrowser } from "../../../src/browser/standalone";
import { BROWSER_CONFIG } from "./constants";

exports.mochaGlobalSetup = async function (): Promise<void> {
// Here we trigger downloading browsers before running tests
const browser = await launchBrowser(BROWSER_CONFIG);
await browser.deleteSession();
};
23 changes: 2 additions & 21 deletions test/integration/standalone/standalone.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { strict as assert } from "assert";
import _ from "lodash";
import { launchBrowser } from "../../../src/browser/standalone";
import { BrowserName } from "../../../src/browser/types";
import { BROWSER_CONFIG } from "./constants";

describe("Standalone Browser E2E Tests", function () {
this.timeout(25000);
Expand All @@ -16,32 +15,14 @@ describe("Standalone Browser E2E Tests", function () {

let browser: WebdriverIO.Browser;

const browserName = (process.env.BROWSER || "chrome").toLowerCase() as keyof typeof BrowserName;

after(async function () {
if (browser) {
await browser.deleteSession();
}
});

it("should launch browser and access a website", async function () {
const browserConfig = {
desiredCapabilities: {
browserName,
},
headless: true,
system: {
debug: Boolean(process.env.DEBUG) || false,
},
};

if (/chrome/i.test(browserName)) {
_.set(browserConfig.desiredCapabilities, "goog:chromeOptions", {
args: ["--no-sandbox", "--disable-dev-shm-usage"],
});
}

browser = await launchBrowser(browserConfig);
browser = await launchBrowser(BROWSER_CONFIG);

assert.ok(browser, "Browser should be initialized");
assert.ok(browser.sessionId, "Browser should have a valid session ID");
Expand Down