CLD-5949 Upgrade Detox and E2E dependencies (#7553)

* upgrade detox and e2e dependencies

* update detox in main package.json

* remove inadvertent addition of "react-devtools"

* remove inadvertent addition of "react-devtools"
This commit is contained in:
Saturnino Abril 2023-09-27 15:56:34 +08:00 committed by GitHub
parent 5225aa3756
commit 1121cca649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1868 additions and 1599 deletions

View file

@ -19,6 +19,7 @@ class Alert {
return isAndroid() ? element(by.text(title)) : element(by.label(title)).atIndex(0);
};
deletePostTitle = isAndroid() ? element(by.text('Delete Post')) : element(by.label('Delete Post')).atIndex(0);
invalidSslCertTitle = isAndroid() ? element(by.text('Invalid SSL certificate')) : element(by.label('Invalid SSL certificate')).atIndex(0);
leaveChannelTitle = isAndroid() ? element(by.text('Leave channel')) : element(by.label('Leave channel')).atIndex(0);
logoutTitle = (serverDisplayName: string) => {
const title = `Are you sure you want to log out of ${serverDisplayName}?`;
@ -27,6 +28,7 @@ class Alert {
};
markAllAsReadTitle = isAndroid() ? element(by.text('Are you sure you want to mark all threads as read?')) : element(by.label('Are you sure you want to mark all threads as read?')).atIndex(0);
messageLengthTitle = isAndroid() ? element(by.text('Message Length')) : element(by.label('Message Length')).atIndex(0);
notificationsCannotBeReceivedTitle = isAndroid() ? element(by.text('Notifications cannot be received from this server')) : element(by.label('Notifications cannot be received from this server')).atIndex(0);
removeServerTitle = (serverDisplayName: string) => {
const title = `Are you sure you want to remove ${serverDisplayName}?`;
@ -47,6 +49,7 @@ class Alert {
noButton = isAndroid() ? element(by.text('NO')) : element(by.label('No')).atIndex(0);
noButton2 = isAndroid() ? element(by.text('NO')) : element(by.label('No')).atIndex(1);
okButton = isAndroid() ? element(by.text('OK')) : element(by.label('OK')).atIndex(1);
okayButton = isAndroid() ? element(by.text('Okay')) : element(by.label('Okay')).atIndex(1);
removeButton = isAndroid() ? element(by.text('REMOVE')) : element(by.label('Remove')).atIndex(0);
removeButton1 = isAndroid() ? element(by.text('REMOVE')) : element(by.label('Remove')).atIndex(1);
removeButton2 = isAndroid() ? element(by.text('REMOVE')) : element(by.label('Remove')).atIndex(2);

View file

@ -1,6 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Alert} from '@support/ui/component';
import {isAndroid, isIos, timeouts, wait} from '@support/utils';
import {expect} from 'detox';
@ -52,6 +53,12 @@ class ServerScreen {
}
if (isIos()) {
await this.tapConnectButton();
if (serverUrl.includes('127.0.0.1')) {
// # Tap alert okay button
await waitFor(Alert.okayButton).toExist().withTimeout(timeouts.TEN_SEC);
await Alert.okayButton.tap();
}
}
};

View file

@ -8,11 +8,12 @@
// *******************************************************************
import {serverOneUrl} from '@support/test_config';
import {Alert} from '@support/ui/component';
import {
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {timeouts, wait} from '@support/utils';
import {isIos, timeouts, wait} from '@support/utils';
import {expect} from 'detox';
describe('Server Login - Connect to Server', () => {
@ -33,6 +34,8 @@ describe('Server Login - Connect to Server', () => {
await ServerScreen.toBeVisible();
// # Clear fields
await expect(serverUrlInput).toBeVisible();
await expect(serverDisplayNameInput).toBeVisible();
await serverUrlInput.clearText();
await serverDisplayNameInput.clearText();
});
@ -67,6 +70,7 @@ describe('Server Login - Connect to Server', () => {
it('MM-T4676_3 - should show invalid url error on invalid server url', async () => {
// # Connect with invalid server url and non-empty server display name
const invalidServerUrl = 'invalid';
await device.setURLBlacklist([invalidServerUrl]);
await serverUrlInput.replaceText(invalidServerUrl);
await serverDisplayNameInput.replaceText('Server 1');
await connectButton.tap();
@ -78,27 +82,32 @@ describe('Server Login - Connect to Server', () => {
});
it('MM-T4676_4 - should show connection error on invalid ssl or invalid host', async () => {
await device.reloadReactNative();
// # Connect with invalid ssl and non-empty server display name
const connectionError = 'Cannot connect to the server.';
await serverUrlInput.replaceText('expired.badssl.com');
const expiredServerUrl = 'expired.badssl.com';
const wrongHostServerUrl = 'wrong.host.badssl.com';
await device.setURLBlacklist([expiredServerUrl, wrongHostServerUrl]);
await serverUrlInput.replaceText(expiredServerUrl);
await serverDisplayNameInput.replaceText('Server 1');
await connectButton.tap();
await wait(timeouts.ONE_SEC);
// * Verify connection error
await waitFor(serverUrlInputError).toExist().withTimeout(timeouts.TEN_SEC);
await expect(serverUrlInputError).toHaveText(connectionError);
// * Verify invalid SSL cert error
await waitFor(Alert.invalidSslCertTitle).toExist().withTimeout(timeouts.TEN_SEC);
await Alert.okButton.tap();
// # Connect with invalid host and valid server display name
await device.reloadReactNative();
await serverUrlInput.replaceText('wrong.host.badssl.com');
await serverUrlInput.replaceText(wrongHostServerUrl);
await serverDisplayNameInput.replaceText('Server 1');
await connectButton.tap();
await wait(timeouts.ONE_SEC);
// * Verify connection error
await waitFor(serverUrlInputError).toExist().withTimeout(timeouts.TEN_SEC);
await expect(serverUrlInputError).toHaveText(connectionError);
// * Verify invalid SSL cert error
await waitFor(Alert.invalidSslCertTitle).toExist().withTimeout(timeouts.TEN_SEC);
await Alert.okButton.tap();
});
it('MM-T4676_5 - should show login screen on successful connection to server', async () => {
@ -108,6 +117,12 @@ describe('Server Login - Connect to Server', () => {
await connectButton.tap();
await wait(timeouts.ONE_SEC);
if (isIos()) {
// # Tap alert okay button
await waitFor(Alert.okayButton).toExist().withTimeout(timeouts.TEN_SEC);
await Alert.okayButton.tap();
}
// * Verify on login screen
await LoginScreen.toBeVisible();
});

3347
detox/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,44 +5,39 @@
"author": "Mattermost, Inc.",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-transform-modules-commonjs": "7.22.5",
"@babel/plugin-transform-runtime": "7.22.5",
"@babel/preset-env": "7.22.5",
"@jest/test-sequencer": "29.5.0",
"@types/jest": "29.5.2",
"@types/tough-cookie": "4.0.2",
"@types/uuid": "9.0.2",
"aws-sdk": "2.1398.0",
"axios": "1.4.0",
"axios-cookiejar-support": "4.0.6",
"babel-jest": "29.5.0",
"@babel/plugin-transform-modules-commonjs": "7.22.15",
"@babel/plugin-transform-runtime": "7.22.15",
"@babel/preset-env": "7.22.20",
"@jest/test-sequencer": "29.7.0",
"@types/jest": "29.5.5",
"@types/tough-cookie": "4.0.3",
"@types/uuid": "9.0.4",
"aws-sdk": "2.1462.0",
"axios": "1.5.0",
"axios-cookiejar-support": "4.0.7",
"babel-jest": "29.7.0",
"babel-plugin-module-resolver": "5.0.0",
"client-oauth2": "4.3.3",
"deepmerge": "4.3.1",
"detox": "20.9.1",
"detox": "20.11.4",
"form-data": "4.0.0",
"jest": "29.5.0",
"jest-circus": "29.5.0",
"jest-cli": "29.5.0",
"jest": "29.7.0",
"jest-circus": "29.7.0",
"jest-cli": "29.7.0",
"jest-html-reporters": "3.1.4",
"jest-junit": "16.0.0",
"jest-stare": "2.5.0",
"jest-stare": "2.5.1",
"junit-report-merger": "6.0.2",
"moment-timezone": "0.5.43",
"recursive-readdir": "2.2.3",
"sanitize-filename": "1.6.3",
"shelljs": "0.8.5",
"tough-cookie": "4.1.3",
"ts-jest": "29.1.0",
"tslib": "2.5.3",
"typescript": "5.1.3",
"uuid": "9.0.0",
"xml2js": "0.5.0"
},
"overrides": {
"detox": {
"jest": "^29.1.0"
}
"ts-jest": "29.1.1",
"tslib": "2.6.2",
"typescript": "5.2.2",
"uuid": "9.0.1",
"xml2js": "0.6.2"
},
"scripts": {
"e2e:android-create-emulator": "./create_android_emulator.sh",

26
package-lock.json generated
View file

@ -151,7 +151,7 @@
"babel-loader": "9.1.3",
"babel-plugin-module-resolver": "5.0.0",
"deep-freeze": "0.0.1",
"detox": "20.11.3",
"detox": "20.11.4",
"eslint": "8.47.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.28.0",
@ -6969,9 +6969,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "16.11.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz",
"integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA=="
"version": "16.18.53",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.53.tgz",
"integrity": "sha512-vVmHeo4tpF8zsknALU90Hh24VueYdu45ZlXzYWFbom61YR4avJqTFDC3QlWzjuTdAv6/3xHaxiO9NrtVZXrkmw=="
},
"node_modules/@types/pako": {
"version": "2.0.0",
@ -10167,9 +10167,9 @@
}
},
"node_modules/detox": {
"version": "20.11.3",
"resolved": "https://registry.npmjs.org/detox/-/detox-20.11.3.tgz",
"integrity": "sha512-kdoRAtDLFxXpjt1QlniI+WryMtf7Y8mrZ33Ql8cTR9qoCS/CThi4pweYAQm8yUPqAv1ZtT3eIm3EzRwjEosgLA==",
"version": "20.11.4",
"resolved": "https://registry.npmjs.org/detox/-/detox-20.11.4.tgz",
"integrity": "sha512-P48KAtK8qIDOxJKUl4q/syPkuHz67kAeFlNodBZg5aO4hJiH+RsbEkQfJSYkTCeZV800EcmUQwZK2M5amLoYaw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -28052,9 +28052,9 @@
"dev": true
},
"@types/node": {
"version": "16.11.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz",
"integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA=="
"version": "16.18.53",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.53.tgz",
"integrity": "sha512-vVmHeo4tpF8zsknALU90Hh24VueYdu45ZlXzYWFbom61YR4avJqTFDC3QlWzjuTdAv6/3xHaxiO9NrtVZXrkmw=="
},
"@types/pako": {
"version": "2.0.0",
@ -30409,9 +30409,9 @@
"dev": true
},
"detox": {
"version": "20.11.3",
"resolved": "https://registry.npmjs.org/detox/-/detox-20.11.3.tgz",
"integrity": "sha512-kdoRAtDLFxXpjt1QlniI+WryMtf7Y8mrZ33Ql8cTR9qoCS/CThi4pweYAQm8yUPqAv1ZtT3eIm3EzRwjEosgLA==",
"version": "20.11.4",
"resolved": "https://registry.npmjs.org/detox/-/detox-20.11.4.tgz",
"integrity": "sha512-P48KAtK8qIDOxJKUl4q/syPkuHz67kAeFlNodBZg5aO4hJiH+RsbEkQfJSYkTCeZV800EcmUQwZK2M5amLoYaw==",
"dev": true,
"requires": {
"ajv": "^8.6.3",

View file

@ -148,7 +148,7 @@
"babel-loader": "9.1.3",
"babel-plugin-module-resolver": "5.0.0",
"deep-freeze": "0.0.1",
"detox": "20.11.3",
"detox": "20.11.4",
"eslint": "8.47.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.28.0",