Skip to content

Adds Switch component RNTester page treedump tests #9730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
5 commits merged into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions packages/e2e-test-app/test/SwitchComponentTest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
*/

import {dumpVisualTree} from '@react-native-windows/automation-commands';
import {goToComponentExample} from './RNTesterNavigation';

beforeAll(async () => {
await goToComponentExample('Switch');
});

describe('SwitchTests', () => {
test('Switches can be set to true/false, initial false', async () => {
const dump = await dumpVisualTree('on-off-initial-off');
expect(dump).toMatchSnapshot();
});

test('Switches can be set to true/false, initial true', async () => {
const dump = await dumpVisualTree('on-off-initial-on');
expect(dump).toMatchSnapshot();
});

test('Switches can be disabled, initial false', async () => {
const dump = await dumpVisualTree('disabled-initial-off');
expect(dump).toMatchSnapshot();
});

test('Switches can be disabled, initial true', async () => {
const dump = await dumpVisualTree('disabled-initial-on');
expect(dump).toMatchSnapshot();
});

test('Custom colors can be provided, initial false', async () => {
const dump = await dumpVisualTree('initial-false-switch');
expect(dump).toMatchSnapshot();
});

test('Custom colors can be provided, initial true', async () => {
const dump = await dumpVisualTree('initial-true-switch');
expect(dump).toMatchSnapshot();
});

test('Change events can be detected, event top', async () => {
const dump = await dumpVisualTree('event-switch-top');
expect(dump).toMatchSnapshot();
});

test('Change events can be detected, event bottom', async () => {
const dump = await dumpVisualTree('event-switch-bottom');
expect(dump).toMatchSnapshot();
});

test('Change events can be detected, event regression top', async () => {
const dump = await dumpVisualTree('event-switch-regression-top');
expect(dump).toMatchSnapshot();
});

test('Change events can be detected, events regression bottom', async () => {
const dump = await dumpVisualTree('event-switch-regression-bottom');
expect(dump).toMatchSnapshot();
});
test('Controlled switch', async () => {
const dump = await dumpVisualTree('controlled-switch');
expect(dump).toMatchSnapshot();
});
});
Loading