Merge branch 'main' into refactor-checkbox-changed

This commit is contained in:
Susmitha Girumala authored and GitHub committed 2021-10-24 22:38:45 -04:00
commit 3ede705fe1
5 files changed
+100 -74

No files matched your search

+1
View File
@@ -50,6 +50,7 @@
"@storybook/addons": "^6.3.9",
"@storybook/api": "^6.3.12",
"@storybook/cli": "^6.3.10",
"@storybook/components": "^6.3.12",
"@storybook/ember": "^6.3.8",
"@storybook/ember-cli-storybook": "^0.4.0",
"babel-eslint": "^10.1.0",
+21 -47
View File
@@ -4,12 +4,19 @@ const { _electron: electron } = require('playwright');
const helpers = require('./test-helpers');
let electronApp = null;
// Subdirectory within tests/end2end/screenshots where the screenshots of this test suite will be stored.
const screenshotsDirectory = 'authentication/';
// Path where the Boundary Desktop client binary is generated
const executablePath = helpers.returnExecutablePath(
process.platform,
process.arch
);
// Set login variables
const originValue = 'http://localhost:9200';
const loginUsername = 'admin';
const loginPassword = 'password';
test.beforeEach(async () => {
electronApp = await electron.launch({
executablePath: executablePath,
@@ -34,29 +41,15 @@ test.describe('Authentication end to end test suite', async () => {
await boundaryWindow.evaluate(() =>
window.localStorage.setItem('desktop:origin', null)
);
const originValue = 'http://localhost:9200';
const authLoginNameValue = 'admin';
const authLoginPasswordValue = 'password';
// Fill the origin input
await boundaryWindow.waitForSelector('[name=host]');
await boundaryWindow.fill('[name=host]', originValue);
// Take screenshot
await boundaryWindow.screenshot({
path: helpers.generateScreenshotPath(
screenshotsDirectory,
'fillOrigin'
),
fullPage: true,
});
// Perform login
await helpers.login(
boundaryWindow,
originValue,
loginUsername,
loginPassword
);
// Click the submit button
await boundaryWindow.waitForSelector('button[type="submit"]');
await helpers.click(boundaryWindow, 'button[type="submit"]');
// Fill user & password
await boundaryWindow.fill('[name="identification"]', authLoginNameValue);
await boundaryWindow.fill('[name="password"]', authLoginPasswordValue);
// Take screenshot
await boundaryWindow.screenshot({
path: helpers.generateScreenshotPath(
@@ -126,32 +119,13 @@ test.describe('Authentication end to end test suite', async () => {
await boundaryWindow.evaluate(() =>
window.localStorage.setItem('desktop:origin', null)
);
const originValue = 'http://localhost:9200';
const authLoginNameValue = 'admin';
const authLoginPasswordValue = '123456';
// Fill the origin input
await boundaryWindow.fill('[name=host]', originValue);
// Take screenshot
await boundaryWindow.screenshot({
path: helpers.generateScreenshotPath(
screenshotsDirectory,
'fillOrigin'
),
fullPage: true,
});
// Click the submit button
await boundaryWindow.waitForSelector('button[type="submit"]');
await helpers.click(boundaryWindow, 'button[type="submit"]');
// Fill user & password
await boundaryWindow.fill('[name="identification"]', authLoginNameValue);
await boundaryWindow.fill('[name="password"]', authLoginPasswordValue);
// Click submit
await boundaryWindow.waitForSelector('button[type="submit"]');
await helpers.click(boundaryWindow, 'button[type="submit"]');
// Perform login
await helpers.login(
boundaryWindow,
originValue,
loginUsername,
'123456789'
);
// Wait for the notification
await boundaryWindow.waitForSelector('.rose-notification-body');
+15 -19
View File
@@ -4,12 +4,19 @@ const { _electron: electron } = require('playwright');
const helpers = require('./test-helpers');
let electronApp = null;
// Subdirectory within tests/end2end/screenshots where the screenshots of this test suite will be stored.
const screenshotsDirectory = 'targets/';
// Path where the Boundary Desktop client binary is generated
const executablePath = helpers.returnExecutablePath(
process.platform,
process.arch
);
// Set login variables
const originValue = 'http://localhost:9200';
const loginUsername = 'admin';
const loginPassword = 'password';
test.beforeEach(async () => {
electronApp = await electron.launch({
executablePath: executablePath,
@@ -28,30 +35,19 @@ test.afterEach(async () => {
test.describe('Targets end to end test suite', async () => {
test('Connects to a target', async () => {
const boundaryWindow = await electronApp.firstWindow(); // The window that contains the app.
// Override local storage origin
await boundaryWindow.evaluate(() =>
window.localStorage.setItem('desktop:origin', null)
);
const originValue = 'http://localhost:9200';
const authLoginNameValue = 'admin';
const authLoginPasswordValue = 'password';
// Fill the origin input
await boundaryWindow.waitForSelector('[name=host]');
await boundaryWindow.fill('[name=host]', originValue);
// Click the submit button
await boundaryWindow.waitForSelector('button[type="submit"]');
await helpers.click(boundaryWindow, 'button[type="submit"]');
// Fill user & password
await boundaryWindow.fill('[name="identification"]', authLoginNameValue);
await boundaryWindow.fill('[name="password"]', authLoginPasswordValue);
// Click submit
await boundaryWindow.waitForSelector('button[type="submit"]');
await helpers.click(boundaryWindow, 'button[type="submit"]');
// Perform the login
await helpers.login(
boundaryWindow,
originValue,
loginUsername,
loginPassword
);
// Check we are in Targets
await boundaryWindow.waitForURL('**/#/scopes/global/projects/targets');
+27 -2
View File
@@ -46,9 +46,34 @@ exports.returnExecutablePath = (platform, arch) => {
/**
* Performs a click with a workarouind due to an error with plain playwright click.
* More info about the issue here: https://github.com/microsoft/playwright/issues/1808
* @param {*} appWindow The current electron window.
* @param {*} selector The DOM element selector.
* @param {object} appWindow The electron window to perform the action.
* @param {string} selector The DOM element selector.
*/
exports.click = async (appWindow, selector) => {
await appWindow.$eval(selector, (element) => element.click());
};
/**
* Performs login on the app window provided with the credentials provided.
* @param {object} appWindow The electron window to perform the action.
* @param {string} origin URL origin to set.
* @param {string} username Username to login.
* @param {string} password Password to login.
*/
exports.login = async (appWindow, origin, username, password) => {
// Fill the origin input
await appWindow.waitForSelector('[name=host]');
await appWindow.fill('[name=host]', origin);
// Click the set origin submit button
await appWindow.waitForSelector('button[type="submit"]');
await this.click(appWindow, 'button[type="submit"]');
// Fill user & password
await appWindow.fill('[name="identification"]', username);
await appWindow.fill('[name="password"]', password);
// Click submit
await appWindow.waitForSelector('button[type="submit"]');
await this.click(appWindow, 'button[type="submit"]');
};
+36 -6
View File
@@ -3514,6 +3514,36 @@
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"
"@storybook/components@^6.3.12":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/components/-/components-6.3.12.tgz#0c7967c60354c84afa20dfab4753105e49b1927d"
integrity sha512-kdQt8toUjynYAxDLrJzuG7YSNL6as1wJoyzNUaCfG06YPhvIAlKo7le9tS2mThVFN5e9nbKrW3N1V1sp6ypZXQ==
dependencies:
"@popperjs/core" "^2.6.0"
"@storybook/client-logger" "6.3.12"
"@storybook/csf" "0.0.1"
"@storybook/theming" "6.3.12"
"@types/color-convert" "^2.0.0"
"@types/overlayscrollbars" "^1.12.0"
"@types/react-syntax-highlighter" "11.0.5"
color-convert "^2.0.1"
core-js "^3.8.2"
fast-deep-equal "^3.1.3"
global "^4.4.0"
lodash "^4.17.20"
markdown-to-jsx "^7.1.3"
memoizerific "^1.11.3"
overlayscrollbars "^1.13.1"
polished "^4.0.5"
prop-types "^15.7.2"
react-colorful "^5.1.2"
react-popper-tooltip "^3.1.1"
react-syntax-highlighter "^13.5.3"
react-textarea-autosize "^8.3.0"
regenerator-runtime "^0.13.7"
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"
"@storybook/core-client@6.3.8":
version "6.3.8"
resolved "https://registry.yarnpkg.com/@storybook/core-client/-/core-client-6.3.8.tgz#9223b9f22ab86d205dac605bcef15ba0f0068e15"
@@ -7514,9 +7544,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001157, caniuse-lite@^1.0.30001265:
version "1.0.30001267"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001267.tgz#b1cf2937175afc0570e4615fc2d2f9069fa0ed30"
integrity sha512-r1mjTzAuJ9W8cPBGbbus8E0SKcUP7gn03R14Wk8FlAlqhH9hroy9nLqmpuXlfKEw/oILW+FGz47ipXV2O7x8lg==
version "1.0.30001270"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001270.tgz#cc9c37a4ec5c1a8d616fc7bace902bb053b0cdea"
integrity sha512-TcIC7AyNWXhcOmv2KftOl1ShFAaHQYcB/EPL/hEyMrcS7ZX0/DvV1aoy6BzV0+16wTpoAyTMGDNAJfSqS/rz7A==
capture-exit@^2.0.0:
version "2.0.0"
@@ -7774,9 +7804,9 @@ clean-css-promise@^0.1.0:
pinkie-promise "^2.0.0"
clean-css@^3.4.5, clean-css@^4.1.11, clean-css@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==
version "4.2.4"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.4.tgz#733bf46eba4e607c6891ea57c24a989356831178"
integrity sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==
dependencies:
source-map "~0.6.0"