Files
electerm--electerm/test/e2e/009.basic.themes.spec.js
T
2026-07-13 12:46:20 +08:00

56 lines
1.9 KiB
JavaScript

const { _electron: electron } = require('@playwright/test')
const {
test: it
} = require('@playwright/test')
const { describe } = it
it.setTimeout(100000)
const delay = require('./common/wait')
const log = require('./common/log')
const { expect } = require('./common/expect')
const appOptions = require('./common/app-options')
const e = require('./common/lang')
const extendClient = require('./common/client-extend')
describe('terminal themes', function () {
it('all buttons open proper terminal themes tab', async function () {
const electronApp = await electron.launch(appOptions)
const client = await electronApp.firstWindow()
extendClient(client, electronApp)
await delay(3500)
log('button:edit')
await client.click('.btns .anticon-picture')
await delay(500)
const sel = '.setting-wrap .ant-tabs-nav-list .ant-tabs-tab-active'
await client.hasElem(sel)
await delay(500)
const text = await client.getText(sel)
expect(text).equal(e('uiThemes'))
const v = await client.getValue('.setting-wrap #terminal-theme-form_themeName')
const tx = await client.getText('.setting-wrap .item-list-unit.active')
const txd = await client.getText('.setting-wrap .item-list-unit.current')
expect(v).equal(e('newTheme'))
expect(tx).equal(e('newTheme'))
expect(txd).equal(e('default'))
// create theme
log('create theme')
const themePrev = await client.evaluate(() => {
return window.store.terminalThemes.length
})
const themeIterm = await client.evaluate(() => {
return window.store.itermThemes.length
})
await client.click('.setting-wrap .ant-btn-primary')
const themeNow = await client.evaluate(() => {
return window.store.terminalThemes.length
})
await delay(1000)
expect(themeNow).equal(themePrev + 1)
expect(themeIterm > 10).equal(true)
await electronApp.close().catch(console.log)
})
})