Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add loginNetWeaver function #104

Merged
merged 8 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"@wdio/spec-reporter": "^7.20.8",
"@wdio/static-server-service": "^7.10.1",
"chai": "^4.3.4",
"chromedriver": "^107.0.0",
"chromedriver": "^109.0.0",
"deepmerge": "^4.2.2",
"eslint": "^6.8.0",
"eslint-plugin-wdio": "^6.0.12",
Expand Down
3 changes: 2 additions & 1 deletion src/reuse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class ReuseLibrary {
assertion: nonUi5Qmate.assertion,
element: nonUi5Qmate.element,
navigation: nonUi5Qmate.navigation,
userInteraction: nonUi5Qmate.userInteraction
userInteraction: nonUi5Qmate.userInteraction,
session: nonUi5Qmate.session
};
global.nonUi5 = {
...nonUi5,
Expand Down
3 changes: 3 additions & 0 deletions src/reuse/modules/nonUi5/NonUi5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import assertion, { Assertion } from "./assertion";
import element, { ElementModule } from "./element";
import navigation, { Navigation } from "./navigation";
import userInteraction, { UserInteraction } from "./userInteraction";
import session, { Session } from "./session";


export class NonUi5 {
assertion: Assertion = assertion
element: ElementModule = element
navigation: Navigation = navigation
userInteraction: UserInteraction = userInteraction
session: Session = session
}

export default new NonUi5()
31 changes: 31 additions & 0 deletions src/reuse/modules/nonUi5/session.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use strict";
/**
* @class session
* @memberof nonUi5
*/
export class Session {
// =================================== LOGIN ===================================
/**
* @function loginSapNetWeaver
* @memberOf nonUi5.session
* @description Login for SAP NetWebGUI form and specific username and password.
* @param {String} username - The username.
* @param {String} password - The password.
* @param {Boolean} [clickContinue=true] - Specifies if the function will press continue if applicable.
* @param {String} [iframeCssSelector="iframe"] - The specific iframe selector the login form is contained.
* @example await nonUi5.session.loginSapNetWeaver("john", "abc123!");
*/
async loginSapNetWeaver(username: string, password: string, clickContinue = true, iframeCssSelector = "iframe") {
await util.browser.switchToIframe(iframeCssSelector);
await ui5.session.loginCustom(username, password, "#sap-user", "#sap-password", "#LOGON_BUTTON");
if (clickContinue) {
await util.function.executeOptional(async () => {
const continueButton = await nonUi5.element.getByCss("DIV[id*='CONTINUE_BUTTON']", 0, 5000);
await nonUi5.userInteraction.click(continueButton);
});
}
await util.browser.switchToDefaultContent();
}

}
export default new Session();