passbolt-styleguide
Version:
Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.
187 lines (166 loc) • 5.18 kB
JavaScript
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) 2020 Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2020 Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 2.11.0
*/
import { render } from "@testing-library/react";
import AppContext from "../../../../shared/context/AppContext/AppContext";
import React from "react";
import DisplaySimulateSynchronizeUserDirectoryAdministration from "./DisplaySimulateSynchronizeUserDirectoryAdministration";
import MockTranslationProvider from "../../../test/mock/components/Internationalisation/MockTranslationProvider";
import { AdminUserDirectoryContextProvider } from "../../../contexts/Administration/AdministrationUserDirectory/AdministrationUserDirectoryContext";
import userEvent from "@testing-library/user-event";
/**
* The DisplaySimulateSynchronizeUserDirectoryAdministration component represented as a page
*/
export default class DDisplaySimulateSynchronizeUserDirectoryAdministrationPage {
/**
* Default constructor
* @param appContext An app context
* @param props Props to attach
*/
constructor(appContext, props) {
this._page = render(
<MockTranslationProvider>
<AppContext.Provider value={appContext}>
<AdminUserDirectoryContextProvider {...props}>
<DisplaySimulateSynchronizeUserDirectoryAdministration {...props} />
</AdminUserDirectoryContextProvider>
</AppContext.Provider>
</MockTranslationProvider>,
);
this.setupPageObjects();
}
/**
* Set up the objects of the page
*/
setupPageObjects() {
this._titleHeader = new TitleHeaderPageObject(this._page.container);
this._displaySimulateSynchronizeUserDirectoryAdministrationDialog =
new DisplaySimulateSynchronizeUserDirectoryAdministrationDialogPageObject(this._page.container);
}
/**
* Return the page object of the title header
*/
get title() {
return this._titleHeader;
}
/**
* Returns the page object of create user
*/
get displaySimulateSynchronizeUserDirectoryAdministrationDialog() {
return this._displaySimulateSynchronizeUserDirectoryAdministrationDialog;
}
}
/**
* Page object for the TitleHeader element
*/
class TitleHeaderPageObject {
/**
* Default constructor
* @param container The container which includes the AddActivity Component
*/
constructor(container) {
this._container = container;
}
/**
* Returns the clickable area of the header
*/
get hyperlink() {
return this._container.querySelector(".dialog-header-title");
}
}
class DisplaySimulateSynchronizeUserDirectoryAdministrationDialogPageObject {
/**
* Default constructor
* @param container The container which includes the AddComment Component
*/
constructor(container) {
this._container = container;
this.user = userEvent.setup();
}
/**
* Returns the dialog element
*/
get dialog() {
return this._container.querySelector(".ldap-simulate-synchronize-dialog");
}
/**
* Returns the dialog close element
*/
get dialogClose() {
return this._container.querySelector(".dialog-close");
}
/**
* Returns the respurce synchronize report element
*/
get resourceSynchronize() {
return this._container.querySelector("#resources-synchronize").textContent;
}
/**
* Returns the nothing to synchronize message
*/
get noReportMessage() {
return this._container.querySelector("#no-report-message").textContent;
}
/**
* Returns the no resource element
*/
get noResource() {
return this._container.querySelector("#no-resources");
}
/**
* Returns the error element
*/
get error() {
return this._container.querySelector(".warning.message").textContent;
}
/**
* Returns the full report element
*/
get fullReport() {
return this._container.querySelector(".accordion.operation-details .accordion-header");
}
/**
* Returns the errors test report element
*/
get textareaReport() {
return this._container.querySelector(".accordion-content .input.text textarea");
}
/**
* Returns the synchronize button element
*/
get synchronize() {
return this._container.querySelector(".submit-wrapper button.primary");
}
/**
* Returns the users list element
*/
get cancel() {
return this._container.querySelector(".submit-wrapper .cancel");
}
/**
* Returns the Download the Full Report link
*/
get downloadReportLink() {
return this._container.querySelector("button.link.download-full-report");
}
/**
* Returns true if the page object exists in the container
*/
exists() {
return this.dialog !== null;
}
/** Click on the element */
async click(element) {
await this.user.click(element);
}
}