I’m wanting to test calendar integration with our business app. The use case goes like this:
User logs into our app and creates a new meeting
The meeting should populate Google Calendar within a reasonable timeframe
User should be able to verify the meeting is on their personal Google calendar
On the 3rd point above, I’m able to start a UI test with Katalon and land on the URL ‘https://calendar.google.com’. It asks the user to enter their email, and press next. I complete those steps and then Google tells me the browser session may not be secure. I suspect that’s their way of limiting automated web drivers from hammering their servers, or accessing data that you should not have access to.
It seems like some people have found a way to login to Gcal with Selenium, or Katalon WebUI but I can’t figure it out. I opened the devtools and didn’t see any non-200 status codes return.
See below for the code I’m using. I tried setting the user-agent in ChromeOptions with hopes that it would be perceived as a normal browser session (ie human). I may be oversimplifying things.
Thanks Russ for helping provide another avenue. I’ll investigate that as well.
Jvisser I’ve attempted both methods to see which worked (first and foremost) and then which caused fewer headaches. With the calendar API, I was successful setting up Postman through Oauth 2.0 and could query results, but I can’t get past the initial auth stage with Katalon. Opened a separate thread for that workflow:
Ideally I’d like to run somewhat of an E2E test through Katalon that does:
Login to our application through Web UI and create or edit a Meeting instance (can do)
Store meeting details through an API from our application (can do)
Validate the meeting populates Gcal within a reasonable timeframe (stuck)
Calendar integration through Nylas has proved problematic at times and I’m hoping to trace when / why that’s the case.
My issue is, not wanting to screw around with my gmail account – I’m using it for various services all day so I’m paranoid about Google stepping in and “protecting me” from some perceived hack attempt.
I did pretty much what you listed above, is all I can say. And as I said, it appeared to be working.
Before I started typing this response, I did a search and found the following – maybe it will help?
I’m assuming the same (or similar) API will allow access to Calendar.
Please note that my real account name is replaced to “my.account”
When I executed this, yes, it opened a Chrome browser, navigate to the URL “calendar.google.com”, the login form appeard. It typed “firstname.lastname@example.org” into the text field. Then Google responded with a display
The code I tried (posted above) seemed to work without issue.
Yes, I did. As I have already said, I am not prepared to test against my gmail account. I did not try to access Calendar. I tried the code I posted, going as far as I said and no more. It appeared to work.
I cannot know if it would have worked had I gone any further.
The OP may try to go further, like I said, that’s his job.
Previously, this process was very expensive and unreliable to implement. But these days, with some API software interfaces that can be used, authentication bypass has become more realistic and cost-balanced. It`s possible to bypass, no authentication method is 100% secure. As for google calendar, I also tried to configure it for my application, it worked, but there were other difficulties, so I had to abandon such a method. That’s why I use them separately. However, I recently found this calendar and it pleasantly surprised me with its simplicity in use.
Inevitably I went the route of API validation. In my experience, Katalon does not make it easy to utilize refresh tokens once a JWT expires. I could add my credentials into the Authorization tab of Katalon and exchange the authorization code for a bearer token, but the problem is Katalon does not save the Authorization credentials (OAuth 2.0) after you close the request. This is a huge issue if a user intends to schedule test automation overnight, for example, because the user is constantly having to refresh credentials manually. Postman stores OAuth credentials natively at the parent level of Collections so I’m not really sure why Katalon can’t replicate that.
That was my major hurdle in trying to decide between automating tests for Gcal through the web interface, versus using API tests. I eventually found this article which was helpful to learn how to structure a POST for Refresh Token in a few different dev languages. Please scroll down to the following if needed:
How to Refresh Your Google Calendar Access Token Using Refresh Tokens