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

Role - Quarantine mode not working if 'Error in Role initializer' happens #4892

Closed
sijosyn opened this issue Mar 20, 2020 · 2 comments
Closed
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.

Comments

@sijosyn
Copy link

sijosyn commented Mar 20, 2020

What is your Test Scenario?

I have 70+ tests with userRole and runs with quarantine mode on.

What is the Current behavior?

If login page fails to render for an unknown reason (for example due to rendering issue, page fails to load) in the Role initialization sequence. All my tests are marked as failed with 'Error in Role initializer'. I don't see quarantine mode attempt happening in this case. See attached test code.

What is the Expected behavior?

I would like to see quarantine mode happen if error in role initializer occurs until it passes or fails three times.

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
Your complete test code (or attach your test files):
 import { Selector, Role } from 'testcafe';

const user = Role(`http://testing-ground.scraping.pro/login`, async t => {
	let timesRun = 1;	
	await console.log(timesRun++);
	await t.expect(Selector('.xyz').exists).ok('Test should fail here.');
}, { preserveUrl: true });

fixture `My Fixture`

test('test 1', async t => {
	await t
		.useRole(user);
});

test('test 2', async t => {
	await t
		.useRole(user);
});

test('test 3', async t => {
	await t
		.useRole(user);
});

test('test 4', async t => {
	await t
		.useRole(user);
});
Your complete configuration file (if any):

Your complete test report:

Screenshots: Screen Shot 2020-03-20 at 1 05 30 PM

Steps to Reproduce:

  1. Go to my website ...
  2. Execute this command...
  3. See the error...

Your Environment details:

  • testcafe version: 1.8.2
  • node.js version: 12.13.1
  • command-line arguments: testcafe chrome test.js -q
  • browser name and version: Chrome 80
  • platform and version: macOS 10.14
  • 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 Mar 20, 2020
@AlexanderMoiseev
Copy link
Contributor

Hello,

Role is initialized only once. So, a function passed to 'Role' as an argument will be called only once even in quarantine mode. I suggest you move the code that you want to execute in quarantine mode outside of the Role's initialization.

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

lock bot commented Apr 2, 2020

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 Apr 2, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.
Projects
None yet
Development

No branches or pull requests

2 participants