Created
August 17, 2021 03:54
-
-
Save chippers/db4305dac38e53399ee6775d6380b31a to your computer and use it in GitHub Desktop.
simple https://github.com/tauri-apps/wry webdriver testing scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(async () => { | |
const browser = await require('webdriverio').remote({ | |
capabilities: { | |
"webkitgtk:browserOptions": { | |
binary: process.argv.slice(2)[0] | |
} | |
} | |
}); | |
await browser.url("https://github.com"); | |
const header = await browser.$("body > h1"); | |
const headerText = await header.getText(); | |
console.log(`original header text: ${headerText}`); | |
const checks = await browser.$$("tr > td:nth-child(2)"); | |
const compat = { | |
good: 0, | |
bad: 0, | |
}; | |
for (const check of checks) { | |
const text = await check.getText(); | |
if (text.trim() === "✔") { | |
compat.good++ | |
} else { | |
compat.bad++ | |
} | |
} | |
await browser.closeWindow(); | |
console.log(`compatibility: good ${compat.good} | bad ${compat.bad}`); | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(async () => { | |
const browser = await require('webdriverio').remote({ | |
capabilities: { | |
"tauri:options": { | |
application: process.argv.slice(2)[0] | |
} | |
} | |
}); | |
const mainWindow = await browser.getWindowHandle(); | |
const checkRodaRoraDa = async () => { | |
let windows = await browser.getWindowHandles(); | |
if (windows.length < 2) { | |
setTimeout(checkRodaRoraDa, 100) | |
} else { | |
const newWindow = windows.filter(w => w !== mainWindow).pop(); | |
await browser.switchToWindow(newWindow); | |
const img = await browser.$("body > img"); | |
console.log(await img.getAttribute("src")) | |
await browser.deleteSession(); | |
} | |
}; | |
await checkRodaRoraDa(); | |
})()//"RODA RORA DA" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment