Skip to content

Commit

Permalink
EDSC-3937: Fixes playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
macrouch committed Jul 12, 2024
1 parent 421fab8 commit d3c4f40
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 45 deletions.
3 changes: 3 additions & 0 deletions playwright.config.cjs → playwright.config.js
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions sharedUtils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import secretConfig from '../secret.config.json'
// eslint-disable-next-line import/no-unresolved
import overrideConfig from '../overrideStatic.config.json'

// const merge = async (...args) => import('lodash-es').then(({ merge: _merge }) => _merge(...args))

Check failure on line 9 in sharedUtils/config.js

View workflow job for this annotation

GitHub Actions / eslint (lts/hydrogen)

Comments should not begin with a lowercase character

const getConfig = () => {
try {
const merged = merge(staticConfig, overrideConfig)
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/authentication/authentication.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/collection_list/collection_list.spec.js
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down
66 changes: 33 additions & 33 deletions tests/e2e/map/map.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions tests/support/getAuthHeaders.js
Original file line number Diff line number Diff line change
@@ -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
})

0 comments on commit d3c4f40

Please sign in to comment.