-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test / fix e2e overlapping reports #495
base: develop
Are you sure you want to change the base?
Conversation
Visit the preview URL for this PR (updated for commit d8f0b21): https://ottwebapp--pr495-fix-e2e-overlapping-on02e5ih.web.app (expires Sat, 11 May 2024 11:58:55 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c198f8a3a199ba8747819f7f1e45cf602b777529 |
I was playing with a different idea. It is possible to customise the parallel execution of tests in CodeceptJS. Creating a folder for all integration tests and running these with different configurations would be a nice and scalable solution.
These suites will have to be split for two integration options: const integrations = ['jpw', 'cleeng'];
// Create two configs and inject the integration (name for now)
const configs = integrations.map((integrationName) => ({
inject: {
integrationName,
},
}));
// for each integration, spawn a worker and register the test group containing all integration tests
// can also be split over multiple workers...
for (const config of configs) {
const worker = workers.spawn();
worker.addTests(testGroups[0]);
worker.addConfig(config);
} The rest of the files are spread over multiple workers like normal and don't need any special configuration. |
Feature(`account - ${providerName}`).retry(Number(process.env.TEST_RETRY_COUNT) || 0); | ||
|
||
Before(async ({ I }) => { | ||
async function beforeScenario(I: CodeceptJS.I) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it not work to just move the Before
to the top level where you moved Feature
? This seems like an otherwise nice, simple enough fix, but I wish we didn't need to copy all the await beforeScenario
calls. Seems too easy to forget to add when you create a new Scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, Before depends on the runTestSuite args...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the beforeScenario
much either, we could also make this a custom step: I.amLoggedIn(config);
We also might be able to refactor the accountContext
to a shared value. We can then remove that from each test as well.
@ChristiaanScheermeijer This looks promising and more maintainable to me. Any downsides? |
I was playing with this yesterday and I got it (almost) working. The run workers script does feel a bit too custom because I have to trick codecept into duplicating the integration tests with a different config. The biggest downside is that the e2e tests will only test 1 integration when you run them via the UI or with steps (easier to debug). This is because the run-workers script changes the codecept config before spawning them. This is what I got so far: I created two integration configurations because injection works via The codecept config can either have a predefined },
},
include: {
I: './utils/steps_file.ts',
integration: `./configs/jwp`,
},
bootstrap: null, The // Create two configs and inject the integration (name for now)
const configs = integrations.map((integrationName) => ({
include: {
integration: `./configs/${integrationName}`,
},
})); Currently, 4 workers are spawned, but this needs to be worked out a bit more: for (const config of configs) {
for (const group of testGroups) {
const worker = workers.spawn();
worker.addTests(group);
worker.addConfig(config);
worker.addOptions({ config: __dirname + '/codecept.desktop.ts', verbose: true });
}
} The challenge here is to balance everything out. If we only create two workers for the integrations, the rest of the tests are distributed over the remainder of the workers. However, we could also run the non-integration tests on the integration-configured worker... |
@dbudzins do you think this idea still has potential? We are looking into optimizing the e2e tests (duration), but this might change based on this outcome. |
Hm, it's getting a bit fiddly now.... it looks like just splitting the files fixes the reporting issue. It's kinda annoying, but seems like a quick easy fix: #503 For whatever reason it also looks like they still won't run in parallel, but since there are a lot of tests to run, I think this will shake out in the wash. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChristiaanScheermeijer both approaches ("as is" AND "separate files in 503") are fine for us. You can choose the one which is easier to maintain. Having custom workers logic looks too complex for our case.
@ChristiaanScheermeijer any preference here? |
Description
Because we use a function to wrap the JWP and Cleeng scenarios, the CodeceptJS run workers' reporting fails. The reporter instance exists only once for each worker and it creates two Allure runs within the same instance because of the duplicate
Feature(`subscription - ${providerName}`)
calls.I've played with data-driven tests, but this will run all steps sequentially.
The easiest fix was to either remove the
Feature
andBefore
calls from therunTestSuite
functions so it only creates 1 test run.After this change, the Allure reporting will show all the scenarios before this was the last one completed.
https://github.com/codeceptjs/allure-legacy/blob/8c31bd2d0736487edaa7d92a813562b2571cef49/index.js#L180-L182
Calls:
The culprit... This function only returns the first suite: