diff --git a/packages/integration-tests/.eslintrc.js b/packages/integration-tests/.eslintrc.js index 7066f43bde55..ac36e30e567f 100644 --- a/packages/integration-tests/.eslintrc.js +++ b/packages/integration-tests/.eslintrc.js @@ -8,4 +8,12 @@ module.exports = { parserOptions: { sourceType: 'module', }, + settings: { + 'import/resolver': { + alias: { + map: [['@utils', './utils']], + extensions: ['.ts', '.js'], + }, + }, + }, }; diff --git a/packages/integration-tests/README.md b/packages/integration-tests/README.md index 98555b642fd0..7f410e839b58 100644 --- a/packages/integration-tests/README.md +++ b/packages/integration-tests/README.md @@ -27,13 +27,17 @@ suites/ ## Writing Tests +### Utils + +Test utilities can be imported using `@utils` alias from tests and test subjects. + ### Helpers -`utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of Playwright usage in helpers. +`@utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of Playwright usage in helpers. ### Fixtures -[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version of `test()` function of Playwright. All the tests should import `sentryTest` function from `utils/fixtures.ts` instead of `@playwright/test` to be able to access the extra fixtures. +[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version of `test()` function of Playwright. All the tests should import `sentryTest` function from `@utils/fixtures` instead of `@playwright/test` to be able to access the extra fixtures. ## Running Tests Locally diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index cea294df2f9e..2e8aa26493e6 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -19,11 +19,13 @@ "test": "playwright test ./suites" }, "dependencies": { - "@playwright/test": "^1.17.0", + "@babel/preset-typescript": "^7.16.7", + "@playwright/test": "^1.18.0-rc1", "babel-loader": "^8.2.2", + "eslint-import-resolver-alias": "^1.1.2", "handlebars-loader": "^1.7.1", "html-webpack-plugin": "^5.5.0", - "playwright": "^1.17.1", + "playwright": "^1.18.0-rc1", "typescript": "^4.5.2", "webpack": "^5.52.0" } diff --git a/packages/integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts b/packages/integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts index e6e2b9a8f4dd..539514ead41c 100644 --- a/packages/integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts +++ b/packages/integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest( 'should add an empty breadcrumb initialized with a timestamp, when an empty object is given', diff --git a/packages/integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts b/packages/integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts index c7bca64aafd5..04b9f3984300 100644 --- a/packages/integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts +++ b/packages/integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should add multiple breadcrumbs', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts b/packages/integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts index 98e36a254076..84ed9e5146c1 100644 --- a/packages/integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts +++ b/packages/integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should add a simple breadcrumb', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts b/packages/integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts index b41f527c58ed..c873f25a4095 100644 --- a/packages/integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts +++ b/packages/integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest( 'should add an empty breadcrumb initialized with a timestamp, when no argument is given', diff --git a/packages/integration-tests/suites/public-api/captureException/empty_obj/test.ts b/packages/integration-tests/suites/public-api/captureException/empty_obj/test.ts index 2606b2984d08..483af3cb2913 100644 --- a/packages/integration-tests/suites/public-api/captureException/empty_obj/test.ts +++ b/packages/integration-tests/suites/public-api/captureException/empty_obj/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should capture an empty object', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/captureException/simple_error/test.ts b/packages/integration-tests/suites/public-api/captureException/simple_error/test.ts index f52e951c20c6..c6078241b5e4 100644 --- a/packages/integration-tests/suites/public-api/captureException/simple_error/test.ts +++ b/packages/integration-tests/suites/public-api/captureException/simple_error/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should capture a simple error with message', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/captureException/undefined_arg/test.ts b/packages/integration-tests/suites/public-api/captureException/undefined_arg/test.ts index 021af6f922f3..074e4944453a 100644 --- a/packages/integration-tests/suites/public-api/captureException/undefined_arg/test.ts +++ b/packages/integration-tests/suites/public-api/captureException/undefined_arg/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should capture an undefined error when no arguments are provided', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/captureMessage/simple_message/test.ts b/packages/integration-tests/suites/public-api/captureMessage/simple_message/test.ts index 7b4b68f228d6..1881848bf546 100644 --- a/packages/integration-tests/suites/public-api/captureMessage/simple_message/test.ts +++ b/packages/integration-tests/suites/public-api/captureMessage/simple_message/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should capture a simple message string', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/captureMessage/with_level/test.ts b/packages/integration-tests/suites/public-api/captureMessage/with_level/test.ts index ba8bb18d729a..f83419819b43 100644 --- a/packages/integration-tests/suites/public-api/captureMessage/with_level/test.ts +++ b/packages/integration-tests/suites/public-api/captureMessage/with_level/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getMultipleSentryRequests } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getMultipleSentryRequests } from '@utils/helpers'; sentryTest('should capture with different severity levels', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/configureScope/clear_scope/test.ts b/packages/integration-tests/suites/public-api/configureScope/clear_scope/test.ts index d8c8bc631553..f0201b906597 100644 --- a/packages/integration-tests/suites/public-api/configureScope/clear_scope/test.ts +++ b/packages/integration-tests/suites/public-api/configureScope/clear_scope/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should clear previously set properties of a scope', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/configureScope/set_properties/test.ts b/packages/integration-tests/suites/public-api/configureScope/set_properties/test.ts index d4001c317d05..07632d2c3b1a 100644 --- a/packages/integration-tests/suites/public-api/configureScope/set_properties/test.ts +++ b/packages/integration-tests/suites/public-api/configureScope/set_properties/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should set different properties of a scope', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setContext/multiple_contexts/test.ts b/packages/integration-tests/suites/public-api/setContext/multiple_contexts/test.ts index 96eecdd38662..e8d782b45ce6 100644 --- a/packages/integration-tests/suites/public-api/setContext/multiple_contexts/test.ts +++ b/packages/integration-tests/suites/public-api/setContext/multiple_contexts/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should record multiple contexts', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setContext/non_serializable_context/test.ts b/packages/integration-tests/suites/public-api/setContext/non_serializable_context/test.ts index fe67bdaff3e7..63309255797f 100644 --- a/packages/integration-tests/suites/public-api/setContext/non_serializable_context/test.ts +++ b/packages/integration-tests/suites/public-api/setContext/non_serializable_context/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should normalize non-serializable context', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setContext/simple_context/test.ts b/packages/integration-tests/suites/public-api/setContext/simple_context/test.ts index 05f534888796..7ade7a526188 100644 --- a/packages/integration-tests/suites/public-api/setContext/simple_context/test.ts +++ b/packages/integration-tests/suites/public-api/setContext/simple_context/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should set a simple context', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setExtra/multiple_extras/test.ts b/packages/integration-tests/suites/public-api/setExtra/multiple_extras/test.ts index 13d8aa83d9c4..4268a6898429 100644 --- a/packages/integration-tests/suites/public-api/setExtra/multiple_extras/test.ts +++ b/packages/integration-tests/suites/public-api/setExtra/multiple_extras/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should record multiple extras of different types', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts b/packages/integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts index eaa9d342e4e8..7f1ca6bcdace 100644 --- a/packages/integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts +++ b/packages/integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should normalize non-serializable extra', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setExtra/simple_extra/test.ts b/packages/integration-tests/suites/public-api/setExtra/simple_extra/test.ts index 352b01191e6e..0ee9c1242968 100644 --- a/packages/integration-tests/suites/public-api/setExtra/simple_extra/test.ts +++ b/packages/integration-tests/suites/public-api/setExtra/simple_extra/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should record a simple extra object', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts b/packages/integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts index 319afc32255b..ca5ca059a1e3 100644 --- a/packages/integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts +++ b/packages/integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should set extras from multiple consecutive calls', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setExtras/multiple_extras/test.ts b/packages/integration-tests/suites/public-api/setExtras/multiple_extras/test.ts index 07a43458e94b..bb7c7e433267 100644 --- a/packages/integration-tests/suites/public-api/setExtras/multiple_extras/test.ts +++ b/packages/integration-tests/suites/public-api/setExtras/multiple_extras/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should record an extras object', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setTag/with_non_primitives/test.ts b/packages/integration-tests/suites/public-api/setTag/with_non_primitives/test.ts index 56843d8f6652..2069690a60d9 100644 --- a/packages/integration-tests/suites/public-api/setTag/with_non_primitives/test.ts +++ b/packages/integration-tests/suites/public-api/setTag/with_non_primitives/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should not accept non-primitive tags', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setTag/with_primitives/test.ts b/packages/integration-tests/suites/public-api/setTag/with_primitives/test.ts index b3c24a8cd2c9..6826b6752ad7 100644 --- a/packages/integration-tests/suites/public-api/setTag/with_primitives/test.ts +++ b/packages/integration-tests/suites/public-api/setTag/with_primitives/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should set primitive tags', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setTags/with_non_primitives/test.ts b/packages/integration-tests/suites/public-api/setTags/with_non_primitives/test.ts index 56843d8f6652..2069690a60d9 100644 --- a/packages/integration-tests/suites/public-api/setTags/with_non_primitives/test.ts +++ b/packages/integration-tests/suites/public-api/setTags/with_non_primitives/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should not accept non-primitive tags', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setTags/with_primitives/test.ts b/packages/integration-tests/suites/public-api/setTags/with_primitives/test.ts index b3c24a8cd2c9..6826b6752ad7 100644 --- a/packages/integration-tests/suites/public-api/setTags/with_primitives/test.ts +++ b/packages/integration-tests/suites/public-api/setTags/with_primitives/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryRequest } from '@utils/helpers'; sentryTest('should set primitive tags', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setUser/unset_user/test.ts b/packages/integration-tests/suites/public-api/setUser/unset_user/test.ts index 045b79597b72..b29153b06b2c 100644 --- a/packages/integration-tests/suites/public-api/setUser/unset_user/test.ts +++ b/packages/integration-tests/suites/public-api/setUser/unset_user/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getMultipleSentryRequests } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getMultipleSentryRequests } from '@utils/helpers'; sentryTest('should unset user', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/setUser/update_user/test.ts b/packages/integration-tests/suites/public-api/setUser/update_user/test.ts index 1520655c8363..5e887c6db6f3 100644 --- a/packages/integration-tests/suites/public-api/setUser/update_user/test.ts +++ b/packages/integration-tests/suites/public-api/setUser/update_user/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getMultipleSentryRequests } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getMultipleSentryRequests } from '@utils/helpers'; sentryTest('should update user', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/showReportDialog/inject-script/test.ts b/packages/integration-tests/suites/public-api/showReportDialog/inject-script/test.ts index e0db0d21cf53..39a30f3bbbe1 100644 --- a/packages/integration-tests/suites/public-api/showReportDialog/inject-script/test.ts +++ b/packages/integration-tests/suites/public-api/showReportDialog/inject-script/test.ts @@ -1,6 +1,5 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; +import { sentryTest } from '@utils/fixtures'; sentryTest('should inject dialog script into
with correct attributes', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/startTransaction/basic_usage/test.ts b/packages/integration-tests/suites/public-api/startTransaction/basic_usage/test.ts index 1dc2eff3febc..5b10f480b55a 100644 --- a/packages/integration-tests/suites/public-api/startTransaction/basic_usage/test.ts +++ b/packages/integration-tests/suites/public-api/startTransaction/basic_usage/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should report a transaction in an envelope', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/public-api/withScope/nested_scopes/test.ts b/packages/integration-tests/suites/public-api/withScope/nested_scopes/test.ts index 7175eb10ae52..61f12ffe9b57 100644 --- a/packages/integration-tests/suites/public-api/withScope/nested_scopes/test.ts +++ b/packages/integration-tests/suites/public-api/withScope/nested_scopes/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getMultipleSentryRequests } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getMultipleSentryRequests } from '@utils/helpers'; sentryTest('should allow nested scoping', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/tracing/browsertracing/meta/test.ts b/packages/integration-tests/suites/tracing/browsertracing/meta/test.ts index 4b73e8724a48..23650e24754c 100644 --- a/packages/integration-tests/suites/tracing/browsertracing/meta/test.ts +++ b/packages/integration-tests/suites/tracing/browsertracing/meta/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest( 'should create a pageload transaction based on `sentry-trace` ', diff --git a/packages/integration-tests/suites/tracing/browsertracing/navigation/test.ts b/packages/integration-tests/suites/tracing/browsertracing/navigation/test.ts index 8e4d51d2724f..c47f80d7efa9 100644 --- a/packages/integration-tests/suites/tracing/browsertracing/navigation/test.ts +++ b/packages/integration-tests/suites/tracing/browsertracing/navigation/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should create a navigation transaction on page navigation', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/tracing/browsertracing/pageload/test.ts b/packages/integration-tests/suites/tracing/browsertracing/pageload/test.ts index e12f793707a0..6fa30512377a 100644 --- a/packages/integration-tests/suites/tracing/browsertracing/pageload/test.ts +++ b/packages/integration-tests/suites/tracing/browsertracing/pageload/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should create a pageload transaction', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts b/packages/integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts index 6dc362a10141..f0892cdd136d 100644 --- a/packages/integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts +++ b/packages/integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts @@ -1,7 +1,6 @@ import { expect } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should add browser-related spans to pageload transaction', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts b/packages/integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts index 9f9a4bd9f994..cdfc2045a0f5 100644 --- a/packages/integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts +++ b/packages/integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts @@ -1,7 +1,6 @@ import { expect, Route } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should add resource spans to pageload transaction', async ({ getLocalTestPath, page }) => { // Intercepting asset requests to avoid network-related flakiness and random retries (on Firefox). diff --git a/packages/integration-tests/suites/tracing/request/fetch/test.ts b/packages/integration-tests/suites/tracing/request/fetch/test.ts index 0358535811c4..3848f6070dac 100644 --- a/packages/integration-tests/suites/tracing/request/fetch/test.ts +++ b/packages/integration-tests/suites/tracing/request/fetch/test.ts @@ -1,7 +1,6 @@ import { expect, Request } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should create spans for multiple fetch requests', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/suites/tracing/request/xhr/test.ts b/packages/integration-tests/suites/tracing/request/xhr/test.ts index d60c86b8ab2a..b3fd57ce7fa5 100644 --- a/packages/integration-tests/suites/tracing/request/xhr/test.ts +++ b/packages/integration-tests/suites/tracing/request/xhr/test.ts @@ -1,7 +1,6 @@ import { expect, Request } from '@playwright/test'; - -import { sentryTest } from '../../../../utils/fixtures'; -import { getSentryTransactionRequest } from '../../../../utils/helpers'; +import { sentryTest } from '@utils/fixtures'; +import { getSentryTransactionRequest } from '@utils/helpers'; sentryTest('should create spans for multiple XHR requests', async ({ getLocalTestPath, page }) => { const url = await getLocalTestPath({ testDir: __dirname }); diff --git a/packages/integration-tests/tsconfig.json b/packages/integration-tests/tsconfig.json index 6c252887a736..320722191d08 100644 --- a/packages/integration-tests/tsconfig.json +++ b/packages/integration-tests/tsconfig.json @@ -5,7 +5,11 @@ "lib": ["dom", "es2019"], "moduleResolution": "node", "noEmit": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "@utils/*": ["./utils/*"] + } }, "include": ["**/*.ts"], "exclude": ["node_modules"] diff --git a/packages/integration-tests/utils/generatePage.ts b/packages/integration-tests/utils/generatePage.ts index 63ddcc3f4ced..53815682e32e 100644 --- a/packages/integration-tests/utils/generatePage.ts +++ b/packages/integration-tests/utils/generatePage.ts @@ -2,7 +2,7 @@ import { Package } from '@sentry/types'; import { existsSync, mkdirSync, promises } from 'fs'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import path from 'path'; -import webpack from 'webpack'; +import { webpack } from 'webpack'; import webpackConfig from '../webpack.config'; @@ -40,6 +40,8 @@ export async function generatePage( const alias = await generateSentryAlias(); + alias['@utils'] = `${__dirname}`; + if (!existsSync(localPath)) { mkdirSync(localPath, { recursive: true }); } diff --git a/packages/integration-tests/webpack.config.ts b/packages/integration-tests/webpack.config.ts index 09084f461974..44f62e029ba9 100644 --- a/packages/integration-tests/webpack.config.ts +++ b/packages/integration-tests/webpack.config.ts @@ -7,9 +7,10 @@ const config = function(userConfig: Record