Commit ef51c010 authored by Juan Manuel Solaro's avatar Juan Manuel Solaro
Browse files

(feat) post flow

parent 69cadb18
......@@ -36,4 +36,60 @@ describe('Post Flow', () => {
await deletePost();
});
it('should be able to create a nsfw post with text', async () => {
const text = 'e2eTest';
// create post
await waitForAndType(by.id, 'PostInput', text);
await tapElement(by.id, 'NsfwToggle');
await tapElement(by.id, 'NsfwToggle');
await waitForAndTap(by.id, 'NsfwReasonNudity');
await tapElement(by.id, 'NsfwToggle');
await tapElement(by.id, 'CapturePostButton');
// wait for newsfeed
await waitForElement(by.id, 'NewsfeedScreen');
await deletePost();
});
it('should be able to create a text and image post', async () => {
const text = 'e2eTest';
// create post
await waitForAndType(by.id, 'PostInput', text);
await tapElement(by.id, 'GalleryImage0');
await tapElement(by.id, 'GalleryImage0');
await waitFor(element(by.id('CapturePostButton'))).toBeVisible().withTimeout(120000);
await tapElement(by.id, 'CapturePostButton');
// wait for newsfeed
await waitForElement(by.id, 'NewsfeedScreen');
await deletePost();
});
it('should be able to cancel image upload and then post', async () => {
const text = 'e2eTest';
// create post
await waitForAndType(by.id, 'PostInput', text);
await tapElement(by.id, 'GalleryImage0');
await tapElement(by.id, 'GalleryImage0');
await waitForAndTap(by.id, 'AttachmentDeleteButton');
await tapElement(by.id, 'CapturePostButton');
// wait for newsfeed
await waitForElement(by.id, 'NewsfeedScreen');
await deletePost();
});
});
......@@ -159,7 +159,7 @@ export default class CaptureGallery extends PureComponent {
});
}
}
{...testID(`Gallery ${node.type}`)}
testID={`GalleryImage${item.index}`}
>
<Image
source={{ uri : node.image.uri }}
......
......@@ -293,7 +293,7 @@ export default class CapturePoster extends Component {
uri={attachment.uri}
type={attachment.type}
/>
<Icon raised name="md-close" type="ionicon" color='#fff' size={22} containerStyle={styles.deleteAttachment} onPress={() => this.deleteAttachment()} {...testID('Attachment Delete Button')} />
<Icon raised name="md-close" type="ionicon" color='#fff' size={22} containerStyle={styles.deleteAttachment} onPress={() => this.deleteAttachment()} testID="AttachmentDeleteButton" />
</View>}
<CaptureTabs onSelectedMedia={this.onAttachedMedia} />
</React.Fragment>
......
......@@ -361,7 +361,7 @@ export default class CapturePosterFlags extends Component {
}
renderNsfw() {
if (GOOGLE_PLAY_STORE || Platform.OS === 'ios') return null;
//if (GOOGLE_PLAY_STORE || Platform.OS === 'ios') return null;
return (
<NsfwToggle
containerStyle={styles.cell}
......
......@@ -58,7 +58,7 @@ export default class NsfwToggle extends Component {
render() {
const isActive = Boolean(this.props.value && this.props.value.length);
const button = (
<Touchable style={this.props.containerStyle} onPress={this.showDropdown} {...testID('NSFW button')}>
<Touchable style={this.props.containerStyle} onPress={this.showDropdown} testID="NsfwToggle">
<MdIcon
name="explicit"
color={isActive ? Colors.explicit : Colors.darkGreyed}
......@@ -80,7 +80,7 @@ export default class NsfwToggle extends Component {
key={i}
onPress={() => this.toggleDropdownOption(reason)}
textStyle={[styles.menuItemText, this.isReasonActive(reason) && styles.menuItemTextActive]}
{...testID(`NSFW ${reason.label}`)}
testID={`NsfwReason${reason.label}`}
>{this.isReasonActive(reason) && <MdIcon name="check" />} {reason.label}</MenuItem>
))}
</Menu>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment