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
As of now we are having issues understanding how the After hook works, since we have 2 .steps.files, one being the common.steps.ts and other called home.steps.ts in which we have an After hook defined that simply waits for (5) seconds after each of the steps is executed.
Now if we run some tests that involve steps JUST from common_steps.ts and nothing from the home.steps.ts (where we have the After hook), the hook itself is being executed as if it were part of the first mentioned here, or more likely seemingly being executed globally as if it were defined in some kind of Global.steps.ts or something like that which is not the case.
Are we kinda getting the overall usage of the After hook? or it is intended that every After hook defined in any .steps file or any other test related script will be executed in each and every test from that point onward?
My home.steps.ts file looks something like this:
import { TestData } from "@testinghouse/self-helpers"
import { testrailFlags } from "../../services/Integration/functions/testrail.flags";
const { I } = inject();
Given("we update flags for users", async () => {
let testData:TestData = await I.grabTestData()
await testRailFlags.getTestRailConfig()
await I.setFlag(testData["flagName"], testData["projectId"], testData["markedAsDone"]);
})
Then("we validate that the flags are marked as Done", async () => {
let testData:TestData = await I.grabTestData()
await I.verifyFlagValues(testData["flagName"], testData["projectId"])
})
After(() => {
I.wait(5)
})
And my common_steps, looks like this:
import { TestData } from "@testinghouse/self-helpers"
const {mobileHomePage, testRailServices, I} = inject();
import * as common_testrail_services from '../../services/Commons/common_testrail_services';
Given('that I successfully log in', async () => {
let testData: TestData = await I.grabTestData()
await login(testData.userID, testData.password)
await testRailServices.storeAccessToken();
})
Then('the project list is generated', async () => {
let testData: TestData = await I.grabTestData()
await testRailServices.getProjectList()
await testRailServices.sortByProjectID();
})
let login = async (userID: string, password: string) => {
await testRailServices.doLogin()
}
export = {login}
And finally my test .feature file looks like this:
@mobile
Feature: TestRail Flag changes POC
Test programmatic flag changes
@testRail
Scenario: Flags are updated based on parameters
Given that I successfully log in
Then the project list is generated
And with this, even though no single step from the home.steps.ts is being used, the after hook for 5s is still being executed, which seems kinda off.
Hope that I was clear enough with my question and hopefully someone can shed some light on us about this behavior to know how to re-route our efforts having that in mind.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As of now we are having issues understanding how the After hook works, since we have 2 .steps.files, one being the common.steps.ts and other called home.steps.ts in which we have an After hook defined that simply waits for (5) seconds after each of the steps is executed.
Now if we run some tests that involve steps JUST from common_steps.ts and nothing from the home.steps.ts (where we have the After hook), the hook itself is being executed as if it were part of the first mentioned here, or more likely seemingly being executed globally as if it were defined in some kind of Global.steps.ts or something like that which is not the case.
Are we kinda getting the overall usage of the After hook? or it is intended that every After hook defined in any .steps file or any other test related script will be executed in each and every test from that point onward?
My home.steps.ts file looks something like this:
And my common_steps, looks like this:
And finally my test .feature file looks like this:
And with this, even though no single step from the home.steps.ts is being used, the after hook for 5s is still being executed, which seems kinda off.
Hope that I was clear enough with my question and hopefully someone can shed some light on us about this behavior to know how to re-route our efforts having that in mind.
Best Regards and thanks!
Beta Was this translation helpful? Give feedback.
All reactions