From 4fcec02c7370adbc654e388ac76017dc20400839 Mon Sep 17 00:00:00 2001 From: lupusA Date: Wed, 13 Mar 2024 20:42:04 +0100 Subject: [PATCH] Preliminary fix tests. Tests are extened in a another PR. --- src/tests/Preferences.test.js | 14 +- .../__snapshots__/Preferences.test.js.snap | 1047 +++++++++++++++++ 2 files changed, 1053 insertions(+), 8 deletions(-) diff --git a/src/tests/Preferences.test.js b/src/tests/Preferences.test.js index 6ea6ad9..6149df3 100644 --- a/src/tests/Preferences.test.js +++ b/src/tests/Preferences.test.js @@ -25,7 +25,6 @@ describe('Calling the preference page', () => { }) }) - /** * */ @@ -33,10 +32,9 @@ describe('Select the light theme', () => { test('Should select light theme', () => { userEvent.selectOptions( screen.getByTestId('themeSelector'), - screen.getByRole('option', { name: "light" })); - - expect(screen.getByRole('option', { name: "light" }).selected).toBe(true) + screen.getByRole('option', { name: "theme.light" })); + expect(screen.getByRole('option', { name: "theme.light" }).selected).toBe(true) expect(wrapper).toMatchSnapshot(); }) }) @@ -46,8 +44,8 @@ describe('Select the light theme', () => { */ describe('Test number of themes', () => { test('Should have four themes', () => { - let theme = screen.getByRole('combobox', { name: "Theme" }); - expect(theme).toHaveLength(4); + let selector = screen.getByTestId('themeSelector'); + expect(selector).toHaveLength(4); expect(wrapper).toMatchSnapshot(); }) }) @@ -57,8 +55,8 @@ describe('Test number of themes', () => { */ describe('Test byte representation', () => { test('Should have two options', () => { - let theme = screen.getByRole('combobox', { name: "Byte representation" }); - expect(theme).toHaveLength(2); + let selector = screen.getByTestId('bytesBaseInput'); + expect(selector).toHaveLength(2); expect(wrapper).toMatchSnapshot(); }) }) \ No newline at end of file diff --git a/src/tests/__snapshots__/Preferences.test.js.snap b/src/tests/__snapshots__/Preferences.test.js.snap index 25d20bc..b6f90f0 100644 --- a/src/tests/__snapshots__/Preferences.test.js.snap +++ b/src/tests/__snapshots__/Preferences.test.js.snap @@ -348,3 +348,1050 @@ Object { "unmount": [Function], } `; + +exports[`Select the light theme Should select light theme 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
+ , + "container":
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`Test byte representation Should have two options 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
+ , + "container":
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`Test number of themes Should have four themes 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
+ , + "container":
+
+
+ + + + theme.help + +
+
+
+ + + + user.interface.byte.representation.help + +
+
+
+ + + + user.interface.appearance.help + +
+
+
+ + + + user.interface.pagesize.help + +
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`;