Skip to content

Commit 35ae9d4

Browse files
author
Alec Mestroni
committed
adds test to pr cypress-io#685
1 parent 5b07e59 commit 35ae9d4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: support.js

+8
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ const registerHooks = () => {
6666
windowCoverageObjects = []
6767

6868
const saveCoverageObject = (win) => {
69+
// accessing win.__coverage__ will error when testing cross-origin code
70+
// because we don't control cross-origin code anyway, we can safely return
71+
try {
72+
win.__coverage__
73+
} catch {
74+
return
75+
}
76+
6977
// if application code has been instrumented, the app iframe "window" has an object
7078
const applicationSourceCoverage = win?.__coverage__
7179
if (!applicationSourceCoverage) {

Diff for: test-apps/frontend/cypress/e2e/spec.cy.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ context('Page test', () => {
1313
})
1414
})
1515

16-
it('logs names', function() {
16+
it('logs names', function () {
1717
cy.get('@log')
1818
.should('have.been.calledOnce')
1919
.should('have.been.calledWith', 'just names', ['joe', 'mary'])
@@ -37,3 +37,9 @@ context('Unit tests', () => {
3737
})
3838

3939
})
40+
41+
context('Test cross-origin ', () => {
42+
it('Visit not baseUrl page', () => {
43+
cy.visit('https://google.com')
44+
})
45+
})

0 commit comments

Comments
 (0)