-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(WEBRTC-366): testing workflow #143
Merged
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e95fcb1
chore: add first e2e test
DeividVeloso 41a743a
add data-testid and fix some duplicates ids on components
DeividVeloso 0c2e884
chore: configure env variables to use inside cypress
DeividVeloso 367b607
chore: add wait-on package and add cypress ci command
DeividVeloso 65c103f
chore: add e2e test for webdialer story and add config to disable mDNβ¦
DeividVeloso 90c081c
chore: add script cypress ci for firefox and chrome
DeividVeloso 6bb4cd8
chore: add edge script to run on ci cypress mode
DeividVeloso 6d2064e
chore: add env.sample file
DeividVeloso f156180
chore: add cypress on github actions
DeividVeloso 72b4c80
chore: testing webrtc workflow
DeividVeloso 0969cbf
chore: testing webrtc workflow
DeividVeloso e8044b9
Merge branch 'main' into WEBRTC-336
DeividVeloso d078d02
update yml webrtc-test-release to run e22 tests
DeividVeloso 19db99a
remove duplicate run build
DeividVeloso 90aac7a
removed yarn.lock to be able to run npm ci on CI/CD
DeividVeloso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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,3 @@ | ||
STORYBOOK_USERNAME= | ||
STORYBOOK_PASSWORD= | ||
STORYBOOK_DESTINATION= |
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
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
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,5 @@ | ||
{ | ||
"viewportWidth": 1400, | ||
"viewportHeight": 1000, | ||
"baseUrl": "http://localhost:6006/" | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/js/examples/react-audio-widgets/cypress/fixtures/example.json
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
28 changes: 28 additions & 0 deletions
28
packages/js/examples/react-audio-widgets/cypress/integration/clickToCall.spec.js
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,28 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
/* eslint-disable no-undef */ | ||
describe('ClickToCall', () => { | ||
beforeEach(() => { | ||
cy.visit('/iframe.html?id=audio--click-to-call'); | ||
cy.window().should('have.property', 'appReady', true); | ||
}); | ||
|
||
it('should make a call and hang up a call', () => { | ||
cy.window() | ||
.its('storyData') | ||
.should((storyData) => { | ||
// the story must expose some variables | ||
expect(storyData).to.not.null; | ||
expect(storyData.username).to.equal(Cypress.env('username')); | ||
expect(storyData.password).to.equal(Cypress.env('password')); | ||
expect(storyData.defaultDestination).to.equal(Cypress.env('destination')); | ||
}) | ||
.then(() => { | ||
// the test code | ||
cy.get('[data-testid=btn-call]').click(); | ||
cy.get('[data-testid=state-call-registering]').should('exist'); | ||
cy.get('[data-testid=state-call-new]').should('exist'); | ||
cy.get('[data-testid=state-call-active]').should('exist'); | ||
cy.get('[data-testid=btn-end-call]').click(); | ||
}); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
packages/js/examples/react-audio-widgets/cypress/integration/webDialer.spec.js
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,33 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
/* eslint-disable no-undef */ | ||
describe('Webialer', () => { | ||
beforeEach(() => { | ||
cy.visit('/iframe.html?id=audio--web-dialer'); | ||
cy.window().should('have.property', 'appReady', true); | ||
}); | ||
|
||
it('should make a call and hang up a call', () => { | ||
cy.window() | ||
.its('storyData') | ||
.should((storyData) => { | ||
// the story must expose some variables | ||
expect(storyData).to.not.null; | ||
expect(storyData.username).to.equal(Cypress.env('username')); | ||
expect(storyData.password).to.equal(Cypress.env('password')); | ||
expect(storyData.defaultDestination).to.equal( | ||
Cypress.env('destination') | ||
); | ||
}) | ||
.then(() => { | ||
// the test code | ||
cy.get('[data-testid=webdialer]').click(); | ||
cy.get('[data-testid=input-destination]').clear(); | ||
cy.get('[data-testid=input-destination]').type(Cypress.env('destination')); | ||
cy.get('[data-testid=btn-call]').click(); | ||
cy.get('[data-testid=state-call-new]').should('exist'); | ||
cy.get('[data-testid=state-call-requesting]').should('exist'); | ||
cy.get('[data-testid=state-call-active]').should('exist'); | ||
cy.get('[data-testid=btn-end-call]').click(); | ||
}); | ||
}); | ||
}); |
73 changes: 73 additions & 0 deletions
73
packages/js/examples/react-audio-widgets/cypress/plugins/index.js
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,73 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
require('dotenv').config(); | ||
|
||
module.exports = (on, config) => { | ||
on('before:browser:launch', (browser, launchOptions) => { | ||
//Using cypress with WebRTC https://github.com/cypress-io/cypress/issues/2704 | ||
if (browser.name === 'chrome' || browser.name === 'edge') { | ||
launchOptions.args.push('--disable-gpu'); | ||
launchOptions.args.push('--no-sandbox'); | ||
launchOptions.args.push('--disable-setuid-sandbox'); | ||
launchOptions.args.push('--disable-dev-shm-usage'); | ||
launchOptions.args.push('--disable-features=VizDisplayCompositor'); | ||
launchOptions.args.push('--use-fake-ui-for-media-stream'); | ||
launchOptions.args.push('--use-fake-device-for-media-stream'); | ||
launchOptions.args.push('--allow-file-access-from-files'); | ||
launchOptions.args.push('--disable-translate'); | ||
//FIXME: added temporarily to fix this error INCOMPATIBLE_DESTINATION | ||
launchOptions.args.push('--disable-features=WebRtcHideLocalIpsWithMdns'); | ||
} | ||
|
||
if (browser.name === 'firefox') { | ||
const firefoxUserPrefs = { | ||
'media.navigator.streams.fake': true, | ||
'media.navigator.permission.disabled': true, | ||
'browser.cache.disk.enable': false, | ||
'browser.cache.disk.capacity': 0, | ||
'browser.cache.disk.smart_size.enabled': false, | ||
'browser.cache.disk.smart_size.first_run': false, | ||
'browser.sessionstore.resume_from_crash': false, | ||
'browser.startup.page': 0, | ||
'device.storage.enabled': false, | ||
'media.gstreamer.enabled': false, | ||
'browser.startup.homepage': 'about:blank', | ||
'browser.startup.firstrunSkipsHomepage': false, | ||
'extensions.update.enabled': false, | ||
'app.update.enabled': false, | ||
'network.http.use-cache': false, | ||
'browser.shell.checkDefaultBrowser': false, | ||
'media.peerconnection.ice.obfuscate_host_addresses': false, //FIXME: added temporarily to fix this error INCOMPATIBLE_DESTINATION | ||
}; | ||
launchOptions.preferences = { | ||
...launchOptions.preferences, | ||
...firefoxUserPrefs, | ||
}; | ||
} | ||
|
||
return launchOptions; | ||
}); | ||
|
||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
config.env.username = process.env.STORYBOOK_USERNAME; | ||
config.env.password = process.env.STORYBOOK_PASSWORD; | ||
config.env.destination = process.env.STORYBOOK_DESTINATION; | ||
|
||
return config; | ||
}; |
26 changes: 26 additions & 0 deletions
26
packages/js/examples/react-audio-widgets/cypress/support/commands.js
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 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) | ||
import '@testing-library/cypress/add-commands'; |
20 changes: 20 additions & 0 deletions
20
packages/js/examples/react-audio-widgets/cypress/support/index.js
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,20 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it could be consolidated with
unit-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep separated, I did 3 steps: