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

test times out when running on BTP Launchpad #378

Closed
jasper07 opened this issue Nov 24, 2022 · 20 comments · Fixed by #520
Closed

test times out when running on BTP Launchpad #378

jasper07 opened this issue Nov 24, 2022 · 20 comments · Fixed by #520
Assignees
Labels
bug Something isn't working enhancement New feature or request feature request

Comments

@jasper07
Copy link

jasper07 commented Nov 24, 2022

Describe the bug
Trying to do end to end tests on BTP Launchpad.

Tests work fine running on a Local fiorilaunchpad.html, but when i point the baseUrl to my BTP Launchpad, it authenticates ok and the goto semantic link works fine, the test however times out on the first test

it("should see the List Report page", async () => {
    await FioriElementsFacade.execute((Given, When, Then) => {
        Then.onTheMainPage.iSeeThisPage();
    })
})

HTML5 repo apps run in an Iframe, I tried to switch the browser to the iFrame before WDI5FE.initialize and before the selectors didnt work

before(async () => {
    await wdi5.goTo("#travel-process");
    let frame = await browser.$('#application-travel-process');  
    browser.switchToFrame(frame)
    FioriElementsFacade = await browser.fe.initialize({
        onTheMainPage: {
            ListReport: {
                appId: "sap.fe.cap.travel",
                componentId: "TravelList",
                entitySet: "Travel"
            }
        },

To Reproduce
Steps to reproduce the behavior:

  1. clone https://github.com/SAP-samples/cap-sflight
  2. add a fiorilaunchpad.html to the travel_processor with a tile calling the sap.fe.cap.travel component
  3. create a wdio.conf.js pointing baseUrl to http://localhost:4004/travel_processor/webapp/fiorilaunchpad.html
  4. create an e2e folder and port some of the existing Opa5 journey over to wdi5 journey (was an easy cut and paste)
  5. test the app, ensure works
  6. deploy to CF
  7. create a tile in the BTP Launchpad same semantic link as local lauchpad
  8. update wdio.conf.js pointing baseUrl to https://instance.launchpad.cfapps.regio.hana.ondemand.com/site
  9. add wdi5:authentication provider: "BTP" to wdio.conf.js
  10. run test

Expected behavior
expect the tests to behave the same

Logs/Console Output
Seeing the page 'sap.fe.cap.travel::TravelList' - FAILURE Opa timeout after 15 seconds This is what Opa logged: Found 0 blocking out of 948 tracked timeouts - sap.ui.test.autowaiter._timeoutWaiter#hasPending AutoWaiter syncpoint - sap.ui.test.autowaiter._autoWaiter Found no control with the global ID 'sap.fe.cap.travel::TravelList' - sap.ui.test.Opa5 Matchers found no controls so check function will be skipped

@vobu vobu added bug Something isn't working enhancement New feature or request feature request labels Nov 24, 2022
@vobu
Copy link
Contributor

vobu commented Nov 24, 2022

first of all, thanks for the detailed feedback and context 👍
this will make it easier to get FLP/WorkZone std ed support in!
now we're looking into getting the right resources in place to have a permanent deployment of a sample CAP/UI5 app in an FLP/WZ std ed that we can continuously use in the CI cycle!

@gregorwolf
Copy link

Hi @vobu,
with my changes in https://github.com/gregorwolf/wdi5/tree/html5-repo I was able to deploy and configure the TypeScript Sample app to my BTP Free Tier. You can access the app via:

https://cswdev.launchpad.cfapps.eu10.hana.ondemand.com/site/csw#TestSampleTSapp-display

Please give it a try.

@gregorwolf
Copy link

Does my deployment help? Should I try to automate the deployment so that updates to this repository result in a fresh deployment?

@dominikfeininger dominikfeininger self-assigned this Feb 1, 2023
@dominikfeininger
Copy link
Collaborator

I am going to investigate the https://webdriver.io/docs/api/webdriver/#switchtoframe function in a wdio before hook.

@dominikfeininger
Copy link
Collaborator

Hi @gregorwolf could please disable the authentication to your test application. I am getting a captcha which cannot be handled by the wdi5 authentication.

image

@gregorwolf
Copy link

In the first step of the logon you see:

Screenshot 2023-02-03 at 09 36 54

You must provide an S- or P-User instead of the E-Mail Address. Then you will stay in SAP ID Service and you should not be re-directed to SAP Universal ID.

@dominikfeininger
Copy link
Collaborator

Wasn't aware of that. Will try.

@dominikfeininger
Copy link
Collaborator

Not working neither S-User nor P-User. I get always a redirected to Universal ID with captcha.

@gregorwolf
Copy link

Even when I do a login to SAP ID Service (https://accounts.sap.com/) before I access the SAP Work Zone Standard Edition (Launchpad) I'm getting redirected to SAP Universal ID.

I've switched the application now to my custom SAP Identity Authentication and did allow the self registration for the moment. Please give it a try.

@jasper07
Copy link
Author

Any update on this feature?

One thing i forgot to mention was the sap/ui/test/** dependencies get loaded on the parent window, they would need to be on the child also as that is where the selectors need to work

@jasper07
Copy link
Author

jasper07 commented Mar 3, 2023

made some progress thought id share, the following works,

  1. pause while the iframe loads (there is an appload event in ushell)
  2. switch to iframe with awaits and pause
  3. late inject ui5 dependencies
  4. continue testing
  5. do the onShell commands via browser execute, could do via a parent selector but this works

still get errors with other tests but its a start

const { wdi5 } = require("wdio-ui5-service")
const { default: _ui5Service } = require("wdio-ui5-service")
const ui5Service = new _ui5Service()
describe("FE basics", () => {
    let FioriElementsFacade

    before(async () => {
        await wdi5.goTo("#travel-process");
        await browser.pause(2000) //wait for the iframe to load
        let frame = await browser.$('#application-travel-process');
        await browser.switchToFrame(frame)
        await browser.pause(1000)
        await ui5Service.injectUI5()
        FioriElementsFacade = await browser.fe.initialize({
            onTheMainPage: {
                ListReport: {
                    appId: "sap.fe.cap.travel",
                    componentId: "TravelList",
                    entitySet: "Travel"
                }
            },
            onTheDetailPage: {
                ObjectPage: {
                    appId: "sap.fe.cap.travel",
                    componentId: "TravelObjectPage",
                    entitySet: "Travel"
                }
            },
            onTheItemPage: {
                ObjectPage: {
                    appId: "sap.fe.cap.travel",
                    componentId: "BookingObjectPage",
                    entitySet: "Booking"
                }
            },
            onTheShell: {
                Shell: {}
            }
        })

    })

    it("should see the List Report page", async () => {
        await FioriElementsFacade.execute((Given, When, Then) => {
            Then.onTheMainPage.iSeeThisPage();
        })
    })


    it("should see the Object Page loads and returns to list", async () => {
        await FioriElementsFacade.execute((Given, When, Then) => {
            When.onTheMainPage.onTable().iPressRow({ Travel: "4,133" })
            Then.onTheDetailPage.iSeeThisPage()
            // When.onTheShell.iNavigateBack()
        })
        await browser.execute(() => {
            // the child communicates with the parents via messages
            sap.ushell.Container.getService("CrossApplicationNavigation").historyBack()
        })

        await FioriElementsFacade.execute((Given, When, Then) => {
            Then.onTheMainPage.iSeeThisPage()
        })

    })

    it("should create a travel request", async () => {
        await FioriElementsFacade.execute((Given, When, Then) => {
            Then.onTheMainPage.iSeeThisPage();

@jasper07
Copy link
Author

jasper07 commented Mar 3, 2023

got the typescript app on https://cswdev.launchpad.cfapps.eu10.hana.ondemand.com/site/csw#TestSampleTSapp-display working fine, its not a good example as the navigation is in app and not through the shell

if you want to stop that biometric page from loading everytime set the following cookie in wdio.conf.js

    before: function (capabilities, specs, browser) {
        browser.setCookies({
            name: 'skipPasswordlessAuthnDeviceConfig',
            value: 'true',
            domain: 'aqywyhweh.accounts.ondemand.com'
        })
    }

@vobu
Copy link
Contributor

vobu commented Mar 3, 2023

thanks for all the exploratory work you've been doing! 👍
once cap sflight or similar is deployed, let's try surfacing an api that auto-awaits the frame switching and cookie setting
rocky path but there seems light 💡 at the end of the tunnel 🕳️

@gregorwolf
Copy link

I've created a sflight branch cf-deploy-with-sqlite and deployed to https://cswdev.launchpad.cfapps.eu10.hana.ondemand.com/site/csw#travel-process. Hope that will help @jasper07.

@jasper07
Copy link
Author

jasper07 commented Mar 3, 2023

cheers @gregorwolf

I am getting a forbidden error when trying to create a trip
wdi5_flp

I think i need the processor role
wdi5_flp2

are you able to assign my user patterjo_at_gmail.com with that role?

@gregorwolf
Copy link

Done.

@jasper07
Copy link
Author

jasper07 commented Mar 4, 2023

cheers
here is the repo with the tests, npm ci, create an .env with your user and then run test

https://github.com/jasper07/wdi5btplaunchpad

animation

ill keep looking into the memory leak issues,

@vobu
Copy link
Contributor

vobu commented Mar 17, 2023

thanks @jasper07 and @gregorwolf for all the (prep) work and analysis you put into this so far!
we're planning a coding session next week to progress on this - and hopefully have it in asap.

@vobu
Copy link
Contributor

vobu commented Mar 23, 2023

we've made significant progress thanks to you two's @jasper07 and @gregorwolf work here!
it'll go all into #447
in the meantime, we left a PR at jasper07/wdi5btplaunchpad#1 for the original repo
@gregorwolf - can we keep both the custom IAS auth and the deployed sflight cap app for integration into our CI here?

@gregorwolf
Copy link

@vobu completely fine for me. It's running on my BTP Free Tier. So as long as SAP does not change anything here I can provide it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request feature request
Projects
None yet
4 participants