diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml index 0ed24b2db..ed7c6681f 100644 --- a/.github/workflows/browserstack.yml +++ b/.github/workflows/browserstack.yml @@ -34,6 +34,8 @@ jobs: - name: "Running test on BrowserStack" # Invokes the actual test script that would run on BrowserStack browsers run: npm run e2e:bstack # See sample test script above + env: + BYPASS_WAF: ${{ secrets.BYPASS_WAF }} - name: "BrowserStackLocal Stop" # Terminating the BrowserStackLocal tunnel connection uses: browserstack/github-actions/setup-local@master diff --git a/e2e/datachannel/serialization.js b/e2e/datachannel/serialization.js index 3231d6a1d..2d5c56e64 100644 --- a/e2e/datachannel/serialization.js +++ b/e2e/datachannel/serialization.js @@ -32,7 +32,11 @@ const serialization = params.get("serialization"); const result = document.getElementById("result"); const errorMessage = document.getElementById("error-message"); - const peer = new Peer({ debug: 3, serializers }); + const peer = new Peer({ + debug: 3, + serializers, + key: params.get("key"), + }); const received = []; /** * @type {import("../../lib/exports.js").DataConnection} diff --git a/e2e/datachannel/serialization.page.ts b/e2e/datachannel/serialization.page.ts index 1f253b932..2411b705f 100644 --- a/e2e/datachannel/serialization.page.ts +++ b/e2e/datachannel/serialization.page.ts @@ -1,4 +1,7 @@ import { browser, $ } from "@wdio/globals"; + +const { BYPASS_WAF } = process.env; + class SerializationPage { get sendBtn() { return $("button[id='send-btn']"); @@ -40,13 +43,13 @@ class SerializationPage { async open(testFile: string, serialization: string) { await browser.switchWindow("Alice"); await browser.url( - `/e2e/datachannel/serialization.html?testfile=${testFile}&serialization=${serialization}#Alice`, + `/e2e/datachannel/serialization.html?testfile=${testFile}&serialization=${serialization}&key=${BYPASS_WAF}#Alice`, ); await this.connectBtn.waitForEnabled(); await browser.switchWindow("Bob"); await browser.url( - `/e2e/datachannel/serialization.html?testfile=${testFile}#Bob`, + `/e2e/datachannel/serialization.html?testfile=${testFile}&key=${BYPASS_WAF}#Bob`, ); await this.connectBtn.waitForEnabled(); } diff --git a/e2e/mediachannel/close.js b/e2e/mediachannel/close.js index 8568028ac..7492fb707 100644 --- a/e2e/mediachannel/close.js +++ b/e2e/mediachannel/close.js @@ -3,6 +3,8 @@ */ const Peer = window.peerjs.Peer; +const params = new URLSearchParams(document.location.search); + document.getElementsByTagName("title")[0].innerText = window.location.hash.substring(1); @@ -14,7 +16,7 @@ const messages = document.getElementById("messages"); const errorMessage = document.getElementById("error-message"); const stream = window["sender-stream"].captureStream(30); -const peer = new Peer({ debug: 3 }); +const peer = new Peer({ debug: 3, key: params.get("key") }); /** * @type {import("peerjs").MediaConnection} */ diff --git a/e2e/mediachannel/close.page.ts b/e2e/mediachannel/close.page.ts index 30412ae15..1ade1672c 100644 --- a/e2e/mediachannel/close.page.ts +++ b/e2e/mediachannel/close.page.ts @@ -1,4 +1,7 @@ import { browser, $ } from "@wdio/globals"; + +const { BYPASS_WAF } = process.env; + class SerializationPage { get receiverId() { return $("input[id='receiver-id']"); @@ -35,11 +38,11 @@ class SerializationPage { async open() { await browser.switchWindow("Alice"); - await browser.url(`/e2e/mediachannel/close.html#Alice`); + await browser.url(`/e2e/mediachannel/close.html?key=${BYPASS_WAF}#Alice`); await this.callBtn.waitForEnabled(); await browser.switchWindow("Bob"); - await browser.url(`/e2e/mediachannel/close.html#Bob`); + await browser.url(`/e2e/mediachannel/close.html?key=${BYPASS_WAF}#Bob`); await this.callBtn.waitForEnabled(); } async init() { diff --git a/e2e/peer/disconnected.html b/e2e/peer/disconnected.html index 14b9c36ae..574d8d21c 100644 --- a/e2e/peer/disconnected.html +++ b/e2e/peer/disconnected.html @@ -17,9 +17,11 @@

ID-TAKEN

*/ const Peer = window.peerjs.Peer; + const params = new URLSearchParams(document.location.search); + const messages = document.getElementById("messages"); - const peer = new Peer(); + const peer = new Peer({ key: params.get("key")}); peer .once( "error", diff --git a/e2e/peer/id-taken.html b/e2e/peer/id-taken.html index 411ac53fb..31240a2e9 100644 --- a/e2e/peer/id-taken.html +++ b/e2e/peer/id-taken.html @@ -17,11 +17,13 @@

ID-TAKEN

*/ const Peer = window.peerjs.Peer; + const params = new URLSearchParams(document.location.search); + const messages = document.getElementById("messages"); const errorMessage = document.getElementById("error-message"); // Peer A should be created without an error - const peerA = new Peer() + const peerA = new Peer({ key: params.get("key")}) .once( "error", (err) => (errorMessage.textContent += JSON.stringify(err)), @@ -32,7 +34,7 @@

ID-TAKEN

{ length: 10 }, (_, i) => new Promise((resolve, reject) => - new Peer(id) + new Peer(id, { key: params.get("BYPASS_WAF") }) .once("open", () => reject(`Peer ${i} failed! Connection got established.`), ) diff --git a/e2e/peer/peer.page.ts b/e2e/peer/peer.page.ts index 6874458cd..d0e4fad25 100644 --- a/e2e/peer/peer.page.ts +++ b/e2e/peer/peer.page.ts @@ -1,4 +1,7 @@ import { browser, $ } from "@wdio/globals"; + +const { BYPASS_WAF } = process.env; + class PeerPage { get messages() { return $("div[id='messages']"); @@ -19,7 +22,7 @@ class PeerPage { } async open(test: string) { - await browser.url(`/e2e/peer/${test}.html`); + await browser.url(`/e2e/peer/${test}.html?key=${BYPASS_WAF}`); } }