Skip to content

Commit

Permalink
split project-related e2e tests into smaller subsets
Browse files Browse the repository at this point in the history
This was long overdue - I should have done this while splitting the
sprawling blob of monolithing e2e runs into subsets, but well, better
now than never. Project-related tests within API e2e tests were among
the longest-running, and the split by concern in this commit should
make each subset more manageable (for example, leading to shorter run
times if needing to trigger a new run of a subset manually because of
spurious failures in CI).
  • Loading branch information
hotzevzl committed Oct 9, 2023
1 parent 1713425 commit 905d98f
Show file tree
Hide file tree
Showing 30 changed files with 98 additions and 90 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/tests-api-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ jobs:
- 'implicit-permissions'
- 'integration'
- 'legacy-project-import'
- 'project'
- 'projects/blm-calibration'
- 'projects/crud'
- 'projects/project-feature-tags'
- 'projects/user-projects'
- 'projects/cost-surfaces'
- 'projects/project-cloning'
- 'projects/project-scenario-comparison'
- 'projects/project-summaries'
- 'projects/published-projects'
- 'project-jobs-status'
- 'project-planning-areas-tiles'
- 'project-planning-units'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { E2E_CONFIG } from '../e2e.config';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { E2E_CONFIG } from '../../e2e.config';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';
import * as request from 'supertest';
import { CommandBus } from '@nestjs/cqrs';
import { SetProjectBlm } from '@marxan-api/modules/projects/blm/set-project-blm';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bootstrapApplication } from '../utils/api-application';
import { bootstrapApplication } from '../../utils/api-application';
import {
getEntityManagerToken,
getRepositoryToken,
Expand All @@ -13,8 +13,8 @@ import {
ScenariosPuCostDataGeo,
} from '@marxan/scenarios-planning-unit';
import { DbConnections } from '@marxan-api/ormconfig.connections';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { GivenUserExists } from '../../steps/given-user-exists';
import { EntityManager, Repository } from 'typeorm';
import { Project } from '@marxan-api/modules/projects/project.api.entity';
import { Organization } from '@marxan-api/modules/organizations/organization.api.entity';
Expand All @@ -24,15 +24,15 @@ import {
} from '@marxan-api/modules/cost-surface/cost-surface.api.entity';
import { UsersProjectsApiEntity } from '@marxan-api/modules/access-control/projects-acl/entity/users-projects.api.entity';
import { ProjectRoles } from '@marxan-api/modules/access-control/projects-acl/dto/user-role-project.dto';
import { GivenProjectExists } from '../steps/given-project';
import { GivenProjectsPu } from '../../../geoprocessing/test/steps/given-projects-pu-exists';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenProjectsPu } from '../../../../geoprocessing/test/steps/given-projects-pu-exists';
import * as request from 'supertest';
import { HttpStatus } from '@nestjs/common';
import { Scenario } from '@marxan-api/modules/scenarios/scenario.api.entity';
import { CqrsModule } from '@nestjs/cqrs';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';
import { CostSurfaceDeleted } from '@marxan-api/modules/cost-surface/events/cost-surface-deleted.event';
import { FakeQueue } from '../utils/queues';
import { FakeQueue } from '../../utils/queues';
import { unusedResourcesCleanupQueueName } from '@marxan/unused-resources-cleanup';

export const getProjectCostSurfaceFixtures = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { FixtureType } from '@marxan/utils/tests/fixture-type';
import { getEntityManagerToken, getRepositoryToken } from '@nestjs/typeorm';
import * as request from 'supertest';
import { EntityManager, Repository } from 'typeorm';
import { GivenProjectExists } from '../steps/given-project';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { GeoFeature } from '@marxan-api/modules/geo-features/geo-feature.api.entity';
import { v4 } from 'uuid';
import {
Expand All @@ -13,11 +13,11 @@ import {
} from '@marxan-api/modules/scenarios/scenario.api.entity';
import { ProjectRoles } from '@marxan-api/modules/access-control/projects-acl/dto/user-role-project.dto';
import { UsersProjectsApiEntity } from '@marxan-api/modules/access-control/projects-acl/entity/users-projects.api.entity';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenScenarioFeaturesData } from '../../../geoprocessing/test/integration/cloning/fixtures';
import { GivenUserExists } from '../../steps/given-user-exists';
import { GivenScenarioFeaturesData } from '../../../../geoprocessing/test/integration/cloning/fixtures';
import { GeoFeatureGeometry } from '@marxan/geofeatures';
import { apiConnections } from '@marxan-api/ormconfig';
import { GivenScenarioExists } from '../steps/given-scenario-exists';
import { GivenScenarioExists } from '../../steps/given-scenario-exists';
import { DbConnections } from '@marxan-api/ormconfig.connections';

