-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
135 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
describe('Read the LPA', () => { | ||
it('displays the LPA details with actor specific content', () => { | ||
cy.visit('/fixtures/attorney?redirect=/read-the-lpa'); | ||
it('displays the LPA details with actor specific content', () => { | ||
cy.visit('/fixtures/attorney?redirect=/read-the-lpa'); | ||
|
||
cy.contains('dt', "When attorneys can use the LPA") | ||
cy.contains('dt', "Attorney names") | ||
cy.contains('dt', "Replacement attorney names") | ||
cy.contains('Donor: Sam Smith'); | ||
cy.contains('Certificate provider: Charlie Cooper'); | ||
cy.contains('Attorney: Jessie Jones'); | ||
cy.contains('Trust corporation attorney: First Choice Trust Corporation Ltd.'); | ||
cy.contains('Replacement attorney: Blake Buckley'); | ||
cy.contains('Replacement trust corporation attorney: Second Choice Trust Corporation Ltd.'); | ||
cy.contains('Signed by Sam Smith on: 2 January 2023'); | ||
cy.contains('Witnessed by Charlie Cooper on: 2 January 2023'); | ||
cy.contains('Signed by Charlie Cooper on: 2 January 2023'); | ||
|
||
cy.contains('Continue').click(); | ||
cy.contains('Continue').click(); | ||
|
||
cy.url().should('contain', '/task-list'); | ||
}); | ||
cy.url().should('contain', '/task-list'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package telemetry | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/eventbridge" | ||
"github.com/aws/smithy-go/middleware" | ||
"go.opentelemetry.io/otel/attribute" | ||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
func AppendMiddlewares(list *[]func(*middleware.Stack) error) { | ||
*list = append(*list, func(stack *middleware.Stack) error { | ||
return stack.Initialize.Add(middleware.InitializeMiddlewareFunc("appInitializeMiddlewareAfter", | ||
func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (middleware.InitializeOutput, middleware.Metadata, error) { | ||
span := trace.SpanFromContext(ctx) | ||
|
||
switch v := in.Parameters.(type) { | ||
case *eventbridge.PutEventsInput: | ||
if len(v.Entries) == 1 { | ||
span.SetAttributes(attribute.String("aws.operation", "PutEvents "+*v.Entries[0].DetailType)) | ||
span.SetAttributes(semconv.CloudeventsEventSource(*v.Entries[0].Source)) | ||
span.SetAttributes(semconv.CloudeventsEventType(*v.Entries[0].DetailType)) | ||
} | ||
} | ||
|
||
return next.HandleInitialize(ctx, in) | ||
}, | ||
), middleware.After) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package telemetry | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
|
||
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
type SlogHandler struct { | ||
handler slog.Handler | ||
} | ||
|
||
func NewSlogHandler(h slog.Handler) slog.Handler { | ||
return &SlogHandler{handler: h} | ||
} | ||
|
||
func (h *SlogHandler) Enabled(ctx context.Context, level slog.Level) bool { | ||
return h.handler.Enabled(ctx, level) | ||
} | ||
|
||
func (h *SlogHandler) Handle(ctx context.Context, record slog.Record) error { | ||
spanCtx := trace.SpanContextFromContext(ctx) | ||
if spanCtx.HasTraceID() { | ||
traceID := spanCtx.TraceID() | ||
record.AddAttrs(slog.String("trace_id", traceID.String())) | ||
} | ||
|
||
session, err := appcontext.SessionFromContext(ctx) | ||
if err == nil { | ||
record.AddAttrs(slog.String("session_id", session.SessionID)) | ||
|
||
if session.OrganisationID != "" { | ||
record.AddAttrs(slog.String("organisation_id", session.OrganisationID)) | ||
} | ||
} | ||
|
||
return h.handler.Handle(ctx, record) | ||
} | ||
|
||
func (h *SlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { | ||
return NewSlogHandler(h.handler.WithAttrs(attrs)) | ||
} | ||
|
||
func (h *SlogHandler) WithGroup(name string) slog.Handler { | ||
return NewSlogHandler(h.handler.WithGroup(name)) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters