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

update error message to align with playwright-go update #1299

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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ To use this you will need to export `AWS_DEFAULT_PROFILE=customer-test` environm
If you are using the Browser Identity Provider, on first invocation of `saml2aws login` you need to remember to install
the browser drivers in order for playwright-go to work. Otherwise you will see the following error message:

`Error authenticating to IDP.: could not start driver: fork/exec ... no such file or directory`
`Error authenticating to IDP.: please install the driver (vx.x.x) and browsers first: %!w(<nil>)`

To install the drivers, you can:
* Pass `--download-browser-driver` to `saml2aws login`
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/marshallbrekka/go-u2fhost v0.0.0-20210111072507-3ccdec8c8105
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/playwright-community/playwright-go v0.4201.1
github.com/playwright-community/playwright-go v0.4401.0
github.com/sirupsen/logrus v1.9.3
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -54,7 +54,7 @@ require (
github.com/tidwall/pretty v1.2.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/playwright-community/playwright-go v0.4201.1 h1:fFX/02r3wrL+8NB132RcduR0lWEofxRDJEKuln+9uMQ=
github.com/playwright-community/playwright-go v0.4201.1/go.mod h1:hpEOnUo/Kgb2lv5lEY29jbW5Xgn7HaBeiE+PowRad8k=
github.com/playwright-community/playwright-go v0.4401.0 h1:A1xk8CsjnwMSzBOKCdOxm5y98qPlZEXcpH6H37ccSiQ=
github.com/playwright-community/playwright-go v0.4401.0/go.mod h1:bpArn5TqNzmP0jroCgw4poSOG9gSeQg490iLqWAaa7w=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
Expand Down Expand Up @@ -205,8 +205,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/browser/browser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestNoBrowserDriverFail(t *testing.T) {
client, _ := New(account)
_, err := client.Authenticate(loginDetails)
assert.Error(t, err)
assert.ErrorContains(t, err, "could not start driver")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change @charlottecampbell193 - is there a scenario where the error "could not start driver" will be thrown? Or has that been completely removed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mapkon that error can still be thrown but not with the current test. A new test would need to be created that has the correct driver installed but has some other issue that is preventing it from starting. I'm not sure what scenario that would be though.

Copy link
Contributor

@mapkon mapkon Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right since the current error message is probably faulty, and playwright has fixed their API. The current test was exercising the scenario where there is completely no driver, so it makes sense to throw the please install the driver message. The comment on the test gave it away:
// Test that if download directory does not have browsers, it fails with expected error message

I imagine that we should have a test that launches a directory with an existing driver that we know won't "start", and see if that will fire it up (probably an invalid browser binary or similar). I wouldn't spend more than a day on it if you cannot get it to start.

Lastly, remember to update the README on line 575 to reflect the new message that will get thrown if the user attempts use without installing the drivers (like on first time use).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to recreate that error message. When I had an invalid browser binary the error I got was 'playwright: spawn UNKNOWN'. Tried a bunch of stuff messing around with it and got many other unhelpful messages but not could not start driver.

README has been updated - let me know your thoughts on the update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suffices for me. We can merge it now or wait for #1302 to be fixed (so we can run all the tests). Let me know

assert.ErrorContains(t, err, "please install the driver")
}

func fakeSAMLResponse(page playwright.Page, loginDetails *creds.LoginDetails, client *Client) (string, error) {
Expand Down
Loading