MM-35680 Detox/E2E: Add e2e for untrusted certificate prompt (#5534)

This commit is contained in:
Joseph Baylon 2021-07-14 02:33:46 -07:00 committed by GitHub
parent d7cd660ab7
commit 61f4e54866
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -15,6 +15,7 @@ class Alert {
leavePublicChannelTitle = isAndroid() ? element(by.text('Leave Public Channel')) : element(by.label('Leave Public Channel')).atIndex(0);
messageLengthTitle = isAndroid() ? element(by.text('Message Length')) : element(by.label('Message Length')).atIndex(0);
removeMembersTitle = isAndroid() ? element(by.text('Remove Members')) : element(by.label('Remove Members')).atIndex(0);
untrustedCertificateTitle = isAndroid() ? element(by.text('Untrusted Certificate')) : element(by.label('Untrusted Certificate')).atIndex(0);
// alert buttons
cancelButton = isAndroid() ? element(by.text('CANCEL')) : element(by.label('Cancel')).atIndex(1);

View file

@ -7,6 +7,7 @@
// - Use element testID when selecting an element. Create one if none.
// *******************************************************************
import {Alert} from '@support/ui/component';
import {
LoginScreen,
SelectServerScreen,
@ -86,4 +87,30 @@ describe('Select Server', () => {
// * Verify that it goes into Login screen
await LoginScreen.toBeVisible();
});
it('MM-T2348 should show untrusted certificate prompt when connecting to a server with invalid SSL or invalid host', async () => {
await SelectServerScreen.toBeVisible();
// # Attempt to connect to invalid SSL
const invalidSsl = 'expired.badssl.com';
await serverUrlInput.clearText();
await serverUrlInput.typeText(invalidSsl);
await connectButton.tap();
// * Verify untrusted certificate alert is displayed with invalid SSL
await expect(Alert.untrustedCertificateTitle).toBeVisible();
await expect(element(by.text(`The certificate from ${invalidSsl} is not trusted.\n\nPlease contact your System Administrator to resolve the certificate issues and allow connections to this server.`))).toBeVisible();
await Alert.okButton.tap();
// # Attempt to connect to invalid host
const invalidHost = 'wrong.host.badssl.com';
await serverUrlInput.clearText();
await serverUrlInput.typeText(invalidHost);
await connectButton.tap();
// * Verify untrusted certificate alert is displayed with invalid host
await expect(Alert.untrustedCertificateTitle).toBeVisible();
await expect(element(by.text(`The certificate from ${invalidHost} is not trusted.\n\nPlease contact your System Administrator to resolve the certificate issues and allow connections to this server.`))).toBeVisible();
await Alert.okButton.tap();
});
});