-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): btp auth with cert service (#649)
- Loading branch information
Showing
12 changed files
with
4,285 additions
and
4,882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { wdi5 } from "wdio-ui5-service" | ||
|
||
describe("wdi5 authentication", async () => { | ||
it("wdi5.isLoggedIn", async () => { | ||
expect(await wdi5.isLoggedIn()).toBeTruthy() | ||
}) | ||
|
||
it("should contain 'Zeis' in header title", async () => { | ||
await browser.waitUntil( | ||
async () => { | ||
const state = await browser.execute(() => { | ||
return ( | ||
window.document.readyState === "complete" && | ||
(!(window as any)._pendingFetchRequests || (window as any)._pendingFetchRequests === 0) | ||
) | ||
}) | ||
return state | ||
}, | ||
{ | ||
timeout: 10000, | ||
timeoutMsg: "Network did not reach idle state after 10s" | ||
} | ||
) | ||
|
||
const logger = wdi5.getLogger() | ||
logger.log("Starting test to check header title") | ||
|
||
const headerTitle = await $("span[id='cockpitObjectPageHeader-innerTitle']") | ||
logger.log("Found header title element") | ||
|
||
const titleText = await headerTitle.getText() | ||
logger.log(`Retrieved title text: "${titleText}"`) | ||
|
||
expect(titleText).toContain("Zeis") | ||
logger.log("Successfully verified title contains 'Zeis'") | ||
}) | ||
}) |
54 changes: 54 additions & 0 deletions
54
examples/ui5-ts-app/test/e2e/authentication/wdio-cert-authentication.conf.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { resolve } from "path" | ||
import { merge } from "ts-deepmerge" | ||
import { config as baseConf } from "./wdio-base.conf.js" | ||
import "dotenv/config" | ||
|
||
const _config = { | ||
baseUrl: "https://emea.cockpit.btp.cloud.sap/cockpit", | ||
capabilities: baseConf.capabilities ? [...baseConf.capabilities] : [] | ||
} | ||
|
||
delete baseConf.capabilities | ||
delete baseConf.specs | ||
|
||
baseConf.specs = [resolve("./test/e2e/AuthenticationCert.test.ts")] | ||
|
||
if (process.env.BROWSERSTACK) { | ||
_config.capabilities = _config.capabilities.map((capability) => { | ||
const enhancedCapability = { | ||
...capability, | ||
"wdi5:authentication": { | ||
provider: "Certificate", | ||
certificateOrigin: "https://accounts.sap.com", | ||
certificateUrl: "https://emea.cockpit.btp.cloud.sap/cockpit#/", | ||
certificatePfxPath: "./sap.pfx", | ||
certificatePfxPassword: process.env.SAPPFX_PASSPHRASE | ||
} | ||
} | ||
return enhancedCapability | ||
}) | ||
} else { | ||
_config.capabilities = [ | ||
{ | ||
"wdi5:authentication": { | ||
provider: "Certificate", | ||
certificateOrigin: "https://accounts.sap.com", | ||
certificateUrl: "https://emea.cockpit.btp.cloud.sap/cockpit#/", | ||
certificatePfxPath: "./sap.pfx", | ||
certificatePfxPassword: process.env.SAPPFX_PASSPHRASE | ||
}, | ||
browserName: "chrome", | ||
"goog:chromeOptions": { | ||
args: | ||
process.argv.indexOf("--headless") > -1 | ||
? ["headless", "disable-gpu"] | ||
: process.argv.indexOf("--debug") > -1 | ||
? ["window-size=1440,800", "--auto-open-devtools-for-tabs"] | ||
: ["window-size=1440,800"] | ||
}, | ||
acceptInsecureCerts: true | ||
} | ||
] | ||
} | ||
|
||
export const config = merge(baseConf, _config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.