mirror of https://github.com/BTCPrivate/copay.git
testing: cleaner e2e screenshot naming
This commit is contained in:
parent
dbb87de4ce
commit
ec15a8af8c
|
@ -29,10 +29,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": [
|
"lint": [
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"project": "src/tsconfig.spec.json",
|
"project": "src/tsconfig.spec.json",
|
||||||
"exclude": "**/node_modules/**"
|
"exclude": "**/node_modules/**"
|
||||||
|
|
|
@ -7,21 +7,10 @@ export async function takeScreenshot(name: string) {
|
||||||
mkdirSync(dir);
|
mkdirSync(dir);
|
||||||
}
|
}
|
||||||
const config = await browser.getProcessedConfig();
|
const config = await browser.getProcessedConfig();
|
||||||
const instance = config['capabilities']['chromeOptions'];
|
const deviceName = config['capabilities']['name'];
|
||||||
const deviceName = instance['mobileEmulation']
|
|
||||||
? instance['mobileEmulation']['deviceName'].replace(/\s+/g, '')
|
|
||||||
: await nameFromWindowSize();
|
|
||||||
const pngData = await browser.takeScreenshot();
|
const pngData = await browser.takeScreenshot();
|
||||||
const path = `${dir}/${deviceName}_${name}`;
|
const path = `${dir}/${deviceName}_${name}`;
|
||||||
writeFile(path, pngData, { encoding: 'base64' }, () => {
|
writeFile(path, pngData, { encoding: 'base64' }, () => {
|
||||||
console.log(`File written: ${path}`);
|
console.log(`File written: ${path}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nameFromWindowSize() {
|
|
||||||
const size = await browser.driver
|
|
||||||
.manage()
|
|
||||||
.window()
|
|
||||||
.getSize();
|
|
||||||
return `${size.width}x${size.height}`;
|
|
||||||
}
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ module.exports = function(config) {
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
browsers: ['ChromeNoSandbox'],
|
// browsers: ['ChromeNoSandbox'],
|
||||||
// browsers: ['ChromeNoSandboxHeadless'],
|
browsers: ['ChromeNoSandboxHeadless'],
|
||||||
singleRun: false,
|
singleRun: false,
|
||||||
junitReporter: {
|
junitReporter: {
|
||||||
outputDir: process.env.JUNIT_REPORT_PATH,
|
outputDir: process.env.JUNIT_REPORT_PATH,
|
||||||
|
@ -48,12 +48,10 @@ module.exports = function(config) {
|
||||||
},
|
},
|
||||||
customLaunchers: {
|
customLaunchers: {
|
||||||
ChromeNoSandbox: {
|
ChromeNoSandbox: {
|
||||||
base: 'Chrome',
|
base: 'Chrome'
|
||||||
flags: ['--no-sandbox']
|
|
||||||
},
|
},
|
||||||
ChromeNoSandboxHeadless: {
|
ChromeNoSandboxHeadless: {
|
||||||
base: 'ChromeHeadless',
|
base: 'ChromeHeadless'
|
||||||
flags: ['--no-sandbox']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ exports.config = {
|
||||||
// Available deviceNames for mobileEmulation: https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
|
// Available deviceNames for mobileEmulation: https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
|
||||||
multiCapabilities: [
|
multiCapabilities: [
|
||||||
{
|
{
|
||||||
|
name: '1024x720',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
args: [
|
args: [
|
||||||
|
@ -15,6 +16,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: '800x600',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
args: [
|
args: [
|
||||||
|
@ -26,6 +28,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: '1920x1080',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
args: [
|
args: [
|
||||||
|
@ -37,6 +40,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'iPhoneX',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
@ -46,6 +50,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'iPhone8',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
@ -55,6 +60,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'iPad',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
@ -64,6 +70,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'iPadPro',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
@ -73,6 +80,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'Nexus6P',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
@ -82,6 +90,7 @@ exports.config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'Nexus5X',
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
mobileEmulation: {
|
mobileEmulation: {
|
||||||
|
|
Loading…
Reference in New Issue