various bugfixes
This commit is contained in:
@ -37,15 +37,44 @@ app.on('browser-window-created', (_event, window) => {
|
||||
assert.equal(state.restartHidden, true)
|
||||
assert.match(state.label, /automatic updates are disabled/)
|
||||
assert.equal(app.getPath('userData'), join(profile, 'capsule-local'))
|
||||
const chrome = await window.webContents.executeJavaScript(`(() => {
|
||||
const cols = document.querySelector('.capsule-footer-cols').getBoundingClientRect()
|
||||
const theme = document.querySelector('.capsule-footer-theme').getBoundingClientRect()
|
||||
const logo = document.getElementById('header-logo')
|
||||
return {
|
||||
site: document.getElementById('login-site').value,
|
||||
tokenSite: document.getElementById('token-site').value,
|
||||
logo: logo.src,
|
||||
contactBlank: getComputedStyle(document.getElementById('footer-contact-col')).visibility === 'hidden',
|
||||
themeCentered: Math.abs((theme.left + theme.right) / 2 - (cols.left + cols.right) / 2) < 2
|
||||
}
|
||||
})()`)
|
||||
assert.equal(chrome.site, chrome.tokenSite)
|
||||
assert.ok(chrome.site.startsWith('http'))
|
||||
assert.equal(chrome.logo, chrome.site + '/images/logoWhite.png')
|
||||
assert.equal(chrome.contactBlank, true)
|
||||
assert.equal(chrome.themeCentered, true)
|
||||
const image = await window.webContents.capturePage()
|
||||
writeFileSync(join(__dirname, '../dist/local/smoke.png'), image.toPNG())
|
||||
window.webContents.send('capsule:updates:changed', {
|
||||
status: 'available', currentVersion: app.getVersion(), version: '0.1.3', percent: 0
|
||||
})
|
||||
const offer = await window.webContents.executeJavaScript(`new Promise(resolve => setTimeout(() => {
|
||||
const panel = document.getElementById('capsule-updates')
|
||||
resolve({ blue: panel.classList.contains('is-update'),
|
||||
download: !document.getElementById('update-download').hidden,
|
||||
install: !document.getElementById('update-install').hidden })
|
||||
}, 100))`)
|
||||
assert.deepEqual(offer, { blue: true, download: true, install: false })
|
||||
writeFileSync(join(__dirname, '../dist/local/smoke-available.png'), (await window.webContents.capturePage()).toPNG())
|
||||
// Exercise the ready prompt with synthetic state; never invoke installation.
|
||||
window.webContents.send('capsule:updates:changed', {
|
||||
status: 'ready', currentVersion: app.getVersion(), version: '0.1.1', percent: 100
|
||||
})
|
||||
const readyVisible = await window.webContents.executeJavaScript(`new Promise(resolve => setTimeout(() => {
|
||||
const button = document.getElementById('update-install')
|
||||
resolve(!button.hidden && document.getElementById('update-status').textContent.includes('Save your work'))
|
||||
resolve(!button.hidden && document.getElementById('update-status').textContent.includes('Save your work') &&
|
||||
document.getElementById('capsule-updates').classList.contains('is-update') && document.getElementById('update-download').hidden)
|
||||
}, 100))`)
|
||||
assert.equal(readyVisible, true)
|
||||
writeFileSync(join(__dirname, '../dist/local/smoke-ready.png'), (await window.webContents.capturePage()).toPNG())
|
||||
|
||||
Reference in New Issue
Block a user