Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:open-xchange/ox-coi into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Gregor committed Oct 24, 2019
2 parents 123a4f3 + 9cb66eb commit 0956d17
Show file tree
Hide file tree
Showing 12 changed files with 583 additions and 338 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ screenshots/
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/android/key.properties
49 changes: 31 additions & 18 deletions test_driver/block_unblock_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
*/

import 'package:flutter_driver/flutter_driver.dart';
import 'package:ox_coi/src/utils/keyMapping.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

import 'setup/global_consts.dart';
import 'setup/helper_methods.dart';
import 'setup/main_test_setup.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

void main() {
group('Test block / unblock functionality', () {
Expand All @@ -57,34 +59,45 @@ void main() {
test('Test block / unblock functionality.', () async {
// Check real authentication and get chat.
await getAuthentication(
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword);
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword,
);

Invoker.current.heartbeat();
await setup.driver.waitFor(chatWelcomeFinder);
Invoker.current.heartbeat();

// Get contacts and add new contacts.
await setup.driver.tap(contactsFinder);
await setup.driver.tap(cancelFinder);
await setup.driver.waitFor(find.text(meContact));

// Add two new contacts in the contact list.
await addNewContact(
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName01,
keyContactChangeEmailFinder,
newTestContact01,
keyContactChangeCheckFinder);
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName01,
keyContactChangeEmailFinder,
newTestContact01,
keyContactChangeCheckFinder,
);

// Block one contact and check the blocking,
await blockOneContactFromContacts(setup.driver, newTestName01);
await setup.driver.waitForAbsent(find.text(newTestName01));
await setup.driver.tap(find.byValueKey(keyContactListBlockIconButton));
await setup.driver.waitFor(find.text(newTestName01));
await catchScreenshot(setup.driver, 'screenshots/blockedList.png');

// Block one contact.
await blockOneContact(setup.driver, newTestName01);
// Unblock one contact and check the unblocking.
await unblockOneContactFromBlockedContacts(setup.driver, newTestName01);
await setup.driver.waitFor(find.text(newTestName01));
});
});
}
93 changes: 55 additions & 38 deletions test_driver/chatList_test.dart → test_driver/chat_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
// Imports the Flutter Driver API.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:ox_coi/src/utils/keyMapping.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

import 'setup/global_consts.dart';
import 'setup/helper_methods.dart';
import 'setup/main_test_setup.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

void main() {
group('Create chat list integration tests.', () {
Expand All @@ -57,72 +58,88 @@ void main() {

test('Test Create chat list integration tests.', () async {
await getAuthentication(
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword);
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword,
);

// Create first Me contact.
await createNewChat(setup.driver, createChatFinder, realEmail, meContact,
newContact, name, enterContactName, emptyChat);
await createNewChat(
setup.driver,
createChatFinder,
realEmail,
meContact,
newContact,
name,
enterContactName,
emptyChat,
);
// Create second contact.
await createNewChat(setup.driver, createChatFinder, newTestContact02,
newTestName02, newContact, name, enterContactName, emptyChat);
await createNewChat(
setup.driver,
createChatFinder,
newTestContact02,
newTestName02,
newContact,
name,
enterContactName,
emptyChat,
);
// create third contact
await createNewChat(setup.driver, createChatFinder, newTestContact01,
newTestName01, newContact, name, enterContactName, emptyChat);
await createNewChat(
setup.driver,
createChatFinder,
newTestContact01,
newTestName01,
newContact,
name,
enterContactName,
emptyChat,
);
// Type something and get it.
await chatTest(setup.driver, newTestName01,
typeSomethingComposePlaceholderFinder, helloWord);
await chatTest(setup.driver, newTestName01, typeSomethingComposePlaceholderFinder, helloWorld);
await callTest(setup.driver);
await setup.driver.tap(pageBack);
// Search contact.
await chatSearch(
setup.driver,
newTestName01,
searchString,
find.byValueKey(keyChatListSearchIconButton),
keySearchReturnIconButton);
setup.driver,
newTestName01,
searchString,
find.byValueKey(keyChatListSearchIconButton),
keySearchReturnIconButton,
);
});
});
}

