|
|
@@ -31,19 +31,78 @@ context('Modal for page operation', () => {
|
|
|
});
|
|
|
cy.collapseSidebar(true);
|
|
|
});
|
|
|
+ it("PageCreateModal is shown and closed successfully", () => {
|
|
|
+ cy.visit('/');
|
|
|
+ cy.getByTestid('newPageBtn').click();
|
|
|
|
|
|
- it("PageCreateModal is shown successfully", () => {
|
|
|
- cy.visit('/me');
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.screenshot(`${ssPrefix}new-page-modal-opened`);
|
|
|
+ cy.get('button.close').click();
|
|
|
|
|
|
+ });
|
|
|
+ cy.screenshot(`${ssPrefix}page-create-modal-closed`, {capture: 'viewport'});
|
|
|
+ });
|
|
|
+ it("Successfully Create Today's page", () => {
|
|
|
+ const pageName = "Today's page";
|
|
|
+ cy.visit('/');
|
|
|
cy.getByTestid('newPageBtn').click();
|
|
|
|
|
|
- cy.getByTestid('page-create-modal').should('be.visible').screenshot(`${ssPrefix}-open`);
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.get('.page-today-input2').type(pageName);
|
|
|
+ cy.screenshot(`${ssPrefix}today-add-page-name`);
|
|
|
+ cy.getByTestid('btn-create-memo').click();
|
|
|
+ });
|
|
|
+ cy.getByTestid('page-editor').should('be.visible');
|
|
|
+ cy.getByTestid('save-page-btn').click();
|
|
|
+ cy.get('body').should('not.have.class', 'on-edit');
|
|
|
|
|
|
- cy.getByTestid('row-create-page-under-below').find('input.form-control').clear().type('/new-page');
|
|
|
- cy.getByTestid('btn-create-page-under-below').click();
|
|
|
+ cy.getByTestid('grw-contextual-sub-nav').should('be.visible');
|
|
|
+ cy.screenshot(`${ssPrefix}create-today-page`);
|
|
|
+ });
|
|
|
+ it('Successfully create page under specific path', () => {
|
|
|
+ const pageName = 'child';
|
|
|
+
|
|
|
+ cy.visit('/SandBox');
|
|
|
+ cy.getByTestid('newPageBtn').click();
|
|
|
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.get('.rbt-input-main').type(pageName);
|
|
|
+ cy.screenshot(`${ssPrefix}under-path-add-page-name`);
|
|
|
+ cy.getByTestid('btn-create-page-under-below').click();
|
|
|
+ });
|
|
|
cy.getByTestid('page-editor').should('be.visible');
|
|
|
- cy.screenshot(`${ssPrefix}-create-clicked`, {capture: 'viewport'});
|
|
|
+ cy.getByTestid('save-page-btn').click();
|
|
|
+ cy.get('body').should('not.have.class', 'on-edit');
|
|
|
+
|
|
|
+ cy.getByTestid('grw-contextual-sub-nav').should('be.visible');
|
|
|
+ cy.screenshot(`${ssPrefix}create-page-under-specific-page`);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('Trying to create template page under the root page fail', () => {
|
|
|
+ cy.visit('/');
|
|
|
+ cy.getByTestid('newPageBtn').click();
|
|
|
+
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.get('#template-type').click();
|
|
|
+ cy.get('#template-type').next().find('button:eq(0)').click({force: true});
|
|
|
+ cy.get('#dd-template-type').next().find('button').click({force: true});
|
|
|
+ });
|
|
|
+ cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
|
|
|
+ cy.screenshot(`${ssPrefix}create-template-for-children-error`, {capture: 'viewport'});
|
|
|
+ cy.get('.toast-error').should('be.visible').click();
|
|
|
+
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.get('#template-type').click();
|
|
|
+ cy.get('#template-type').next().find('button:eq(1)').click({force: true});
|
|
|
+ cy.get('#dd-template-type').next().find('button').click({force: true});
|
|
|
+ });
|
|
|
+ cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
|
|
|
+ cy.screenshot(`${ssPrefix}create-template-for-descendants-error`, {capture: 'viewport'});
|
|
|
+ cy.get('.toast-error').should('be.visible').click();
|
|
|
+ cy.getByTestid('page-create-modal').should('be.visible').within(() => {
|
|
|
+ cy.get('button.close').click();
|
|
|
+ });
|
|
|
+ cy.screenshot(`${ssPrefix}create-template-close-modal`, {capture: 'viewport'});
|
|
|
});
|
|
|
|
|
|
it('PageDeleteModal is shown successfully', () => {
|