-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added simulcast scenario with required steps and functions
- Loading branch information
1 parent
5c47928
commit 78363b4
Showing
7 changed files
with
100 additions
and
21 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/millicast-sdk/integration-tests/features/simulcast.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Feature: Simulcast Feature | ||
@only | ||
Scenario: Viewer selects each layer and verifies video resolution | ||
Given the "publisher1" opens "Publisher" app | ||
When the "publisher1" starts the stream with the specified options | ||
| codec | h264 | | ||
| simulcast | true | | ||
And the "publisher1" stream should be LIVE | ||
|
||
When the "viewer1" opens "Viewer" app | ||
Then the "viewer1" connected stream should be LIVE | ||
When the "viewer1" disconnects from the published stream | ||
Then the "viewer1" connected stream should be NOT LIVE | ||
And the "viewer1" connects to the published stream with the specified options | ||
| events | layers,active | | ||
Then the "viewer1" connected stream should be LIVE | ||
|
||
When the "viewer1" selects simulcast layer with encodingId "0" | ||
Then the "viewer1" should receive video with resolution "320"x"180" | ||
|
||
When the "viewer1" selects simulcast layer with encodingId "1" | ||
Then the "viewer1" should receive video with resolution "640"x"360" | ||
|
||
When the "viewer1" selects simulcast layer with encodingId "2" | ||
Then the "viewer1" should receive video with resolution "1280"x"720" |
12 changes: 12 additions & 0 deletions
12
packages/millicast-sdk/integration-tests/src/steps/viewerSelect.step.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { When } from "@cucumber/cucumber"; | ||
import { ScenarioWorld } from "cucumber-playwright-framework"; | ||
import { | ||
viewerSelectLayer, | ||
} from "../stepsImpl/viewerSelect.step.impl"; | ||
|
||
When( | ||
/^the "([^"]*)" selects simulcast layer with encodingId "([^"]*)"$/, | ||
async function (this: ScenarioWorld, actor: string, encodingId: string) { | ||
await viewerSelectLayer(this, actor, encodingId); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/millicast-sdk/integration-tests/src/stepsImpl/viewerSelect.step.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ScenarioWorld, logger, runStep } from "cucumber-playwright-framework"; | ||
|
||
|
||
export async function viewerSelectLayer( | ||
scenarioWorld: ScenarioWorld, | ||
actor: string, | ||
encodingId: string, | ||
) { | ||
logger.debug(`viewerSelectLayer function was called`); | ||
|
||
await runStep([ | ||
`the ${actor} switch to the "Viewer" app`, | ||
`the ${actor} executes the "window.millicastView.select({encodingId:"${encodingId}"})" JavaScript function on the page`, | ||
], scenarioWorld); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 6 additions & 15 deletions
21
packages/millicast-sdk/integration-tests/src/support-utils/generic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
packages/millicast-sdk/integration-tests/src/support-utils/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
export function parseData(data: Record<string, any>) { | ||
const optionsDict: Record<string, any> = {}; | ||
//convert strings into boolean if true/false encountered | ||
//convert string,string into array | ||
Object.entries(data).forEach(([key, value]) => { | ||
if (value.toLowerCase() === "true" || value.toLowerCase() === "false") { | ||
if (value === "true" || value === "false") { | ||
const myBool: boolean = value === "true"; | ||
optionsDict[key] = myBool; | ||
} else { | ||
} | ||
else if (isNumeric(value)) { | ||
optionsDict[key] = Number(value); | ||
} | ||
else if (value.split(",").length > 1) { | ||
optionsDict[key] = value.split(","); | ||
} | ||
else { | ||
optionsDict[key] = value; | ||
} | ||
}); | ||
|
||
return optionsDict; | ||
} | ||
|
||
function isNumeric(str: string) { | ||
const regex = /^\d+$/; | ||
return regex.test(str); | ||
} |