Future createNewChat(
FlutterDriver driver,
SerializableFinder finderCreateChat,
String chatEmail,
String chatName,
String newContact,
String name,
String enterContactName,
String emptyChat) async {
Future createNewChat(FlutterDriver driver, SerializableFinder finderCreateChat, String chatEmail, String chatName, String newContact, String name,
String enterContactName, String emptyChat) async {
final finderMe = find.text(meContact);
final finderNewContact = find.text(newContact);
Invoker.current.heartbeat();
await driver.tap(finderCreateChat);
if (chatName == meContact) {
await driver.tap(finderMe);
await driver.tap(find.pageBack());
await driver.tap(pageBack);
await driver.waitFor(finderMe);
} else {
Invoker.current.heartbeat();
await driver.tap(finderNewContact);
await driver.waitFor(find.text(name));
await driver.waitFor(find.text(emailAddress));
await driver
.tap(find.byValueKey(keyContactChangeNameValidatableTextFormField));
await driver.tap(find.byValueKey(keyContactChangeNameValidatableTextFormField));
await driver.waitFor(find.text(enterContactName));
await driver.enterText(chatName);
await driver
.tap(find.byValueKey(keyContactChangeEmailValidatableTextFormField));
await driver.tap(find.byValueKey(keyContactChangeEmailValidatableTextFormField));
await driver.waitFor(find.text(emailAddress));
await driver.enterText(chatEmail);
await driver.tap(find.byValueKey(keyContactChangeCheckIconButton));
await driver.waitFor(find.text(emptyChat));
await driver.tap(find.pageBack());
await driver.tap(pageBack);
await catchScreenshot(driver, 'screenshots/chatListeAfterCreated.png');
}
}

74 changes: 33 additions & 41 deletions test_driver/contact_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@
// Imports the Flutter Driver API.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:ox_coi/src/utils/keyMapping.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

import 'setup/global_consts.dart';
import 'setup/helper_methods.dart';
import 'setup/main_test_setup.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/invoker.dart';

void main() {
group(
'Create contact list integration tests: After login, Me contact is checked first, '
'then two contacts are created. The contacts made can then be found in the contact list.'
'After that one of the contacts will be delete from the contact list',
() {
'After that one of the contacts will be delete from the contact list', () {
// Define the driver.
FlutterDriver driver;
Setup setup = new Setup(driver);
Expand All @@ -63,13 +63,14 @@ void main() {
test('Test create profile integration tests.', () async {
// Check real authentication and get chat.
await getAuthentication(
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword);
setup.driver,
signInFinder,
coiDebugProviderFinder,
providerEmailFinder,
realEmail,
providerPasswordFinder,
realPassword,
);

Invoker.current.heartbeat();
await setup.driver.waitFor(chatWelcomeFinder);
Expand All @@ -81,31 +82,28 @@ void main() {

// Add two new contacts in the contact list.
await addNewContact(
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName01,
keyContactChangeEmailFinder,
newTestContact01,
keyContactChangeCheckFinder);
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName01,
keyContactChangeEmailFinder,
newTestContact01,
keyContactChangeCheckFinder,
);

await addNewContact(
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName02,
keyContactChangeEmailFinder,
newTestContact02,
keyContactChangeCheckFinder);
setup.driver,
personAddFinder,
keyContactChangeNameFinder,
newTestName02,
keyContactChangeEmailFinder,
newTestContact02,
keyContactChangeCheckFinder,
);

// Manage new contact
await manageContact(
setup.driver,
newTestName01,
keyContactChangeNameFinder,
newMe,
keyContactChangeCheckFinder,
keyContactDetailEditContactProfileActionIcon);
setup.driver, newTestName01, keyContactChangeNameFinder, newMe, keyContactChangeCheckFinder, keyContactDetailEditContactProfileActionIcon);
await catchScreenshot(setup.driver, 'screenshots/persone_add02.png');
print('\nContacts');
// Delete one contact
Expand All @@ -116,20 +114,14 @@ void main() {
});
}

Future manageContact(
FlutterDriver driver,
String newTestName,
SerializableFinder keyContactChangeNameFinder,
String newMe,
SerializableFinder keyContactChangeCheckFinder,
String keyContactDetailEditContactProfileActionIcon) async {
Future manageContact(FlutterDriver driver, String newTestName, SerializableFinder keyContactChangeNameFinder, String newMe,
SerializableFinder keyContactChangeCheckFinder, String keyContactDetailEditContactProfileActionIcon) async {
await driver.tap(find.text(newTestName));
Invoker.current.heartbeat();
await driver.waitFor(find.text(newTestName));
await driver
.tap(find.byValueKey(keyContactDetailEditContactProfileActionIcon));
await driver.tap(find.byValueKey(keyContactDetailEditContactProfileActionIcon));
await driver.tap(keyContactChangeNameFinder);
await driver.enterText(newMe);
await driver.tap(keyContactChangeCheckFinder);
await driver.tap(find.pageBack());
await driver.tap(pageBack);
}
Loading

0 comments on commit 0956d17

Please sign in to comment.