let fixtures: FixtureType<typeof getFixtures>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { E2E_CONFIG } from '../e2e.config';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { E2E_CONFIG } from '../../e2e.config';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';
import * as request from 'supertest';
import { CqrsModule } from '@nestjs/cqrs';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';
import { ProjectDeleted } from '@marxan-api/modules/projects/events/project-deleted.event';

export const getFixtures = async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FixtureType } from '@marxan/utils/tests/fixture-type';
import { getFixtures } from './projects.fixtures';
import { getFixtures } from '../projects.fixtures';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpStatus } from '@nestjs/common';
import { E2E_CONFIG } from './e2e.config';
import { TestClientApi } from './utils/test-client/test-client-api';
import { E2E_CONFIG } from '../../e2e.config';
import { TestClientApi } from '../../utils/test-client/test-client-api';
import { Repository } from 'typeorm';
import { CostSurface } from '@marxan-api/modules/cost-surface/cost-surface.api.entity';
import { getRepositoryToken } from '@nestjs/typeorm';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { E2E_CONFIG } from '../e2e.config';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { E2E_CONFIG } from '../../e2e.config';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';
import * as request from 'supertest';
import { ProjectChecker } from '@marxan-api/modules/projects/project-checker/project-checker.service';
import { ProjectCheckerFake } from '../utils/project-checker.service-fake';
import { ProjectCheckerFake } from '../../utils/project-checker.service-fake';
import { HttpStatus } from '@nestjs/common';

export const getFixtures = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import { isLeft } from 'fp-ts/lib/These';
import { Readable } from 'stream';
import * as request from 'supertest';
import { DataSource, Repository } from 'typeorm';
import { GivenProjectExists } from '../steps/given-project';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenUserExists } from '../../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { isLeft } from 'fp-ts/lib/These';
import { Readable } from 'stream';
import * as request from 'supertest';
import { Repository } from 'typeorm';
import { GivenProjectExists } from '../steps/given-project';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenUserExists } from '../../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { isLeft } from 'fp-ts/lib/These';
import { Readable } from 'stream';
import * as request from 'supertest';
import { Repository } from 'typeorm';
import { GivenProjectExists } from '../steps/given-project';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenUserExists } from '../../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import { Readable } from 'stream';
import * as request from 'supertest';
import { DataSource } from 'typeorm';
import { v4 } from 'uuid';
import { ExportId } from '../../src/modules/clone';
import { ExportRepository } from '../../src/modules/clone/export/application/export-repository.port';
import { ManifestFileService } from '../../src/modules/clone/export/application/manifest-file-service.port';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { EventBusTestUtils } from '../utils/event-bus.test.utils';
import { ExportId } from '../../../src/modules/clone';
import { ExportRepository } from '../../../src/modules/clone/export/application/export-repository.port';
import { ManifestFileService } from '../../../src/modules/clone/export/application/manifest-file-service.port';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { EventBusTestUtils } from '../../utils/event-bus.test.utils';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { FixtureType } from '@marxan/utils/tests/fixture-type';
import { getRepositoryToken } from '@nestjs/typeorm';
import * as request from 'supertest';
import { Repository } from 'typeorm';
import { ProjectChecker } from '../../src/modules/projects/project-checker/project-checker.service';
import { ScenarioChecker } from '../../src/modules/scenarios/scenario-checker/scenario-checker.service';
import { GivenProjectExists } from '../steps/given-project';
import { GivenScenarioExists } from '../steps/given-scenario-exists';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../utils/api-application';
import { ProjectCheckerFake } from '../utils/project-checker.service-fake';
import { ScenarioCheckerFake } from '../utils/scenario-checker.service-fake';
import { FakeQueue } from '../utils/queues';
import { exportPieceQueueToken } from '../../src/modules/clone/infra/export/export-queue.provider';
import { ProjectChecker } from '../../../src/modules/projects/project-checker/project-checker.service';
import { ScenarioChecker } from '../../../src/modules/scenarios/scenario-checker/scenario-checker.service';
import { GivenProjectExists } from '../../steps/given-project';
import { GivenScenarioExists } from '../../steps/given-scenario-exists';
import { GivenUserExists } from '../../steps/given-user-exists';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { ProjectCheckerFake } from '../../utils/project-checker.service-fake';
import { ScenarioCheckerFake } from '../../utils/scenario-checker.service-fake';
import { FakeQueue } from '../../utils/queues';
import { exportPieceQueueToken } from '../../../src/modules/clone/infra/export/export-queue.provider';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { ILike, Repository } from 'typeorm';
import { Project } from '@marxan-api/modules/projects/project.api.entity';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Organization } from '@marxan-api/modules/organizations/organization.api.entity';
import { GeoFeature } from '@marxan-api/modules/geo-features/geo-feature.api.entity';
import { GeoFeatureTag } from '@marxan-api/modules/geo-feature-tags/geo-feature-tag.api.entity';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { E2E_CONFIG } from '../e2e.config';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { E2E_CONFIG } from '../../e2e.config';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';
import * as request from 'supertest';

