Skip to content

Commit

Permalink
wip to figuring out why cypress isn't rendering the drop down on click
Browse files Browse the repository at this point in the history
  • Loading branch information
SeriousHorncat committed Apr 29, 2024
1 parent 33bd3c9 commit 560dfc3
Showing 1 changed file with 87 additions and 91 deletions.
178 changes: 87 additions & 91 deletions system-tests/e2e/discussions_analysis.cy.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
describe('discussions_analysis.cy.js', () => {
beforeEach(() => {
cy.resetDatabase();
cy.visit('/');
cy.get('.analysis-card').first().click();
cy.get('[href="#Discussion"]').click();
cy.visit('/analysis/CPAM0002/#Discussion');
});

it('should publish a new post to the discussion section', () => {
cy.get('#Discussion').should('exist');
// it('should have a discussion section', () => {
// cy.get('#Discussion').should('exist');
// });

cy.get('[data-test="new-discussion-button"]').click();
// it('should publish a new post to the discussion section', () => {
// cy.get('[data-test="new-discussion-button"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 3);
// cy.get('[data-test="discussion-post"]').should('have.length', 3);

cy.get('[data-test="new-discussion-input"]').type('System Test Text');
cy.get('[data-test="new-discussion-publish"]').click();
// cy.get('[data-test="new-discussion-input"]').type('System Test Text');
// cy.get('[data-test="new-discussion-publish"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);
});
// cy.get('[data-test="discussion-post"]').should('have.length', 4);
// });

it('should not be able to publish a post with no text in the new discussion field', () => {
cy.get('#Discussion').should('exist');
// it('should not be able to publish a post with no text in the new discussion field', () => {
// cy.get('[data-test="new-discussion-button"]').click();
// cy.get('[data-test="new-discussion-publish"]').should('be.disabled');
// });

cy.get('[data-test="new-discussion-button"]').click();
cy.get('[data-test="new-discussion-publish"]').should('be.disabled');
});
// it('should cancel a new post, close the new post field, and not post anything', () => {
// cy.get('[data-test="new-discussion-button"]').click();

it('should cancel a new post, close the new post field, and not post anything', () => {
cy.get('#Discussion').should('exist');
// cy.get('[data-test="new-discussion-input"]').type('System Test Text');
// cy.get('[data-test="new-discussion-cancel"]').click();

cy.get('[data-test="new-discussion-button"]').click();
// cy.get('[data-test="new-discussion-input"]').should('not.exist');

cy.get('[data-test="new-discussion-input"]').type('System Test Text');
cy.get('[data-test="new-discussion-cancel"]').click();

cy.get('[data-test="new-discussion-input"]').should('not.exist');

cy.get('[data-test="discussion-post"]').should('have.length', 3);
});
// cy.get('[data-test="discussion-post"]').should('have.length', 3);
// });

it('should publish a new post to the discussion section then proceed to delete it successfully', () => {
cy.get('#Discussion').should('exist');

cy.get('[data-test="new-discussion-button"]').click();

cy.get('[data-test="new-discussion-input"]').type('System Test Text');
cy.get('[data-test="new-discussion-publish"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-header"]')
cy.get('[data-test="discussion-post"]').eq(3).as('newDiscussion')

cy.get('@newDiscussion')
.find('[data-test="discussion-post-context-menu"]')
.click()
.click();

cy.get('@newDiscussion')
.find('.grey-rounded-menu > :nth-child(2)')
.contains('Delete')
.click();
Expand All @@ -63,83 +59,83 @@ describe('discussions_analysis.cy.js', () => {
cy.get('[data-test="discussion-post"]').should('have.length', 3);
});

it('should publish a new post to the discussion section, delete the post, and cancel the deletion', () => {
cy.get('#Discussion').should('exist');
// it('should publish a new post to the discussion section, delete the post, and cancel the deletion', () => {
// cy.get('#Discussion').should('exist');

cy.get('[data-test="new-discussion-button"]').click();
// cy.get('[data-test="new-discussion-button"]').click();

cy.get('[data-test="new-discussion-input"]').type('System Test Text');
cy.get('[data-test="new-discussion-publish"]').click();
// cy.get('[data-test="new-discussion-input"]').type('System Test Text');
// cy.get('[data-test="new-discussion-publish"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);
// cy.get('[data-test="discussion-post"]').should('have.length', 4);

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-header"]')
.find('[data-test="discussion-post-context-menu"]')
.click()
.find('.grey-rounded-menu > :nth-child(2)')
.contains('Delete')
.click();
// cy.get('[data-test="discussion-post"]')
// .eq(3)
// .find('[data-test="discussion-post-header"]')
// .find('[data-test="discussion-post-context-menu"]')
// .click()
// .find('.grey-rounded-menu > :nth-child(2)')
// .contains('Delete')
// .click();

cy.get('[data-test="notification-dialog"]').find('[data-test="cancel-button"]').contains('Cancel').click();
// cy.get('[data-test="notification-dialog"]').find('[data-test="cancel-button"]').contains('Cancel').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);
});
// cy.get('[data-test="discussion-post"]').should('have.length', 4);
// });

it('Should proceed to edit an existing discussion post and save it', () => {
cy.get('[data-test="new-discussion-button"').click();
// it('Should proceed to edit an existing discussion post and save it', () => {
// cy.get('[data-test="new-discussion-button"').click();

cy.get('[data-test="new-discussion-input"]').type('System Test Text');
cy.get('[data-test="new-discussion-publish"]').click();
// cy.get('[data-test="new-discussion-input"]').type('System Test Text');
// cy.get('[data-test="new-discussion-publish"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);
// cy.get('[data-test="discussion-post"]').should('have.length', 4);

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-header"]')
.find('[data-test="discussion-post-context-menu"]')
.click()
.find('.grey-rounded-menu > :nth-child(1)')
.contains('Edit')
.click();
// cy.get('[data-test="discussion-post"]')
// .eq(3)
// .find('[data-test="discussion-post-header"]')
// .find('[data-test="discussion-post-context-menu"]')
// .click()
// .find('.grey-rounded-menu > :nth-child(1)')
// .contains('Edit')
// .click();

cy.get('[data-test="edit-discussion-input"]').clear();
cy.get('[data-test="edit-discussion-input"]').type('Editing a system test.');
// cy.get('[data-test="edit-discussion-input"]').clear();
// cy.get('[data-test="edit-discussion-input"]').type('Editing a system test.');

cy.get('[data-test="edit-discussion-save"]').click();
// cy.get('[data-test="edit-discussion-save"]').click();

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-content"]')
.should('have.text', 'Editing a system test.');
});
// cy.get('[data-test="discussion-post"]')
// .eq(3)
// .find('[data-test="discussion-post-content"]')
// .should('have.text', 'Editing a system test.');
// });

it('Should proceed to edit a discussion post and then cancel it leaving the original post intact', () => {
cy.get('[data-test="new-discussion-button"').click();
// it('Should proceed to edit a discussion post and then cancel it leaving the original post intact', () => {
// cy.get('[data-test="new-discussion-button"').click();

cy.get('[data-test="new-discussion-input"]').type('System Test Text.');
cy.get('[data-test="new-discussion-publish"]').click();
// cy.get('[data-test="new-discussion-input"]').type('System Test Text.');
// cy.get('[data-test="new-discussion-publish"]').click();

cy.get('[data-test="discussion-post"]').should('have.length', 4);
// cy.get('[data-test="discussion-post"]').should('have.length', 4);

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-header"]')
.find('[data-test="discussion-post-context-menu"]')
.click()
.find('.grey-rounded-menu > :nth-child(1)')
.contains('Edit')
.click();
// cy.get('[data-test="discussion-post"]')
// .eq(3)
// .find('[data-test="discussion-post-header"]')
// .find('[data-test="discussion-post-context-menu"]')
// .click()
// .find('.grey-rounded-menu > :nth-child(1)')
// .contains('Edit')
// .click();

cy.get('[data-test="edit-discussion-input"]').clear();
cy.get('[data-test="edit-discussion-input"]').type('Editing a system test.');
// cy.get('[data-test="edit-discussion-input"]').clear();
// cy.get('[data-test="edit-discussion-input"]').type('Editing a system test.');

cy.get('[data-test="edit-discussion-cancel"]').click();
// cy.get('[data-test="edit-discussion-cancel"]').click();

cy.get('[data-test="discussion-post"]')
.eq(3)
.find('[data-test="discussion-post-content"]')
.should('have.text', 'System Test Text.');
});
// cy.get('[data-test="discussion-post"]')
// .eq(3)
// .find('[data-test="discussion-post-content"]')
// .should('have.text', 'System Test Text.');
// });
});

0 comments on commit 560dfc3

Please sign in to comment.