mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(runner): teach the web fakes to take the step's logs
Claude-Session: https://claude.ai/code/session_01ShuAy8q8ZfPi8KHxwc8JpQ
This commit is contained in:
1 parent
6d72410f55
commit
3dfd5df511
3 files changed
+12
No files matched your search
@@ -75,6 +75,8 @@ func (d *carrierWebDriver) NextActionFromV8(context.Context) (json.RawMessage, e
|
|||||||
|
|
||||||
func (d *carrierWebDriver) SetLastAction(context.Context, json.RawMessage) error { return nil }
|
func (d *carrierWebDriver) SetLastAction(context.Context, json.RawMessage) error { return nil }
|
||||||
|
|
||||||
|
func (d *carrierWebDriver) SetLogs(context.Context, json.RawMessage) error { return nil }
|
||||||
|
|
||||||
// TestRunner_TransitionalStepNeverAdvancesThePageCarrier pins the ordering the
|
// TestRunner_TransitionalStepNeverAdvancesThePageCarrier pins the ordering the
|
||||||
// web path depends on. The page-side extractors must run only on steps the
|
// web path depends on. The page-side extractors must run only on steps the
|
||||||
// verifier accepts: their getters advance spec state every time they evaluate,
|
// verifier accepts: their getters advance spec state every time they evaluate,
|
||||||
@@ -172,6 +174,8 @@ func (d *installFailsWebDriver) SetLastAction(context.Context, json.RawMessage)
|
|||||||
return errors.New("__sanderlingSetLastAction__ is not a function")
|
return errors.New("__sanderlingSetLastAction__ is not a function")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *installFailsWebDriver) SetLogs(context.Context, json.RawMessage) error { return nil }
|
||||||
|
|
||||||
// TestRunner_LastActionInstallFailureFailsTheRun covers the other half of the
|
// TestRunner_LastActionInstallFailureFailsTheRun covers the other half of the
|
||||||
// same trust boundary. A run that cannot install lastAction in the page cannot
|
// same trust boundary. A run that cannot install lastAction in the page cannot
|
||||||
// apply the page's extractor values either, so the step keeps goja's
|
// apply the page's extractor values either, so the step keeps goja's
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ func (d *webMockDriver) NextActionFromV8(context.Context) (json.RawMessage, erro
|
|||||||
|
|
||||||
func (d *webMockDriver) SetLastAction(context.Context, json.RawMessage) error { return nil }
|
func (d *webMockDriver) SetLastAction(context.Context, json.RawMessage) error { return nil }
|
||||||
|
|
||||||
|
func (d *webMockDriver) SetLogs(context.Context, json.RawMessage) error { return nil }
|
||||||
|
|
||||||
// TestRunner_TraceRecordsTheValueTheVerdictUsed fails if the trace and the
|
// TestRunner_TraceRecordsTheValueTheVerdictUsed fails if the trace and the
|
||||||
// verdict disagree about an extractor. A witness is only an explanation of a
|
// verdict disagree about an extractor. A witness is only an explanation of a
|
||||||
// violation if it holds the state the violated property was evaluated against.
|
// violation if it holds the state the violated property was evaluated against.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ globalThis.properties = {};
|
|||||||
type tappingWebDriver struct {
|
type tappingWebDriver struct {
|
||||||
*mockdriver.Driver
|
*mockdriver.Driver
|
||||||
installed []string
|
installed []string
|
||||||
|
installedLogs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *tappingWebDriver) InstallBundle(context.Context, []byte) error { return nil }
|
func (d *tappingWebDriver) InstallBundle(context.Context, []byte) error { return nil }
|
||||||
@@ -44,6 +45,11 @@ func (d *tappingWebDriver) SetLastAction(_ context.Context, encoded json.RawMess
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *tappingWebDriver) SetLogs(_ context.Context, encoded json.RawMessage) error {
|
||||||
|
d.installedLogs = append(d.installedLogs, string(encoded))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func TestRunner_WebInstallsLastActionInThePage(t *testing.T) {
|
func TestRunner_WebInstallsLastActionInThePage(t *testing.T) {
|
||||||
state := newHarnessWithSpec(t, lastActionSpec)
|
state := newHarnessWithSpec(t, lastActionSpec)
|
||||||
web := &tappingWebDriver{Driver: state.mock}
|
web := &tappingWebDriver{Driver: state.mock}
|
||||||
|
|||||||
Reference in new issue
Block a user