import { ProjectRoles } from '@marxan-api/modules/access-control/projects-acl/dto/user-role-project.dto';
import { UsersProjectsApiEntity } from '@marxan-api/modules/access-control/projects-acl/entity/users-projects.api.entity';
import { GivenUserExists } from '../steps/given-user-exists';
import { GivenUserExists } from '../../steps/given-user-exists';
import { tagMaxlength } from '@marxan-api/modules/geo-feature-tags/dto/update-geo-feature-tag.dto';
import { GeoFeaturesService } from '@marxan-api/modules/geo-features';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FixtureType } from '@marxan/utils/tests/fixture-type';
import { getFixtures } from './projects.fixtures';
import { getFixtures } from '../projects.fixtures';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { ProjectsPuEntity } from '@marxan-jobs/planning-unit-geometry';
import { parseStream } from 'fast-csv';
import { Readable } from 'stream';
import { DbConnections } from '@marxan-api/ormconfig.connections';
import { bootstrapApplication } from '../utils/api-application';
import { GivenScenarioPuData } from '../../../geoprocessing/test/steps/given-scenario-pu-data-exists';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenScenarioPuData } from '../../../../geoprocessing/test/steps/given-scenario-pu-data-exists';
import { Scenario } from '@marxan-api/modules/scenarios/scenario.api.entity';
import { Project } from '@marxan-api/modules/projects/project.api.entity';
import { Organization } from '@marxan-api/modules/organizations/organization.api.entity';
import { Parse, ParseStream } from 'unzipper';
import { GivenProjectsPu } from '../../../geoprocessing/test/steps/given-projects-pu-exists';
import { GivenProjectsPu } from '../../../../geoprocessing/test/steps/given-projects-pu-exists';
import { CostSurface } from '@marxan-api/modules/cost-surface/cost-surface.api.entity';

let fixtures: PromiseType<ReturnType<typeof getFixtures>>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn, userObj } from '../steps/given-user-is-logged-in';
import { GivenUserIsCreated } from '../steps/given-user-is-created';
import { GivenProjectExists } from '../steps/given-project';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn, userObj } from '../../steps/given-user-is-logged-in';
import { GivenUserIsCreated } from '../../steps/given-user-is-created';
import { GivenProjectExists } from '../../steps/given-project';
import { Repository } from 'typeorm';
import { getRepositoryToken } from '@nestjs/typeorm';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn, userObj } from '../steps/given-user-is-logged-in';
import { GivenProjectExists } from '../steps/given-project';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn, userObj } from '../../steps/given-user-is-logged-in';
import { GivenProjectExists } from '../../steps/given-project';
import { Repository } from 'typeorm';
import { getRepositoryToken } from '@nestjs/typeorm';
import * as archiver from 'archiver';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FixtureType } from '@marxan/utils/tests/fixture-type';
import { getFixtures } from './projects.fixtures';
import { getFixtures } from '../projects.fixtures';

let fixtures: FixtureType<typeof getFixtures>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { bootstrapApplication } from '../utils/api-application';
import { GivenUserIsLoggedIn } from '../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../utils/organizations.test.utils';
import { ProjectsTestUtils } from '../utils/projects.test.utils';
import { bootstrapApplication } from '../../utils/api-application';
import { GivenUserIsLoggedIn } from '../../steps/given-user-is-logged-in';
import { OrganizationsTestUtils } from '../../utils/organizations.test.utils';
import { ProjectsTestUtils } from '../../utils/projects.test.utils';
import * as request from 'supertest';

export const getFixtures = async () => {
Expand Down

0 comments on commit 905d98f

Please sign in to comment.