-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
multi_domain_error_spec.ts
48 lines (42 loc) · 1.47 KB
/
multi_domain_error_spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import path from 'path'
import systemTests, { expect } from '../lib/system-tests'
import Fixtures from '../lib/fixtures'
const e2ePath = Fixtures.projectPath('e2e')
const PORT = 3500
const onServer = function (app) {
app.get('/multi_domain_secondary.html', (_, res) => {
res.sendFile(path.join(e2ePath, `multi_domain_secondary.html`))
})
}
// TODO: This is probably more appropriate for a cy-in-cy test
// https://github.com/cypress-io/cypress/issues/20973
describe('e2e cy.origin errors', () => {
systemTests.setup({
servers: [{
port: 4466,
onServer,
}],
settings: {
hosts: {
'*.foobar.com': '127.0.0.1',
},
},
})
systemTests.it('captures the stack trace correctly for errors in cross origins to point users to their "cy.origin" callback', {
// keep the port the same to prevent issues with the snapshot
port: PORT,
spec: 'multi_domain_error_spec.ts',
snapshot: true,
expectedExitCode: 1,
config: {
experimentalLoginFlows: true,
},
async onRun (exec) {
const res = await exec()
expect(res.stdout).to.contain('AssertionError')
expect(res.stdout).to.contain('Timed out retrying after 1000ms: Expected to find element: `#doesnotexist`, but never found it.')
// check to make sure the snapshot contains the 'cy.origin' sourcemap
expect(res.stdout).to.contain('http://localhost:3500/__cypress/tests?p=cypress/integration/multi_domain_error_spec.ts:102:12')
},
})
})