File tree Expand file tree Collapse file tree 6 files changed +63
-0
lines changed
packages/integration-tests/suites/public-api/configureScope Expand file tree Collapse file tree 6 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ Sentry . configureScope ( scope => {
2
+ scope . setTag ( 'foo' , 'bar' ) ;
3
+ scope . setUser ( { id : 'baz' } ) ;
4
+ scope . setExtra ( 'qux' , 'quux' ) ;
5
+ scope . clear ( ) ;
6
+ } ) ;
7
+
8
+ Sentry . captureMessage ( 'cleared_scope' ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+
3
+ import { sentryTest } from '../../../../utils/fixtures' ;
4
+ import { getSentryRequest } from '../../../../utils/helpers' ;
5
+
6
+ sentryTest ( 'should clear previously set properties of a scope' , async ( { getLocalTestPath, page } ) => {
7
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8
+
9
+ const eventData = await getSentryRequest ( page , url ) ;
10
+
11
+ expect ( eventData . message ) . toBe ( 'cleared_scope' ) ;
12
+ expect ( eventData . user ) . toBeUndefined ( ) ;
13
+ expect ( eventData . tags ) . toBeUndefined ( ) ;
14
+ expect ( eventData . extra ) . toBeUndefined ( ) ;
15
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import * as Sentry from '@sentry/browser' ;
2
+
3
+ window . Sentry = Sentry ;
4
+
5
+ Sentry . init ( {
6
+ dsn : 'https://public@dsn.ingest.sentry.io/1337' ,
7
+ } ) ;
Original file line number Diff line number Diff line change
1
+ Sentry . configureScope ( scope => {
2
+ scope . setTag ( 'foo' , 'bar' ) ;
3
+ scope . setUser ( { id : 'baz' } ) ;
4
+ scope . setExtra ( 'qux' , 'quux' ) ;
5
+ } ) ;
6
+
7
+ Sentry . captureMessage ( 'configured_scope' ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+
3
+ import { sentryTest } from '../../../../utils/fixtures' ;
4
+ import { getSentryRequest } from '../../../../utils/helpers' ;
5
+
6
+ sentryTest ( 'should set different properties of a scope' , async ( { getLocalTestPath, page } ) => {
7
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8
+
9
+ const eventData = await getSentryRequest ( page , url ) ;
10
+
11
+ expect ( eventData . message ) . toBe ( 'configured_scope' ) ;
12
+ expect ( eventData . user ) . toMatchObject ( { id : 'baz' } ) ;
13
+ expect ( eventData . tags ) . toMatchObject ( { foo : 'bar' } ) ;
14
+ expect ( eventData . extra ) . toMatchObject ( { qux : 'quux' } ) ;
15
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ <html >
3
+ <head >
4
+ <meta charset =" utf-8" />
5
+ <title ></title >
6
+ <script src =" {{ htmlWebpackPlugin.options.initialization }} " ></script >
7
+ </head >
8
+ <body >
9
+ <script src =" {{ htmlWebpackPlugin.options.subject }} " ></script >
10
+ </body >
11
+ </html >
You can’t perform that action at this time.
0 commit comments