Open Test Browser incorrect Arguments in robot file

I may have missed something completely basic in my setup.

We have a cumulusci project, where we’re building robot tests utilising SalesforcePlaywright.robot. I’m trying to test the Browser functionality using Open Test Browser but various attempts at using it are returning errors.

*** Settings ***
Resource    cumulusci/robotframework/SalesforcePlaywright.robot

*** Tasks ***
Open Custom Browser
    Open Test Browser

Error: browser.newContext: viewport.width: expected integer, got string

I have tried a few others

*** Settings ***
Resource    cumulusci/robotframework/SalesforcePlaywright.robot

*** Tasks ***
Open Custom Browser
    Open Test Browser    useralias=TestUser

Error: browser.newContext: viewport.width: expected integer, got string

*** Settings ***
Resource    cumulusci/robotframework/SalesforcePlaywright.robot

*** Tasks ***
Open Custom Browser
    Open Test Browser    size=1920x1080

Error: browser.newContext: viewport.width: expected integer, got string

Most examples I’ve seen, are using it with no arguments. I’m wondering is there something obvious I’ve missed? I’ve been troubleshooting the configuration and re-installed etc.

Thanks

Looks like issue on (cumulusci) their side.

CumulusCI/cumulusci/robotframework/SalesforcePlaywright.py at main · SFDO-Tooling/CumulusCI · GitHub ← takes strings and passes them forward without converting to it int..

File a bug, nothing to do with browser library..

1 Like

Thanks. I have just done that. I think I can utilise New Browser for now but will need to specify the login/url credentials whereas Open Test Browser takes care of that for you?

I just googled your error message and i have not even seen this project before so no idea. But why wouldn’t you be able to do that on plain browser ? Just check the linked python code and model your RF in same fashion..

Apologies if I’m missing something, quite new to rf so figuring best approaches. will review

you mentioned “you tried to fix it” in the actual issue. Stuff like that is not very helpful unless you share the code ..

Python code in the linked file is like this:

        context_id = self.browser.new_context(
            viewport={"width": width, "height": height}, recordVideo=record_video
        )

and it should be like this:

        context_id = self.browser.new_context(
            viewport={"width": int(width), "height": int(height)}, recordVideo=record_video
        )

Thanks @rasjani I had tried multiple scenarios of trying to fix it which was why I didn’t share but I take your point. I have tried once more using your example for context_id with this in my test:

*** Settings ***
Resource cumulusci/robotframework/SalesforcePlaywright.robot

*** Tasks ***
Open Custom Browser
Open Test Browser

and I’m still receiving: Error: browser.newContext: viewport.width: expected integer, got string

I’m wondering is there some issue in my configuration.

Thanks for the suggestion.

And you edited the installed python file and not running it in CI ?

It’s working now locally with your suggested fix. I had a bit of nightmare, I have multiple virtual environments and they are similarly named. I was editing the wrong one and losing my mind as to why I couldn’t see any logging inforrmation. Thank you @rasjani

This is a bug on CCI side right? And what is the approach when I look to use it in my CI?

Thanks

Yes, thats why I told to file a bug to their issue tracker.

  1. wait for the fix
  2. Submit the fix yourself - probably needs that you sign their CLA too and then, then wait for the fix to be released
  3. “Fork their project”, implement the fix in the fork, push the fork to somewhere where your CI can fetch it and use that fork until the fix is provided by CCI
  4. Since the change is only essentially oneline fix:
    1. make a diff with your fix
    2. apply the fix in your ci pipeline against the installed cumulusci version before running robot
1 Like

Thank you so much @rasjani