| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- context('Click page icons button', () => {
- const ssPrefix = 'click-page-icon-';
- beforeEach(() => {
- // login
- cy.fixture("user-admin.json").then(user => {
- cy.login(user.username, user.password);
- });
- });
- it('Successfully subscribe/unsubscribe a page', () => {
- cy.visit('/Sandbox');
- cy.collapseSidebar(true, true);
- // Subscribe
- cy.get('#subscribe-button').click({force: true});
- cy.get('#subscribe-button').should('have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="subscribe-button-tooltip"]').length > 0) {
- cy.getByTestid('subscribe-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('subscribe-button-tooltip').should('not.exist');
- cy.waitUntilSkeletonDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}1-subscribe-page`) })
- // Unsubscribe
- cy.get('#subscribe-button').click({force: true});
- cy.get('#subscribe-button').should('not.have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="subscribe-button-tooltip"]').length > 0) {
- cy.getByTestid('subscribe-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('subscribe-button-tooltip').should('not.exist');
- cy.waitUntilSkeletonDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}2-unsubscribe-page`) })
- });
- it('Successfully Like / Dislike a page', () => {
- cy.visit('/Sandbox');
- cy.collapseSidebar(true);
- // like
- cy.get('#like-button').click({force: true});
- cy.get('#like-button').should('have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="like-button-tooltip"]').length > 0) {
- cy.getByTestid('like-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('like-button-tooltip').should('not.exist');
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}3-like-page`) });
- // total liker (user-list-popover is commented out because it is sometimes displayed and sometimes not.)
- // cy.get('#po-total-likes').click({force: true});
- // cy.get('.user-list-popover').should('be.visible')
- // cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}4-likes-counter`) });
- // unlike
- cy.get('#like-button').click({force: true});
- cy.get('#like-button').should('not.have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="like-button-tooltip"]').length > 0) {
- cy.getByTestid('like-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('like-button-tooltip').should('not.exist');
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}5-dislike-page`) });
- // total liker (user-list-popover is commented out because it is sometimes displayed and sometimes not.)
- // cy.get('#po-total-likes').click({force: true});
- // cy.get('.user-list-popover').should('be.visible');
- // cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}6-likes-counter`) });
- });
- it('Successfully Bookmark / Unbookmark a page', () => {
- cy.visit('/Sandbox');
- cy.collapseSidebar(true);
- // bookmark
- cy.get('#bookmark-dropdown-btn').click({force: true});
- cy.get('#bookmark-dropdown-btn').should('have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="bookmark-button-tooltip"]').length > 0) {
- cy.getByTestid('bookmark-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('bookmark-button-tooltip').should('not.exist');
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}7-bookmark-page`) });
- // total bookmarker
- cy.waitUntil(() => {
- // do
- cy.get('#po-total-bookmarks').click({force: true});
- // wait until
- return cy.get('body').within(() => {
- return Cypress.$('.user-list-popover').is(':visible');
- });
- });
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}8-bookmarks-counter`) });
- // unbookmark
- cy.get('#bookmark-dropdown-btn').click({force: true});
- cy.get('.grw-bookmark-folder-menu').should('be.visible');
- cy.get('.grw-bookmark-folder-menu-item').first().click({force: true});
- cy.get('#bookmark-dropdown-btn').should('not.have.class', 'active');
- // position of the element is not fixed to be displayed, so the element is removed
- cy.get('body').then($body => {
- if ($body.find('[data-testid="bookmark-button-tooltip"]').length > 0) {
- cy.getByTestid('bookmark-button-tooltip').invoke('remove');
- }
- })
- cy.getByTestid('bookmark-button-tooltip').should('not.exist');
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}9-unbookmark-page`) });
- // total bookmarker
- cy.waitUntil(() => {
- // do
- cy.get('#po-total-bookmarks').click({force: true});
- // wait until
- return cy.get('body').within(() => {
- return Cypress.$('.user-list-popover').is(':visible');
- });
- });
- cy.waitUntilSpinnerDisappear();
- cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}10-bookmarks-counter`) });
- });
- // user-list-popover is commented out because it is sometimes displayed and sometimes not
- // it('Successfully display list of "seen by user"', () => {
- // cy.visit('/Sandbox');
- // cy.waitUntilSkeletonDisappear();
- // cy.get('#grw-subnav-container').within(() => {
- // cy.get('div.grw-seen-user-info').find('button#btn-seen-user').click({force: true});
- // });
- // // position of the element is not fixed to be displayed, so the element is removed
- // cy.get('body').then($body => {
- // if ($body.find('[data-testid="seen-user-info-tooltip"]').length > 0) {
- // cy.getByTestid('seen-user-info-tooltip').invoke('remove');
- // }
- // })
- // cy.getByTestid('seen-user-info-tooltip').should('not.exist');
- // cy.get('.user-list-popover').should('be.visible')
- // cy.get('#grw-subnav-container').within(() => {
- // cy.screenshot(`${ssPrefix}11-seen-user-list`);
- // });
- // });
- });
|