Skip to content

Commit

Permalink
chore: fix e2e test for help/chat [ch18071]
Browse files Browse the repository at this point in the history
  • Loading branch information
seavan committed Dec 13, 2018
1 parent 66178bd commit f2abcc9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/components/settings/basic-settings-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class BasicSettingsItem extends SafeComponent {
<View style={itemContainerStyle} pointerEvents={untappable ? undefined : 'none'}>
<View style={{ flexGrow: 1, flexShrink: 1 }}>
<Text style={titleStyle}>{t(title)}</Text>
{!!description && <Text style={descriptionStyle}>{description}d</Text>}
{!!description && <Text style={descriptionStyle}>{description}</Text>}
</View>
<View style={{ flex: 0 }}>{children}</View>
<View style={{ flex: 0 }}>{rightIcon}</View>
Expand Down
16 changes: 10 additions & 6 deletions app/components/settings/settings-level-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const startChatWithSupport = async () => {
settingsState.stack.clear();
};

function helpCenterAction() {
Linking.openURL('https://support.peerio.com/hc/en-us');
}

@observer
export default class SettingsLevel2 extends SafeComponent {
testTwoFactorAuthPrompt(cancelable) {
Expand Down Expand Up @@ -117,14 +121,14 @@ export default class SettingsLevel2 extends SafeComponent {
help() {
return (
<View style={bgStyle}>
<whiteLabelComponents.SettingsHelpButton title="title_helpCenter" untappable>
{buttons.blueTextButton('button_visit', () =>
Linking.openURL('https://support.peerio.com/hc/en-us')
)}
<whiteLabelComponents.SettingsHelpButton
onPress={helpCenterAction}
title="title_helpCenter">
{buttons.blueTextButton('button_visit', helpCenterAction)}
</whiteLabelComponents.SettingsHelpButton>
<whiteLabelComponents.SettingsHelpButton
title="title_contactPeerioSupport"
untappable>
onPress={startChatWithSupport}>
{buttons.blueTextButton(
'button_chat',
startChatWithSupport,
Expand All @@ -133,7 +137,7 @@ export default class SettingsLevel2 extends SafeComponent {
'button_chat'
)}
</whiteLabelComponents.SettingsHelpButton>
<BasicSettingsItem title="title_sendLogsToSupport" untappable>
<BasicSettingsItem title="title_sendLogsToSupport" onPress={sendLogs}>
{buttons.blueTextButton('button_send', sendLogs)}
</BasicSettingsItem>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import BasicSettingsItem from '../../settings/basic-settings-item';
@observer
export default class PeerioSettingsHelpButton extends SafeComponent {
renderThrow() {
const { title, untappable } = this.props;
const { title, untappable, onPress } = this.props;
return (
<BasicSettingsItem title={title} untappable={untappable}>
<BasicSettingsItem {...{ title, untappable, onPress }}>
{this.props.children}
</BasicSettingsItem>
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"test-android-invites": "TEST_FEATURE=chat/roomInvites npm run test-android-feature",
"test-ios-listener": "TEST_FEATURE=listener/listener npm run test-ios-feature",
"test-ios-placeholderDM": "TEST_FEATURE=chat/placeholderDM npm run test-ios-feature",
"test-ios-settings-help": "TEST_FEATURE=settings/help npm run test-ios-feature",
"test-android": "TEST_FEATURE=account/login npm run test-android-feature",
"test-android-feature": "source env.sh && ./scripts/forward-android-listener.sh && cucumber-js test/spec/$TEST_FEATURE.feature -r test/code -f node_modules/cucumber-pretty -f json:test/reports/result-android.json --world-parameters '{\"platform\": \"android\"}'",
"test-android-2fa": "TEST_FEATURE=account/2fa npm run test-android-feature",
Expand Down
4 changes: 0 additions & 4 deletions test/code/pages/messaging/chatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ class ChatPage extends Page {
return this.getWhenVisible(`~textInputMessage`);
}

get textInputExists() {
return this.checkIfPresent(`~textInputMessage`);
}

get buttonSendMessage() {
return this.getWhenVisible('~buttonSendMessage');
}
Expand Down
2 changes: 1 addition & 1 deletion test/code/pages/settings/settingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SettingsPage extends Page {
}

get chatButton() {
return this.getWhenVisible('~button_chat');
return this.getWhenVisible('~title_contactPeerioSupport');
}
}

Expand Down
4 changes: 1 addition & 3 deletions test/code/steps/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,5 @@ Then('I fill my chatlist', async function() {
});

Then('A chat opens with the support user', async function() {
await this.app.pause(2000); // Necessary else it will always return false
const textInputExists = await this.chatPage.textInputExists;
textInputExists.should.be.true; // eslint-disable-line
await this.chatPage.textInput;
});

0 comments on commit f2abcc9

Please sign in to comment.