I want to test a submission form but the click on the submit button calls on a api from a different domain in Cypress - automation

Lets say I want to automate a lead form with name and number in cypress,
I click on Submit button
The BaseUrl is https://localhost:8080
On clicking the Submit button manually, an API is triggered with URL https://localhost:9010
But in Cypress
Api is not triggered , and no action occurs on clicking the submit button .
Can somebody give a solution or a workaround for this issue??

Related

How to make Background keyword as a runner scenario in cucumber?

I am trying to test Amazon website with 3 scenarios on selenium with cucumber. For writing gherkin structure. I concat my login functionality with other scenarios with the Background keyword. But this time the problem is that my scenario number is decreased from 3 to 2. Basically, I want to also test the login functionality and make the terminal close and go to the other test scenarios. Instead, the code behaves login and searching product functionality as one scenario and closes its terminal.
The below gherkin language is my Amazon.feature;
Feature: To be able to shop through the website in e-commerce platform, Amazon.
Background:
Given User is on homepage
When Click accept cookies
When User click login button
When User click EmailBlank
And Enter e-mail address
And User press continue button
When User click PasswordBlank
And Enter password
And Click SignIn button
Scenario: Finding the product from the website
When Click the search button
When Write product name
When Click search button
When Filter for Shipped by Amazon
When Filter for Apple
Scenario: Adding and deleting product to cart
#the upper scenario
When Click the search button
When Write product name
When Click search button
When Filter for Shipped by Amazon
When Filter for Apple
#the upper scenario
When Click the first product
When Add to Cart
And Close the Cart
And Click the Cart
When Check at cart page
When Delete the product
I tried to put the Scenario below the Background but this time 2nd scenario is run without logging into the website. I also put Scenario before the Background and get the syntax error.
You can write an Scenario with 1 step that not exist in Background:
Scenario: Login with valid credentials
Then check some extra data here belongs to login function thaat is not included it background
Instead of writing
Given User is on homepage
When Click accept cookies
When User click login button
When User click EmailBlank
And Enter e-mail address
And User press continue button
When User click PasswordBlank
And Enter password
And Click SignIn button
write
Given I am signed in
and push HOW you sign in down into the step definitions. Once you have done that go further and push HOW you sign in down into helper methods called from your step definitions.

Selenium C# Webdriver How to detect if button is clicked

I am using selenium with IE to automate web testing. My webpage fills out a form and finally clicks a button. Code to click button is
driver.FindElement(By.CssSelector("td.ne-fieldvalues > input[type=\"button\"]")).Click();
8 out of 10 times, it Clicks but other time click command is never executed.
Is there way I can check if button was indeed clicked ? something similar to checkbox
if (!driver.FindElement(By.CssSelector("input[type=\"checkbox\"]")).Selected)
driver.FindElement(By.CssSelector("input[type=\"checkbox\"]")).Click();
I tried .Displayed and .Enabled and both these properties are always true.
Thanks for help.
To ensure that an action is performed on a click of a link or button, it is best to verify the resultant state of application. For eg. if I click on 'Log in' button after entering valid username and password, it will take me to my homepage, verify that homepage has loaded, else fail the click event. In case of invalid username/password, verify the warning message on login page itself.
To summarize, you have to validate the response to verify click event on any web element.
The least you can do is ensure that the element is clickable using ExpectedConditions.elementToBeClickable():
// In Java
WebDriverWait wait = new WebDriverWait(driver, timeOut);
wait.until(ExpectedConditions.elementToBeClickable(locator));

Is Selenium Click or Keys.Enter or MovtoElement.Click() a soft click?

My test automation uses Selenium for UI interactions and fiddlercore api to capture the events generated by UI. Situation I am facing right now is fiddlercore is failing to capture event that is caused by click on a button. I have tried following ways:
builder.MoveToElement(searchButton).Click(searchButton).Build().Perform();
searchButton.SendKeys(Keys.Enter);
searchButton.Click();
None of these could generate that event. When I click them actually I am able to see that specific event. Are these all soft clicks and could that be the reason of not able to get that event?

How to record a dropdown item which opens when clicked on the image?

In my application I have logout link as it is in gmail account. I have to click on a dropdown image to see the logout link, this is not recording when I am trying to record using sahi tool and I am not able to record the browse and upload event using sahi tool.
Thanks
You can record the items by hold the ctrl button and mouseover the particular item the sahi controller will show the element name in the Accessor text box . Copy that script and paste it in your script file and try to run

Dotnetnuke popup login control with the modalpopupextender

I'm trying to create a modal popup login control for dnn using the ModalPopupExtender in the AjaxToolkit. An issue that I'm running into is that when I click the "Login" button on the popup login form, if the login fails for some reason or if the user needs to update some information before moving on, the modal popup is cleared and the user is never notified that they need to change the information and the login cannot proceed.
Does the ModalPopupExtender provide the ability somehow, to mimic a wizard type of interface so that if my login failed then the next control would be rendered in the popup (e.g. "user must change password"). Someone please help.
You can use the wizard control inside of the modalpopupextender.