Merge branch 'toolbar' of github.com:hashicorp/boundary-ui into toolbar

This commit is contained in:
dharini committed 2021-10-18 09:32:53 -07:00
commit 6b7b5fd45d
3 files changed
+36 -27

No files matched your search

@@ -1,33 +1,13 @@
/* eslint-disable no-undef */
const { test, expect } = require('@playwright/test');
const { _electron: electron } = require('playwright');
const { generateScreenshotPath } = require('./test-helpers');
const {
generateScreenshotPath,
returnExecutablePath,
} = require('./test-helpers');
let electronApp = null;
const screenshotsDirectory = 'authentication/';
// TODO: move this function to a test helpers file so it could be used by other tests.
// Returns the executable path for the Boundary binary the test suite will run.
const returnExecutablePath = (platform, arch) => {
try {
// Just mac
if (platform === 'darwin') {
if (arch === 'x64') {
// Intel chips
return 'electron-app/out/Boundary-darwin-x64/Boundary.app/Contents/MacOS/Boundary';
} else if (arch === 'arm64') {
// M1 chips
return 'electron-app/out/Boundary-darwin-arm64/Boundary.app/Contents/MacOS/Boundary';
} else {
throw new Error('The test suite is not compatible with your arch.');
}
} else {
throw new Error('The test suite is not compatible with your Platform.');
}
} catch (error) {
console.error(error);
}
};
const executablePath = returnExecutablePath(process.platform, process.arch);
test.beforeEach(async () => {
+6 -3
View File
@@ -1,15 +1,18 @@
/* eslint-disable no-undef */
const { test, expect } = require('@playwright/test');
const { _electron: electron } = require('playwright');
const { generateScreenshotPath } = require('./test-helpers');
const {
generateScreenshotPath,
returnExecutablePath,
} = require('./test-helpers');
let electronApp = null;
const screenshotsDirectory = 'targets/';
const executablePath = returnExecutablePath(process.platform, process.arch);
test.beforeEach(async () => {
electronApp = await electron.launch({
executablePath:
'electron-app/out/Boundary-darwin-arm64/Boundary.app/Contents/MacOS/Boundary',
executablePath: executablePath,
env: {
NODE_ENV: 'test',
BYPASS_APP_UPDATER: true,
+26
View File
@@ -16,3 +16,29 @@ exports.generateScreenshotPath = (screenshotTestDirectory, fileName) => {
);
return path.join(screenshotPath, fileName).concat(screenshotFormat);
};
/**
*
* @param {string} platform The operating system.
* @param {string} arch The CPU architecture.
* @returns A full path where the Desktop Client executable is located.
*/
exports.returnExecutablePath = (platform, arch) => {
try {
switch (platform) {
case 'darwin':
switch (arch) {
case 'x64': // Intel chips
return 'electron-app/out/Boundary-darwin-x64/Boundary.app/Contents/MacOS/Boundary';
case 'arm64': // M1 chips
return 'electron-app/out/Boundary-darwin-arm64/Boundary.app/Contents/MacOS/Boundary';
default:
throw new Error('The test suite is not compatible with your arch.');
}
default:
throw new Error('The test suite is not compatible with your platform.');
}
} catch (error) {
console.error(error);
}
};