fix server test, now server overrides defaultProxy to self
This commit is contained in:
parent
c9db2f1a6b
commit
edc5fe106d
2 changed files with 18 additions and 7 deletions
|
|
@ -52,15 +52,14 @@ it('Loads & renders singleplayer', () => {
|
|||
testWorldLoad()
|
||||
})
|
||||
|
||||
it('Joins to server', {
|
||||
retries: 3
|
||||
}, () => {
|
||||
it.only('Joins to server', () => {
|
||||
// visit('/?version=1.16.1')
|
||||
window.localStorage.version = ''
|
||||
visit()
|
||||
// todo replace with data-test
|
||||
cy.get('[data-test-id="connect-screen-button"]', { includeShadowDom: true }).click()
|
||||
cy.get('input#serverip', { includeShadowDom: true }).clear().focus().type('localhost')
|
||||
cy.get('input#botversion', { includeShadowDom: true }).clear().focus().type('1.16.1') // todo needs to fix autoversion
|
||||
cy.get('[data-test-id="connect-to-server"]', { includeShadowDom: true }).click()
|
||||
testWorldLoad()
|
||||
})
|
||||
|
|
|
|||
20
server.js
20
server.js
|
|
@ -14,14 +14,26 @@ const app = express()
|
|||
const isProd = process.argv.includes('--prod')
|
||||
app.use(compression())
|
||||
app.use(netApi({ allowOrigin: '*' }))
|
||||
let lastVersion = ''
|
||||
app.post('/lastVersion', (req, res) => {
|
||||
res.send(lastVersion.toString())
|
||||
})
|
||||
if (!isProd) {
|
||||
app.use('/blocksStates', express.static(path.join(__dirname, './prismarine-viewer/public/blocksStates')))
|
||||
app.use('/textures', express.static(path.join(__dirname, './prismarine-viewer/public/textures')))
|
||||
}
|
||||
// patch config
|
||||
app.get('/config.json', (req, res, next) => {
|
||||
// read original file config
|
||||
let config = {}
|
||||
try {
|
||||
config = require('./config.json')
|
||||
} catch {
|
||||
try {
|
||||
config = require('./dist/config.json')
|
||||
} catch { }
|
||||
}
|
||||
res.json({
|
||||
...config,
|
||||
'defaultProxy': '', // use current url (this server)
|
||||
})
|
||||
})
|
||||
app.use(express.static(path.join(__dirname, './dist')))
|
||||
|
||||
const portArg = process.argv.indexOf('--port')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue