You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to play around with CodeceptJS, having never actually used Mocha or anything similar before. Mocha's docs seem to indicate that you can set up nested tests using describe() and it(). It looks like Codecept's Feature() and Scenario() are an alternative method to setting up Mocha's Suites. Is there a similar way to set up nested tests using CodeceptJS? For example, something vaguely like:
Feature('Test1');Before((I)=>{// or BackgroundI.amOnPage('/');});Scenario('Interact with the login page ',(I)=>{Feature("Test 1 - Part 1");Scenario("Filling in login form shows consent banner",()=>{I.see('Username');I.dontSee("You are accessing");I.fillField("httpd_username","user1");I.fillField("httpd_password","pw1");I.see("You are accessing");});Feature("Test 1 - Part 2");Scenario('Can log in successfully',()=>{I.see('Username');I.fillField("httpd_username","user1");I.fillField("httpd_password","pw1");I.click('Agree and Log In');I.wait(1);I.dontSee("Username");});});
Hmm. That's kind of disappointing, particularly since Mocha does support nesting suites.
Here's my use case. Right now, with that I.amOnPage('/'); in Before(), Codecept appears to be bringing up a separate browser instance for every test. That's taking around 15s or so to execute a test.
I'd really like to be able to use a single Webdriver / browser instance for a series of tests. Beyond that, I'd like to be able to, say, run an initial test verifying that logging in works, then run additional tests after that that require having successfully logged in.
Again, I'm very new to actual automated testing and to Codecept, but that seems like a pretty useful scenario to support.
Here's my use case. Right now, with that I.amOnPage('/'); in Before(), Codecept appears to be bringing up a separate browser instance for every test. That's taking around 15s or so to execute a test.
Thanks for the idea. We will add option to reuse instance of a browser.
Beyond that, I'd like to be able to, say, run an initial test verifying that logging in works, then run additional tests after that that require having successfully logged in.
This concept is somehow harder to implement. As you will probably have LOTS of tests where user is logged in (and probably in different files) and one test for a login. Probably this will require something like dependency tree for tests.
But in the end, I think that you don't need nested structures for this kind of tests. Yes, mocha support them, but CodeceptJS is about scenario-driven testing so it's better to keep it linear.
I had the same issue, I hate waiting for the browser to open and close. What I did was that I created a script that concatenates many files into one and puts all my different file test into a single test all contained in the same Scenario(), this way I can test memory leaks in my app on the browser.
So far it works great. I can share you my script if you want.
Activity
DavertMik commentedon Dec 10, 2015
Right now we don't provide any kind of nesting.
And there is no something like that in nearest plans. One feature per file for now.
markerikson commentedon Dec 10, 2015
Hmm. That's kind of disappointing, particularly since Mocha does support nesting suites.
Here's my use case. Right now, with that
I.amOnPage('/');inBefore(), Codecept appears to be bringing up a separate browser instance for every test. That's taking around 15s or so to execute a test.I'd really like to be able to use a single Webdriver / browser instance for a series of tests. Beyond that, I'd like to be able to, say, run an initial test verifying that logging in works, then run additional tests after that that require having successfully logged in.
Again, I'm very new to actual automated testing and to Codecept, but that seems like a pretty useful scenario to support.
DavertMik commentedon Dec 15, 2015
Thanks for the idea. We will add option to reuse instance of a browser.
This concept is somehow harder to implement. As you will probably have LOTS of tests where user is logged in (and probably in different files) and one test for a login. Probably this will require something like dependency tree for tests.
But in the end, I think that you don't need nested structures for this kind of tests. Yes, mocha support them, but CodeceptJS is about scenario-driven testing so it's better to keep it linear.
arsa666 commentedon Jan 8, 2016
Hello markerikson
I had the same issue, I hate waiting for the browser to open and close. What I did was that I created a script that concatenates many files into one and puts all my different file test into a single test all contained in the same Scenario(), this way I can test memory leaks in my app on the browser.
So far it works great. I can share you my script if you want.
adrianblynch commentedon Jan 11, 2016
Would be nice to see your script. I wonder how much time you're saving doing it this way?
Nighthawk14 commentedon Jul 22, 2016
@markerikson That may interest you #167
DavertMik commentedon Jan 23, 2017
I think this can be closed as all helpers have
restart: falseoption which can be used to reuse browser session