How to verify some string from a variable?

I couldn’t really find an answer to what I’m trying to do…

So I have this test case where I integrate with gmai to read an email content… basically validating reset pw email was sent and verifying one line from the email.

I setup gmail integration with katalon and i’m able to parse the contents from the email… i store that in a variable…

but now I need to verify that certain string is present in that email content.

So I have a variable that parsed the entire email content - “parseGmail” and I have another variable that has the partia expected string from that email … i tried severa different ways but test seem to be trying to verify the entire email content.

println parseGmail	
String expectedEmail = 'Someone has requested to reset the password for your  account.'
    assert WebUI.verifyTextPresent(parseGmail, expectedEmail, false)

i tried this as well.
parseGmail = WebUI.verifyTextPresent(expectedEmail, false)

I got it to work by doing the splice/trim method but i just don’t like that method -

String pwReset =  parseGmail.substring(0,72).trim()	
	println pwReset
    assert (expectedEmail = pwReset)

What is the type of the variable parseGmail? Is it a String?

If parseGmail is a String, then you should not use WebUI.verifyTextPresent() keyword. You should rather do something like:

assert parseGmail.contains(expectedString)
1 Like

Yea… parseGmail is a string.

I think the [contains] is what i was looking for, couldn’t figure out how to write the code.

I’ll try it out…it’s lot better than slice and trim the contents