Skip to content

Nested test structures? #20

@markerikson

Description

@markerikson

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 Background
  I.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");
  });
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions