Skip to content

Can't get to work with BeforeSuite and AfterSuite hooks #1430

@AdamOakman

Description

@AdamOakman

What are you trying to achieve?

Get to work with BeforeSuite and AfterSuite hooks. Simple I.amOnPage('/'); step returns errors in console.

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

CodeceptJS v2.0.1
Using test root "/tests"
Helpers: Protractor
Plugins: screenshotOnFail, allure, autoDelay

TS_005 - Konfigurator - Dodawanie hosta --
    [1] Starting recording promises
    Emitted | suite.before ([object Object])
    Emitted | hook.start ([object Object])
    Emitted | step.before (Ja jestem na_stronie "/")
    Emitted | step.after (Ja jestem na_stronie "/")
    Emitted | step.start (Ja jestem na_stronie "/")
    Context: BeforeSuite
      Ja jestem na_stronie "/"
    [1] Error | TypeError: Cannot read property 'get' of undefined
    Emitted | step.failed (Ja jestem na_stronie "/")
    Emitted | step.finish (Ja jestem na_stronie "/")
    [1] Error | TypeError: Cannot read property 'get' of undefined
    [1] Starting <teardown> session
    Emitted | test.failed ([object Object])
    Error processing test.failed event:
    TypeError: Cannot read property 'end' of undefined
    at Allure.endCase (/codecept/node_modules/allure-js-commons/index.js:50:26)
    at EventEmitter.event.dispatcher.on (/codecept/lib/plugin/allure.js:91:14)
    at EventEmitter.emit (events.js:187:15)
    at Object.emit (/codecept/lib/event.js:49:28)
    at recorder.errHandler (/codecept/lib/scenario.js:99:13)
    at promise.catch (/codecept/lib/recorder.js:173:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, saving screenshot
  ✖ FAILED in 7ms

    Emitted | hook.start ([object Object])
    [2] Starting recording promises
    Emitted | step.before (Ja jestem na_stronie "/")
    Emitted | step.after (Ja jestem na_stronie "/")
    Emitted | step.start (Ja jestem na_stronie "/")
    Context: AfterSuite
      Ja jestem na_stronie "/"
    [2] Error | TypeError: Cannot read property 'get' of undefined
    Emitted | step.failed (Ja jestem na_stronie "/")
    Emitted | step.finish (Ja jestem na_stronie "/")
    [2] Error | TypeError: Cannot read property 'get' of undefined
    [2] Stopping recording promises

Provide test source code if related

Feature('TS_005 - Konfigurator - Dodawanie hosta');

BeforeSuite( (I) => {
	I.amOnPage('/');
	// I.amOnConfigMainPage();
	// I.loginAs('operator');
	// I.addNewClient(client);
});

Before((I) => {
  	I.amOnConfigMainPage();
	I.loginAs('operator');
});

Data(testdata).Scenario('TS_005 - TC_001 - Dodaj hosta', (I, current) => {

	I.addNewHost(current.host, current.client.activeMonitoring);
	I.validateHost(current.host, false);

});

Data(testdata).Scenario('TS_005 - TC_002 - Edytuj hosta', (I, current) => {

	I.editHost(current.host);
	I.validateHost(current.host, true);

});

Data(testdata).Scenario('TS_005 - TC_003 - Usuń hosta', (I, current) => {

	I.deleteHost(current.host);

});

AfterSuite( (I) => {
	I.amOnPage('/');
	// I.amOnConfigMainPage();
	// I.loginAs('operator');
	// I.deleteClient(client);
});

Details

  • CodeceptJS version: v2.0.1
  • NodeJS Version: from docker codeception/codeceptjs
  • Operating System: from docker codeception/codeceptjs
  • Protractor: from docker codeception/codeceptjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions