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

Testcafe scripts always switches to newly opened window #3762

Closed
saiparth opened this issue Apr 30, 2019 · 2 comments
Closed

Testcafe scripts always switches to newly opened window #3762

saiparth opened this issue Apr 30, 2019 · 2 comments
Labels
AREA: client SYSTEM: window management TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@saiparth
Copy link

What is your Test Scenario?

browse the page which has pop up blocker checker on load and observe that testcafe switches to pop up blocker checker window instead of main page

What is the Current behavior?

Test cafe switches to newly opened window instead of staying in browsed page

What is the Expected behavior?

It should switch to window if we have script to that. or at least i should be able to close the other window

What is your web application and your TestCafe test code?

https://pegasus5.qa.pegasus.pearsoncmg.com/Pegasus/frmLogin.aspx?s=3

 import { ClientFunction } from 'testcafe';

fixture `My second fixture`
    .page `https://pegasus5.qa.pegasus.pearsoncmg.com/Pegasus/frmLogin.aspx?s=3`;
   
    const getLocation = ClientFunction(() => window.location.href);
    test('second test', async t => {
        await t
        //.expect(getLocation()).contains('about:blank')
        //.expect(getLocation()).contains('pegasus')
        .wait(15000);
        //await (()=>window.close());
            //const goBack=ClientFunction(()=>window.history.back());
            //await goBack();
            //await t.expect(getLocation()).contains('pegasus');
           await t.typeText('#username','test')
            .click('#mainButton');
    });

Steps to Reproduce:

  1. run the above code
  2. it will browse the url ,now there is a pop up blocker window which opens and closes automatically when i browse manually.if i run through test cafe,it will switch to that pop up and blank page will be loaded
  3. I tried using window.close ,window.history etc...but whatever I may do,it will browse and switch to newly opened window and i cant proceed further

Environment details:

  • testcafe version: 0.20.5
  • node.js version: v10.0.0
  • command-line arguments:
  • browser name and version: chrome 73
  • platform and version: win 10
  • other:
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Apr 30, 2019
@miherlosev miherlosev self-assigned this May 2, 2019
@miherlosev
Copy link
Collaborator

Hi @saiparth
 
The site uses the window.open function to detect the way how to display popups.
At present, TestCafe doesn't support work with sites whose code contains the window.open call for the main browser window.
 
As a workaround, you can modify the 'checkPopUpEnabled' function from https://e2e-comms-stg.pearson.com/osbrowserchecker/stg/checker-module.min.js to not use the window.open function during testing.
 
Also, you can track #912 to be notified of progress with the implementation.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label May 2, 2019
@lock
Copy link

lock bot commented May 12, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label May 12, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2019
@miherlosev miherlosev added AREA: client SYSTEM: window management TYPE: bug The described behavior is considered as wrong (bug). and removed STATE: Auto-locked An issue has been automatically locked by the Lock bot. labels Feb 14, 2020
@miherlosev miherlosev reopened this Feb 14, 2020
@miherlosev miherlosev removed their assignment Feb 14, 2020
@miherlosev miherlosev added this to the Sprint #51 milestone Feb 14, 2020
miherlosev added a commit to miherlosev/testcafe that referenced this issue Feb 19, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #51, Sprint #52 Feb 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client SYSTEM: window management TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

3 participants