mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
development - screenshotter - capture en locale and build gif from only en
This commit is contained in:
parent
fcdfd48057
commit
0d27d27efa
@ -36,8 +36,6 @@ async function captureAllScreens() {
|
|||||||
await driver.switchTo().window(tabs[0])
|
await driver.switchTo().window(tabs[0])
|
||||||
await delay(300)
|
await delay(300)
|
||||||
|
|
||||||
await captureScreenShot('start-old')
|
|
||||||
|
|
||||||
// click try new ui
|
// click try new ui
|
||||||
await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-row.flex-center.flex-grow > p')).click()
|
await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-row.flex-center.flex-grow > p')).click()
|
||||||
await delay(300)
|
await delay(300)
|
||||||
@ -105,7 +103,7 @@ async function captureAllScreens() {
|
|||||||
// finish up
|
// finish up
|
||||||
console.log('building gif...')
|
console.log('building gif...')
|
||||||
await generateGif()
|
await generateGif()
|
||||||
// await driver.quit()
|
await driver.quit()
|
||||||
return
|
return
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -147,12 +145,15 @@ async function captureAllScreens() {
|
|||||||
|
|
||||||
async function captureLanguageScreenShots(label) {
|
async function captureLanguageScreenShots(label) {
|
||||||
const nonEnglishLocales = localesIndex.filter(localeMeta => localeMeta.code !== 'en')
|
const nonEnglishLocales = localesIndex.filter(localeMeta => localeMeta.code !== 'en')
|
||||||
|
// take english shot
|
||||||
|
await captureScreenShot(`${label} (en)`)
|
||||||
for (let localeMeta of nonEnglishLocales) {
|
for (let localeMeta of nonEnglishLocales) {
|
||||||
// set locale
|
// set locale and take shot
|
||||||
await setLocale(localeMeta.code)
|
await setLocale(localeMeta.code)
|
||||||
await delay(300)
|
await delay(300)
|
||||||
await captureScreenShot(`${label} (${localeMeta.code})`)
|
await captureScreenShot(`${label} (${localeMeta.code})`)
|
||||||
}
|
}
|
||||||
|
// return locale to english
|
||||||
await setLocale('en')
|
await setLocale('en')
|
||||||
await delay(300)
|
await delay(300)
|
||||||
}
|
}
|
||||||
@ -184,11 +185,11 @@ async function captureAllScreens() {
|
|||||||
const pngBuffer = Buffer.from(screenshot, 'base64')
|
const pngBuffer = Buffer.from(screenshot, 'base64')
|
||||||
const size = sizeOfPng.calculate(pngBuffer)
|
const size = sizeOfPng.calculate(pngBuffer)
|
||||||
|
|
||||||
// read all pngs into gif
|
// read only the english pngs into gif
|
||||||
const encoder = new GIFEncoder(size.width, size.height)
|
const encoder = new GIFEncoder(size.width, size.height)
|
||||||
const stream = pngFileStream('./test-artifacts/screens/*.png')
|
const stream = pngFileStream('./test-artifacts/screens/* (en).png')
|
||||||
.pipe(encoder.createWriteStream({ repeat: -1, delay: 1000, quality: 10 }))
|
.pipe(encoder.createWriteStream({ repeat: -1, delay: 1000, quality: 10 }))
|
||||||
.pipe(fs.createWriteStream('./test-artifacts/screens/walkthrough.gif'))
|
.pipe(fs.createWriteStream('./test-artifacts/screens/walkthrough (en).gif'))
|
||||||
|
|
||||||
// wait for end
|
// wait for end
|
||||||
await pify(endOfStream)(stream)
|
await pify(endOfStream)(stream)
|
||||||
|
Loading…
Reference in New Issue
Block a user