...
 
Commits (9)
{}
{
"requestTimeout": 3600000,
"responseTimeout": 3600000
}
cypress/fixtures/avatar.jpeg

8.1 KB

// import 'cypress-file-upload';
context('Blogs', () => {
beforeEach(() => {
cy.login(true);
......@@ -6,7 +8,7 @@ context('Blogs', () => {
.should('eq', `/newsfeed/subscriptions`);
})
it('should not be able to create a new blog if no title or banner are specified', () => {
it('should not be able to create a new blog if no title or banner are specified', () => {
cy.visit('/blog/edit/new');
cy.get('.m-button--submit').click();
......@@ -24,7 +26,8 @@ context('Blogs', () => {
cy.get('.m-blog--edit--error').contains('Error: You must upload a banner');
})
it('should be able to create a new blog', () => {
// TODO: remove the x when we run tests in new users each time
xit("should not be able to create a new blog if the channel doesn't have an avatar", () => {
cy.visit('/blog/edit/new');
cy.uploadFile('minds-banner #file', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
......@@ -33,12 +36,44 @@ context('Blogs', () => {
cy.get('m-inline-editor .medium-editor-element').type('Content\n');
cy.wait(1000);
cy.server();
cy.route("POST", "**!/api/v1/blog/new").as("newBlog");
cy.get('.m-button--submit').click({ force: true }); // TODO: Investigate why disabled flag is being detected
cy.get('h1.m-blog--edit--error').contains('Error: Please ensure your channel has an avatar before creating a blog');
});
it('should be able to create a new blog', () => {
// upload avatar first
cy.visit(`/${Cypress.env().username}`);
cy.get('.m-channel--name .minds-button-edit button:first-child').click();
cy.wait(100);
cy.uploadFile('.minds-avatar input[type=file]', '../fixtures/avatar.jpeg', 'image/jpg');
cy.get('.m-channel--name .minds-button-edit button:last-child').click();
// create blog
cy.visit('/blog/edit/new');
cy.uploadFile('.minds-banner input[type=file]', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
cy.get('minds-textarea .m-editor').type('Title');
cy.get('m-inline-editor .medium-editor-element').type('Content\n');
// click on plus button
cy.get('.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show').click();
// cy.get('.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show').click();
// click on camera
cy.get('ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child').contains('photo_camera').click();
// cy.get('ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child').contains('photo_camera').click();
// upload the image
cy.uploadFile('.medium-media-file-input', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
// cy.uploadFile('.medium-media-file-input', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
// open license dropdown & select first license
cy.get('.m-license-info select').select('All rights reserved');
......@@ -71,13 +106,14 @@ context('Blogs', () => {
cy.get('.m-mature-info a').click();
cy.get('.m-mature-info a span').contains('Mature content');
cy.wait(1000);
cy.get('.m-button--submit').click({ force: true }); // TODO: Investigate why disabled flag is being detected
cy.clock();
// Blogs will not save, nor return error, if a user doesn't have an avatar
cy.clock().then((clock) => { clock.tick(1000); });
cy.location('pathname', { timeout: 30000})
cy.wait(1000);
cy.location('pathname', { timeout: 30000 })
.should('contains', `/${Cypress.env().username}/blog`);
cy.get('.m-blog--title').contains('Title');
......
......@@ -76,15 +76,6 @@ context('Groups', () => {
// comment should appear on the list
cy.get('minds-groups-profile-conversation m-comments__tree > m-comments__thread .m-commentBubble__message').contains('lvl 1 comment');
// reply to the comment
cy.get('minds-groups-profile-conversation m-comments__tree > m-comments__thread m-comment .m-clickable').contains('Reply').click();
cy.get('minds-groups-profile-conversation m-comments__tree > m-comments__thread m-comment minds-textarea .m-editor').type('lvl 2 comment');
cy.get('minds-groups-profile-conversation m-comments__tree > m-comments__thread m-comment a.m-post-button').click();
// reply should appear
cy.get('minds-groups-profile-conversation m-comments__tree > m-comments__thread m-comment m-comments__thread m-comment .m-commentBubble__message').contains('lvl 2 comment');
cy.on('window:confirm', (str) => {
return true;
});
......
......@@ -53,10 +53,12 @@ Cypress.Commands.add('uploadFile', (selector, fileName, type = '') => {
dataTransfer.items.add(testFile);
el.files = dataTransfer.files;
// return cy.wrap(subject).trigger('change', {force: true});
});
});
});
cy.get(selector).trigger('change', { force: true });
// cy.get(selector).trigger('change', { force: true });
});
Cypress.Commands.add('post', (message) => {
......
<header *ngIf="blog">
<minds-banner
[object]="blog"
editMode="true"
[editMode]="true"
(added)="add_banner($event)"
[done]="banner_prompt"
></minds-banner>
......
......@@ -185,7 +185,7 @@ export class BlogEdit {
this.blog = response.blog;
this.guid = response.blog.guid;
this.title.setTitle(this.blog.title);
if(this.blog.thumbnail_src)
this.existingBanner = true;
//this.hashtagsSelector.setTags(this.blog.tags);
......@@ -235,6 +235,8 @@ export class BlogEdit {
if (!this.validate())
return;
this.error = '';
this.inlineEditor.prepareForSave().then(() => {
const blog = Object.assign({}, this.blog);
......@@ -248,9 +250,14 @@ export class BlogEdit {
this.check_for_banner().then(() => {
this.upload.post('api/v1/blog/' + this.guid, [this.banner], blog)
.then((response: any) => {
this.router.navigate(response.route ? ['/' + response.route]: ['/blog/view', response.guid]);
this.canSave = true;
this.inProgress = false;
this.canSave = true;
if (response.status !== 'success') {
this.error = response.message;
return;
}
this.router.navigate(response.route ? ['/' + response.route]: ['/blog/view', response.guid]);
})
.catch((e) => {
this.canSave = true;
......@@ -275,7 +282,7 @@ export class BlogEdit {
if (!this.banner)
this.banner_prompt = true;
return new Promise((resolve, reject) => {
if (this.banner)
return resolve(true);
......
......@@ -468,9 +468,9 @@ export class BoostCreatorComponent implements AfterViewInit {
if (this.boost.currency === 'onchain'
&& (this.boost.amount < this.rates.min
|| this.boost.amount > (this.rates.cap * 2)
|| this.boost.amount > (this.rates.cap)
)) {
throw new VisibleBoostError(`You must boost between ${this.rates.min} and ${this.rates.cap * 2} views.`);
throw new VisibleBoostError(`You must boost between ${this.rates.min} and ${this.rates.cap} views.`);
}
......
......@@ -37,7 +37,7 @@
</span>
<ul class="m-boostCreatorSelector__bullets">
<li>Max 10k per boost</li>
<!-- <li>Max 10k per boost</li> -->
<li>Stored on the blockchain</li>
<li>Stand out in the feeds</li>
<li>Gain "OnChain" badge</li>
......@@ -78,7 +78,7 @@
</span>
<ul class="m-boostCreatorSelector__bullets">
<li>Max 5k per boost</li>
<!-- <li>Max 5k per boost</li> -->
<li>Stored on Minds servers</li>
<li>No transaction fee</li>
<li style="list-style:none">&nbsp;</li>
......
......@@ -106,6 +106,12 @@ export class GroupProfileFeedSortedComponent {
}
loadMore() {
if (this.feedsService.canFetchMore
&& !this.feedsService.inProgress.getValue()
&& this.feedsService.offset.getValue()
) {
this.feedsService.fetch(); // load the next 150 in the background
}
this.feedsService.loadMore();
}
......