Testing with Detox and Expo RN. Start my e2e test in second screen - testing

I'm new with e2e detox test.
I'm trying to figure out how to test different screens one by one.
But there's a way to test for example one screen (for example contact) without say "login inside app", "click contact menu button", "contact screen is shown" ??
I only want to do some test like if I start in Contact form "contact form is visible", "fill contact form and click button"
Can I do that or include it in beforeAll or beforeEach functions??

Related

how to fix, blank page when trying to use history push in react native

I am working on a APP, where I created a button that navigates you to other page. I imported react native router and use history from react-router dom.
I created seperated folder with login routs (when user is on login screen he can move to sign-up)
Loginrouts.js :
than I created login.js where the button is, it uses useHistory.push() and it calls signup from loginroute.js
But when button is pressed it only shows blank screen, anyone knows why?

Clicking anchor tags does not navigate to target destinations

Issue:
Clicking some anchor elements in a mobile device using Chrome's device emulator fails to navigate to target links.
Here I'm trying to test the behavior of switching the style of product cells from grid view to list view by clicking an icon which is an anchor tag with an href that contains the parameter "disp=list".
Right now clicking the icon does nothing, and the same behavior can be seen in click actions performed on other anchor elements in the navigation bar.
Everything works as expected when I test manually in my chrome emulator and saucelabs but fails when I try with testcafe which shouldn't make a difference since it uses my locally installed browser.
page to test
Command:
testcafe "chrome:emulation:device=iphone X" path-to-file.js
Browser/OS:
Chrome 75.0.3770 / Mac OS X 10.14.5
Here's the test:
fixture`[mobile] navigation`
.page('https://tw.bid.yahoo.com/search/auction/product?qt=product&kw=iphone&p=iphone')
test
('Clicking the view button should switch item cell view', async t => {
await t
.click(Selector('.ViewSwitchButton__viewButton___1r1Kh.MobileNavigation__menuButton___1OVvQ'))
.expect(getPageUrl()).contains('disp=list')
})
clicking the view style icon should update the page from grid view to list view with the url updated to https://tw.bid.yahoo.com/search/auction/product?disp=list&kw=iphone&p=iphone&refine=-prop_3%2C-prop_2
I've reproduced this behavior under "testcafe-hammerhead" proxy. Here is an issue you can track: https://github.com/DevExpress/testcafe-hammerhead/issues/2080.
The fix was included in TestCafe v1.6.0.

Test razorpay payment flow using cypress

I am trying to use cypress for testing my Razorpay payment flow in my ROR project.I am able to get fields in iframe,select a bank and click on "Pay rs 399 now".On clicking the "Pay now button" a new window opens up which has two options to make the payment success OR fail it.Everything till now is already tested in cypress...My question is how do I access the new window opened using cypress and click "success"
I HAVE TRIED:
As I was not able to access the new window.I tried adding a random razorpay_payment_id and amount and passing it directly using "POST" request to my "update" action in the Subscription Controller.But alas!!! this action chks if razorpay_payment_id is present and if present fetches it like
payment = Razorpay::Payment.fetch(params[:razorpay_payment_id]).
capture({ amount: params[:amount] })
which errs to "The id provided does not exist"
Also tried:
refered this question to access the new window...But got an err "Expected "open" to be called at least once.But was never called"
Please help!!
here are the images for ref
(1)this image shows the razorpay modal before i finally click on pay button
(2)here is the new window which opens when I click PAY.

How to handle popup window using selenium webdriver with Java

Please help, I'm new in Selenium. I try to automate eCommerce website and I have problem to handle popup window. Here is the scenario:
Go to http://www.lampsplus.com
Click on Sale link in the header section.
Click on the 1st item/product displayed on the page. (This will show the product page).
On the product page, click on the red Add To Cart button. (This will add a product to cart and display a popup).
On the popup, click the dark-grey Continue Shopping button. (This will close the popup.)
I stuck on step 5 (Error message: Unable to locate element "Continue shopping button")
Here is my code before step 5:
WebDriver d1 = new FirefoxDriver();
d1.manage().window().maximize();
d1.get("http://www.lampsplus.com");
d1.findElement(By.name("hdr_sale")).click();
d1.findElement(By.xpath(".//*[#id='sortResultContainer60238']/a[2]/span")).click();
d1.findElement(By.id("pdAddToCart")).click(); //This is step 4
//Here is suppose to be some code which handles the popup - my problem
d1.findElement(By.id("aContinueShopping")).click(); //This is step 5
I'm aware about .getWindowHandle(); method. I tried several variations of it and none of them worked.
Can anyone give me an idea how to handle it. Many thanks! I use Java.
Note: I don't work for LampsPlus and not try to promote their products, this website was chosen for training purposes only.
The element aContinueShopping is contained within an iframe.
You'll have to switch to the iframe using:
WebElement frameID = d1.findElement(By.Css("#add-to-cart>iframe"));
d1.SwitchTo().Frame(frameID);
d1.findElement(By.id("aContinueShopping")).click();
There's no 'name' or 'id' on the iframe, so you'll have to use a WebElement or a numeric to find it.
Once you're done with that iframe, you'll switch back to 'top' by using:
d1.SwitchTo().DefaultContent();

Facebook Javascript SDK Issue

I am implementing Facebook javascript SDK on my site. I have a few issues with it.
First of all there are two instantiations of code on one page. One is a login button and other is the comment box. Now if i sign-In from the login button the commentBox does not update until the page is refreshed. What i want is that both of the widgets should update if one signs-In from any of them.
The second issue is with the login Button. I have implemented a onlogin function in it. What it is doing is that it calls the onlogin function even if i cancel to login when the login dialog appears after clicking the FAcebook login button.
If any one of you wants to visit the page. Here it is http://bit.ly/lIMjAf