diff --git a/playwright.config.cjs b/playwright.config.js similarity index 97% rename from playwright.config.cjs rename to playwright.config.js index b325c8fa6f..b4f21091b5 100644 --- a/playwright.config.cjs +++ b/playwright.config.js @@ -1,5 +1,8 @@ import { defineConfig, devices } from '@playwright/test' +/** + * @see https://playwright.dev/docs/test-configuration + */ export default defineConfig({ testDir: './tests', /* Run tests in files in parallel */ diff --git a/tests/e2e/authentication/authentication.spec.js b/tests/e2e/authentication/authentication.spec.js index 330087f458..394ae8890d 100644 --- a/tests/e2e/authentication/authentication.spec.js +++ b/tests/e2e/authentication/authentication.spec.js @@ -3,9 +3,9 @@ import { test, expect } from 'playwright-test-coverage' import { login } from '../../support/login' import { testJwtToken } from '../../support/getJwtToken' -import graphQlHeaders from './__mocks__/graphql.headers.json' with { type: 'json' } -import getSubscriptionsGraphQlBody from './__mocks__/getSubscriptions.graphql.body.json' with { type: 'json' } -import collectionFixture from './__mocks__/authenticated_collections.json' with { type: 'json' } +import graphQlHeaders from './__mocks__/graphql.headers.json' +import getSubscriptionsGraphQlBody from './__mocks__/getSubscriptions.graphql.body.json' +import collectionFixture from './__mocks__/authenticated_collections.json' // At the default size, react-window will render 6 items const expectedCollectionCount = 6 diff --git a/tests/e2e/collection_list/collection_list.spec.js b/tests/e2e/collection_list/collection_list.spec.js index d652261c90..3adf9de92a 100644 --- a/tests/e2e/collection_list/collection_list.spec.js +++ b/tests/e2e/collection_list/collection_list.spec.js @@ -1,6 +1,6 @@ import { test, expect } from 'playwright-test-coverage' -import singleCollection from './__mocks__/single_collection.json' with { type: 'json' } +import singleCollection from './__mocks__/single_collection.json' test.describe('Collection List Behavior', () => { test.beforeEach(async ({ page }) => { diff --git a/tests/e2e/map/map.spec.js b/tests/e2e/map/map.spec.js index f88300fa82..97f8e815f3 100644 --- a/tests/e2e/map/map.spec.js +++ b/tests/e2e/map/map.spec.js @@ -5,40 +5,40 @@ import { interceptUnauthenticatedCollections } from '../../support/interceptUnauthenticatedCollections' -import boundingBoxBody from './__mocks__/bounding_box_collections.body.json' with { type: 'json' } -import circleBody from './__mocks__/circle_collections.body.json' with { type: 'json' } -import cmrGranulesBody from './__mocks__/cmr_granules/granules.body.json' with { type: 'json' } -import cmrGranulesCollectionBody from './__mocks__/cmr_granules/collections.body.json' with { type: 'json' } -import cmrGranulesCollectionGraphQlBody from './__mocks__/cmr_granules/collection_graphql.body.json' with { type: 'json' } -import colormapOneBody from './__mocks__/colormaps/colormap_1.body.json' with { type: 'json' } -import colormapTwoBody from './__mocks__/colormaps/colormap_2.body.json' with { type: 'json' } -import colormapCollectionsBody from './__mocks__/colormaps/collections.body.json' with { type: 'json' } -import colormapGranulesOneBody from './__mocks__/colormaps/granules_1.body.json' with { type: 'json' } -import colormapGranulesTwoBody from './__mocks__/colormaps/granules_2.body.json' with { type: 'json' } -import colormapGranulesHeaders from './__mocks__/colormaps/granules.headers.json' with { type: 'json' } -import colormapCollectionOneGraphQlBody from './__mocks__/colormaps/collection_graphql_1.body.json' with { type: 'json' } -import colormapCollectionTwoGraphQlBody from './__mocks__/colormaps/collection_graphql_2.body.json' with { type: 'json' } -import colormapCollectionGraphQlHeaders from './__mocks__/colormaps/graphql.headers.json' with { type: 'json' } -import granuleGraphQlBody from './__mocks__/cmr_granules/granule_graphql.body.json' with { type: 'json' } -import cmrGranulesCollectionGraphQlHeaders from './__mocks__/cmr_granules/graphql.headers.json' with { type: 'json' } -import cmrGranulesHeaders from './__mocks__/cmr_granules/granules.headers.json' with { type: 'json' } -import commonBody from './__mocks__/common_collections.body.json' with { type: 'json' } -import commonHeaders from './__mocks__/common_collections.headers.json' with { type: 'json' } -import multipleShapesShapefileBody from './__mocks__/multiple_shapes_shapefile_collections.body.json' with { type: 'json' } +import boundingBoxBody from './__mocks__/bounding_box_collections.body.json' +import circleBody from './__mocks__/circle_collections.body.json' +import cmrGranulesBody from './__mocks__/cmr_granules/granules.body.json' +import cmrGranulesCollectionBody from './__mocks__/cmr_granules/collections.body.json' +import cmrGranulesCollectionGraphQlBody from './__mocks__/cmr_granules/collection_graphql.body.json' +import colormapOneBody from './__mocks__/colormaps/colormap_1.body.json' +import colormapTwoBody from './__mocks__/colormaps/colormap_2.body.json' +import colormapCollectionsBody from './__mocks__/colormaps/collections.body.json' +import colormapGranulesOneBody from './__mocks__/colormaps/granules_1.body.json' +import colormapGranulesTwoBody from './__mocks__/colormaps/granules_2.body.json' +import colormapGranulesHeaders from './__mocks__/colormaps/granules.headers.json' +import colormapCollectionOneGraphQlBody from './__mocks__/colormaps/collection_graphql_1.body.json' +import colormapCollectionTwoGraphQlBody from './__mocks__/colormaps/collection_graphql_2.body.json' +import colormapCollectionGraphQlHeaders from './__mocks__/colormaps/graphql.headers.json' +import granuleGraphQlBody from './__mocks__/cmr_granules/granule_graphql.body.json' +import cmrGranulesCollectionGraphQlHeaders from './__mocks__/cmr_granules/graphql.headers.json' +import cmrGranulesHeaders from './__mocks__/cmr_granules/granules.headers.json' +import commonBody from './__mocks__/common_collections.body.json' +import commonHeaders from './__mocks__/common_collections.headers.json' +import multipleShapesShapefileBody from './__mocks__/multiple_shapes_shapefile_collections.body.json' import opensearchGranulesBody from './__mocks__/opensearch_granules/granules_body' -import opensearchGranulesCollectionBody from './__mocks__/opensearch_granules/collections.body.json' with { type: 'json' } -import opensearchGranulesCollectionGraphQlBody from './__mocks__/opensearch_granules/graphql.body.json' with { type: 'json' } -import opensearchGranulesCollectionGraphQlHeaders from './__mocks__/opensearch_granules/graphql.headers.json' with { type: 'json' } -import opensearchGranulesHeaders from './__mocks__/opensearch_granules/granules.headers.json' with { type: 'json' } -import opensearchGranulesTimelineBody from './__mocks__/opensearch_granules/timeline.body.json' with { type: 'json' } -import opensearchGranulesTimelineHeaders from './__mocks__/opensearch_granules/timeline.headers.json' with { type: 'json' } -import pointBody from './__mocks__/point_collections.body.json' with { type: 'json' } -import pointBodyEdited from './__mocks__/point_collections_edited.body.json' with { type: 'json' } -import polygonBody from './__mocks__/polygon_collections.body.json' with { type: 'json' } -import simpleShapefileBody from './__mocks__/simple_shapefile_collections.body.json' with { type: 'json' } -import tooManyPointsShapefileBody from './__mocks__/too_many_points_shapefile_collections.body.json' with { type: 'json' } -import arcticShapefileBody from './__mocks__/arctic_shapefile_collections.body.json' with { type: 'json' } -import antarcticShapefileBody from './__mocks__/antarctic_shapefile_collections.body.json' with { type: 'json' } +import opensearchGranulesCollectionBody from './__mocks__/opensearch_granules/collections.body.json' +import opensearchGranulesCollectionGraphQlBody from './__mocks__/opensearch_granules/graphql.body.json' +import opensearchGranulesCollectionGraphQlHeaders from './__mocks__/opensearch_granules/graphql.headers.json' +import opensearchGranulesHeaders from './__mocks__/opensearch_granules/granules.headers.json' +import opensearchGranulesTimelineBody from './__mocks__/opensearch_granules/timeline.body.json' +import opensearchGranulesTimelineHeaders from './__mocks__/opensearch_granules/timeline.headers.json' +import pointBody from './__mocks__/point_collections.body.json' +import pointBodyEdited from './__mocks__/point_collections_edited.body.json' +import polygonBody from './__mocks__/polygon_collections.body.json' +import simpleShapefileBody from './__mocks__/simple_shapefile_collections.body.json' +import tooManyPointsShapefileBody from './__mocks__/too_many_points_shapefile_collections.body.json' +import arcticShapefileBody from './__mocks__/arctic_shapefile_collections.body.json' +import antarcticShapefileBody from './__mocks__/antarctic_shapefile_collections.body.json' import uploadShapefile from '../../support/uploadShapefile' // When testing map values we don't need to test the exact values coming from leaflet. The inconsistencies diff --git a/tests/support/getAuthHeaders.js b/tests/support/getAuthHeaders.js index 0ac8d2cbc0..a22fa18f35 100644 --- a/tests/support/getAuthHeaders.js +++ b/tests/support/getAuthHeaders.js @@ -1,12 +1,8 @@ -import { getEnvironmentConfig } from '../../sharedUtils/config' +import { testJwtToken } from './getJwtToken' /** * Returns common authentication headers for integration tests */ -export const getAuthHeaders = () => { - const { jwtToken } = getEnvironmentConfig('test') - - return { - 'jwt-token': jwtToken - } -} +export const getAuthHeaders = () => ({ + 'jwt-token': testJwtToken +})