Files
cypress/system-tests/test/user_agent_spec.js
T
Jessica Sachs a045e4f59a chore: move server e2e tests to system-tests (#16354)
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Zach Bloomquist <github@chary.us>
2021-10-18 19:53:14 +00:00

34 lines
683 B
JavaScript

const systemTests = require('../lib/system-tests').default
const onServer = function (app) {
app.get('/agent', (req, res) => {
const agent = req.headers['user-agent']
return res.send(`<html><span id='agent'>${agent}</span></html>`)
})
return app.put('/agent', (req, res) => {
return res.json({
userAgent: req.headers['user-agent'],
})
})
}
describe('e2e user agent', () => {
systemTests.setup({
servers: {
port: 4545,
onServer,
},
settings: {
userAgent: 'foo bar baz agent',
baseUrl: 'http://localhost:4545',
},
})
systemTests.it('passes', {
spec: 'user_agent_spec.js',
snapshot: true,
})
})