public sealed class UiSubjectThe assertions. Every one of them waits.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Named methods rather than Cypress's should("be.visible") strings, because C# can do better than a string: the set is discoverable by typing a dot, a typo is a compile error rather than a test that passes, and each one can take the type its subject actually has.
An assertion holds for every matched element and needs at least one. Both halves matter. Without the second, Get(".error").ShouldBeVisible() passes when nothing matched — vacuously true, and the single most common way a UI suite comes to assert nothing at all. Without the first, an assertion over three elements would have to pick one, and any rule for picking is a rule somebody will be surprised by.
Fields and properties (5)
Methods (42)
public UiSubject ShouldExist()At least one element matches.
public UiSubject ShouldNotExist()Nothing matches.
public UiSubject ShouldHaveCount(int count)Exactly this many match.
public UiSubject ShouldBeVisible()Every match would put ink on the screen.
public UiSubject ShouldNotBeVisible()No match is visible, or nothing matches.
public UiSubject ShouldBeHittable()A click at the centre of every match would actually reach it.
public UiSubject ShouldHaveText(string text)Every match has exactly this text.
public UiSubject ShouldContainText(string text)Every match's text contains this.
public UiSubject ShouldHaveClass(string className)Every match has this class.
public UiSubject ShouldNotHaveClass(string className)No match has this class.
public UiSubject ShouldHaveState(ElementState state)Every match is in this state.
public UiSubject ShouldBeFocused()The one match has the focus.
public UiSubject ShouldHaveStyle(string property, string value)Every match resolves a property to this value, as the cascade recorded it.
public UiSubject ShouldHaveColor(string property, Color4 expected, float tolerance = 0.004)Every match resolves a property to this colour.
public UiSubject ShouldHaveLength(string property, float expected, float tolerance = 0.01)Every match resolves a property to this many pixels.
public UiSubject ShouldMatch(Func<UiElement, bool> predicate, string description)Every match satisfies a predicate.
public UiSubject Click(PointerButton button = Primary, bool force = false)Clicks the middle of it.
public UiSubject DoubleClick(bool force = false)Clicks it twice, close enough together to be a double tap.
public UiSubject RightClick(bool force = false)Clicks it with the right button.
public UiSubject Hover()Moves the pointer onto the middle of it.
public UiSubject Press(PointerButton button = Primary)Presses a button on it and leaves it down.
public UiSubject Release(PointerButton button = Primary)Releases a button where the pointer is.
public UiSubject DragTo(float x, float y)Drags from the middle of it to a point.
public UiSubject DragBy(float deltaX, float deltaY)Drags from the middle of it by an offset.
public UiSubject Pinch(float scale, float rotation = 0, float separation = 40)Puts two fingers on it and pinches, rotates, or both.
public UiSubject Scroll(float deltaX, float deltaY)Turns the wheel over it.
public UiSubject Focus()Gives it the focus.
public UiSubject Blur()Takes the focus away from everything.
public UiSubject Type(string text)Focuses it and types.
public UiSubject PressKey(InputKey key)Focuses it and presses a key.
public UiSubject Find(string selector)Everything under these that matches a selector.
public UiSubject Filter(string selector)Only the ones that also match a selector.
public UiSubject Contains(string text)Only the ones whose text contains this.
public UiSubject Where(Func<UiElement, bool> predicate, string description)Only the ones a predicate likes.
public UiSubject First()The first one.
public UiSubject Last()The last one.
public UiSubject Nth(int index)The one at an index.
public UiSubject Parent()Their parents.
public UiSubject Children()Their immediate children.
public UiSubject Closest(string selector)The nearest ancestor of each — itself included — that matches a selector.
public UiSubject Then(Action<UiElement> action)Waits for exactly one element, then hands it over.
public override string ToString()Returns a string that represents the current object.
Used by (25)
- ControlVisualTestsVixen.Ui.Controls.Tests
- DisabledStateTestsVixen.Ui.Controls.Tests
- InteractionTestsVixen.Ui.Testing.Tests
- NavigationInteractionTestsVixen.Ui.Controls.Tests
- OverlayInteractionTestsVixen.Ui.Controls.Tests
- QueryTestsVixen.Ui.Testing.Tests
- RangeInteractionTestsVixen.Ui.Controls.Tests
- RetryTestsVixen.Ui.Testing.Tests
- ToggleInteractionTestsVixen.Ui.Controls.Tests
- TransformTestsVixen.Ui.Testing.Tests
- UiTestVixen.Ui.Testing
- VisibilityTestsVixen.Ui.Testing.Tests
- DeclaredContributionTestsVixen.Editor.App.Tests
- DropIntoFieldTestsVixen.Editor.App.Tests
- DropIntoSceneTestsVixen.Editor.App.Tests
- EditorAffordanceTestsVixen.Editor.App.Tests
- EditorChromeVisualTestsVixen.Editor.Ui.Tests
- EditorScriptWorkflowTestsVixen.Editor.App.Tests
- EditorSessionVixen.Editor.Testing
- FlameChartViewTestsVixen.Editor.Profiler.Tests
- GridViewTestsVixen.Editor.App.Tests
- MilestoneE5TestsVixen.Editor.App.Tests
- OutOfTreePluginTestsVixen.Editor.App.Tests
- ScenarioTestsVixen.Editor.App.Tests
- ShaderGraphSurfaceTestsVixen.Editor.App.Tests