testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Test controller from Fixture passing to TESTS

Open avi0711 opened this issue 7 years ago • 2 comments

Hello I am using one condition( if else loop) to use different URLs based on the env. I am mentioning this in fixture.beforeEach(..) and want to hit the URLs in TESTS based on the outcome

fixture('Verifying') .beforeEach(async t =>{ console.log("Execution Started "); const args = minimist(process.argv.slice(2)); var environment = args.env; if(environment == 'Test') { t.ctx.Connectionstring=config.Test.Connectionstring; t.ctx.Url=config.Test.Url; } else if(environment == 'Stage') { t.ctx.Connectionstring=config.Stage.Connectionstring; t.ctx.Url=config.Stage.Url; } else if(environment == 'Prod') { t.ctx.Connectionstring=config.Prod.Connectionstring; t.ctx.Url=config.Prod.Url; }

test.page(t.ctx.Url) ("TC1 - Report Batches", async t => {

await t

.typeText(lgpage.username, 'abc)
.typeText(lgpage.password,'abc')
.click(lgpage.submit)

})

test.page(t.ctx.Url) doesnot work. Even if i give fixture.page(t.ctx.Url) doesnot work both the time it is giving the error:

"Cannot implicitly resolve the test run in the context of which the test controller action should be executed. Use test function's 't' argument instead."

I also tried navigateTo(t.ctx.Url) this doesnot work.

avi0711 avatar Aug 22 '19 19:08 avi0711

Hi @avi0711

I've already answered this question in this StackOverflow thread.

We try to keep the GitHub issues tracker for bugs and feature requests only (see also: Contributing. So, if you have any questions, please ask them using StackOverflow and don't duplicate them on GitHub.

miherlosev avatar Aug 23 '19 11:08 miherlosev

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[bot] avatar Sep 02 '19 12:09 lock[bot]