diff --git a/package.json b/package.json index e5c25616..3f23db31 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@react-native-community/eslint-config": "^3.0.3", "@testing-library/jest-native": "^4.0.5", "@testing-library/react-hooks": "^8.0.1", - "@testing-library/react-native": "^9.1.0", + "@testing-library/react-native": "^11.0.0", "@types/aes-js": "^3.1.1", "@types/jest": "^27.5.0", "@types/node": "^18.6.3", diff --git a/src/Main.test.tsx b/src/Main.test.tsx index f2127a3f..45d709a6 100644 --- a/src/Main.test.tsx +++ b/src/Main.test.tsx @@ -40,11 +40,11 @@ describe('Main', () => { handleLogout: jest.fn(), }) - const { getByText, getByA11yLabel } = renderWithTheme(
) + const { getByText, getByLabelText } = renderWithTheme(
) getByText('Optic') getByText('Grant your favorite automated tools an OTP when they need it!') - const login = getByA11yLabel('login') + const login = getByLabelText('login') fireEvent.press(login) expect(handleLoginStub).toHaveBeenCalledTimes(1) diff --git a/src/screens/CreateTokenScreen.test.tsx b/src/screens/CreateTokenScreen.test.tsx index 00fe5b54..45ae2668 100644 --- a/src/screens/CreateTokenScreen.test.tsx +++ b/src/screens/CreateTokenScreen.test.tsx @@ -89,9 +89,9 @@ describe('CreateTokenScreen', () => { }) it('generates a token when description inputted', () => { - const { getByA11yLabel, getByText } = setup() + const { getByLabelText, getByText } = setup() - const descriptionInput = getByA11yLabel('Description') + const descriptionInput = getByLabelText('Description') fireEvent.changeText(descriptionInput, 'A description') fireEvent.press(getByText('Create Token')) expect(apiGenerateTokenStub).toBeCalledTimes(1) diff --git a/src/screens/TokenScreen.test.tsx b/src/screens/TokenScreen.test.tsx index 01820bc4..251f05cd 100644 --- a/src/screens/TokenScreen.test.tsx +++ b/src/screens/TokenScreen.test.tsx @@ -90,7 +90,7 @@ describe('TokenScreen', () => { // Using fake timer as description saving is debounced jest.useFakeTimers() updateSecretStub.mockReset() - const { getByA11yLabel } = setup() + const { getByLabelText } = setup() await waitFor(() => { expect(registerSubscriptionStub).toBeCalled() @@ -98,7 +98,7 @@ describe('TokenScreen', () => { const inputtedDescriptionText = 'An updated description' - const descriptionInput = getByA11yLabel('Description') + const descriptionInput = getByLabelText('Description') fireEvent.changeText(descriptionInput, inputtedDescriptionText) jest.runOnlyPendingTimers() @@ -114,9 +114,9 @@ describe('TokenScreen', () => { jest.useFakeTimers() registerSubscriptionStub.mockReset() updateSecretStub.mockReset() - const { getByA11yLabel } = setup() + const { getByLabelText } = setup() - const descriptionInput = getByA11yLabel('Description') + const descriptionInput = getByLabelText('Description') fireEvent.changeText(descriptionInput, '') jest.runOnlyPendingTimers() diff --git a/src/screens/TokensListScreen.test.tsx b/src/screens/TokensListScreen.test.tsx index c5872e8f..92a95a73 100644 --- a/src/screens/TokensListScreen.test.tsx +++ b/src/screens/TokensListScreen.test.tsx @@ -77,9 +77,9 @@ describe('TokensListScreen', () => { ], })) - const { queryByText, getByA11yLabel } = setup() + const { queryByText, getByLabelText } = setup() - const input = getByA11yLabel('Search') + const input = getByLabelText('Search') fireEvent.changeText(input, 'github') expect(queryByText('My github token')).toBeTruthy() expect(queryByText('My NPM token')).toBeFalsy() @@ -98,9 +98,9 @@ describe('TokensListScreen', () => { ], })) - const { queryByText, getByA11yLabel } = setup() + const { queryByText, getByLabelText } = setup() - const input = getByA11yLabel('Search') + const input = getByLabelText('Search') fireEvent.changeText(input, 'hkkdoeuagk') expect(queryByText('My github token')).toBeTruthy() expect(queryByText('My NPM token')).toBeFalsy() diff --git a/src/screens/TypeScreen.test.tsx b/src/screens/TypeScreen.test.tsx index 632f4e3d..962168a6 100644 --- a/src/screens/TypeScreen.test.tsx +++ b/src/screens/TypeScreen.test.tsx @@ -29,9 +29,9 @@ describe('TypeScreen', () => { add: addStub, }) - const { getByA11yLabel } = setup() + const { getByLabelText } = setup() - fireEvent.press(getByA11yLabel('Add secret')) + fireEvent.press(getByLabelText('Add secret')) expect(addStub).toHaveBeenCalledTimes(0) }) @@ -43,13 +43,13 @@ describe('TypeScreen', () => { add: addStub, }) - const { getByA11yLabel } = setup() + const { getByLabelText } = setup() - fireEvent.changeText(getByA11yLabel('Issuer'), 'Issuer A') - fireEvent.changeText(getByA11yLabel('Secret'), 'mysecret') - fireEvent.changeText(getByA11yLabel('Account'), 'My Account') + fireEvent.changeText(getByLabelText('Issuer'), 'Issuer A') + fireEvent.changeText(getByLabelText('Secret'), 'mysecret') + fireEvent.changeText(getByLabelText('Account'), 'My Account') - fireEvent.press(getByA11yLabel('Add secret')) + fireEvent.press(getByLabelText('Add secret')) expect(addStub).toHaveBeenCalledTimes(1) expect(addStub).toHaveBeenCalledWith({ diff --git a/yarn.lock b/yarn.lock index 727d6b3b..5e7d780c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2664,12 +2664,12 @@ "@babel/runtime" "^7.12.5" react-error-boundary "^3.1.0" -"@testing-library/react-native@^9.1.0": - version "9.1.0" - resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-9.1.0.tgz#500698b4ae5ade98211cdea0ffd97d823c61c3ac" - integrity sha512-YBCSOIMYlh8gI0VG7ExRe80hNpfhC+i7j0cvpwiopUYtbpft8bMJXO35A4zEk7BkiWXEq6bYZ7VDJR3muSLhyQ== +"@testing-library/react-native@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-11.0.0.tgz#604cd14a42331ce01f2b3695aeb9abf73940183b" + integrity sha512-2WZF8P8YYXO5Ka1yzj3TZUg4x6noKU5RuCpx4oAhKBkxkVbrRl1pMCvRIozdTPSiru4rNBmAi074ZJjm2OED5g== dependencies: - pretty-format "^27.0.0" + pretty-format "^28.1.3" "@tootallnate/once@1": version "1.1.2" @@ -8776,6 +8776,16 @@ pretty-format@^27.0.0, pretty-format@^27.3.1, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" +pretty-format@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" + integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== + dependencies: + "@jest/schemas" "^28.1.3" + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^18.0.0" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -8964,6 +8974,11 @@ react-is@^16.13.0, react-is@^16.13.1, react-is@^16.7.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + react-native-codegen@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.0.6.tgz#b3173faa879cf71bfade8d030f9c4698388f6909"