Commit c4498c79 authored by Brian Hatchet's avatar Brian Hatchet
Browse files

Merge branch 'master' into feat/boost-e2e-1632

parents fe037a52 6d942fb6
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
{}
{
  "requestTimeout": 3600000,
  "responseTimeout": 3600000
}
+8.1 KiB
Loading image diff...
+45 −9
Original line number Diff line number Diff line
// import 'cypress-file-upload';

context('Blogs', () => {
  beforeEach(() => {
    cy.login(true);
@@ -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,11 +106,12 @@ 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();

    cy.clock().then((clock) => { clock.tick(1000); });

    // Blogs will not save, nor return error, if a user doesn't have an avatar
    cy.wait(1000);

    cy.location('pathname', { timeout: 30000 })
      .should('contains', `/${Cypress.env().username}/blog`);
+0 −9
Original line number Diff line number Diff line
@@ -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;
    });
+3 −1
Original line number Diff line number Diff line
@@ -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) => {
Loading