|
| 1 | +describe('Test Free - upsells', function() { |
| 2 | + before(function () { |
| 3 | + |
| 4 | + // login to WP |
| 5 | + cy.visit('wp-login.php'); |
| 6 | + cy.get('#user_login').clear().type(Cypress.env('login')); |
| 7 | + cy.get('#user_pass').clear().type(Cypress.env('pass')); |
| 8 | + cy.get('#wp-submit').click(); |
| 9 | + }); |
| 10 | + |
| 11 | + beforeEach(() => { |
| 12 | + cy.visit(Cypress.env('urls').library ); |
| 13 | + cy.get('.add-new-h2.add-new-chart').first().click(); |
| 14 | + cy.wait( Cypress.env('wait') ); |
| 15 | + }); |
| 16 | + |
| 17 | + it('Check upsell links', function() { |
| 18 | + cy.get('iframe') |
| 19 | + .then(function ($iframe) { |
| 20 | + const $body = $iframe.contents().find('body'); |
| 21 | + cy.wrap($body).find('#toolbar input[type="submit"]').click(); |
| 22 | + cy.wait( Cypress.env('wait') ); |
| 23 | + }); |
| 24 | + |
| 25 | + cy.get('iframe') |
| 26 | + .then(function ($iframe) { |
| 27 | + const $body = $iframe.contents().find('body'); |
| 28 | + // Check Import form other chart upsell. |
| 29 | + const other_import = cy.wrap($body).find('.viz-import-from-other'); |
| 30 | + other_import.click(); |
| 31 | + other_import.should('have.class', 'only-pro-feature'); |
| 32 | + const other_import_upsell_url = cy.wrap($body).find('.viz-import-from-other .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 33 | + const other_import_search_params = new URLSearchParams(href); |
| 34 | + expect(other_import_search_params.get('utm_campaign')).to.equal('import-chart'); |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + cy.get('iframe') |
| 39 | + .then(function ($iframe) { |
| 40 | + const $body = $iframe.contents().find('body'); |
| 41 | + // Check import form WordPress upsell. |
| 42 | + const wp_import = cy.wrap($body).find('.visualizer_source_query_wp'); |
| 43 | + wp_import.click(); |
| 44 | + wp_import.should('have.class', 'only-pro-feature'); |
| 45 | + const wp_import_upsell_url = cy.wrap($body).find('.visualizer_source_query_wp .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 46 | + const wp_import_search_params = new URLSearchParams(href); |
| 47 | + expect(wp_import_search_params.get('utm_campaign')).to.equal('import-wp'); |
| 48 | + }); |
| 49 | + }); |
| 50 | + |
| 51 | + cy.get('iframe') |
| 52 | + .then(function ($iframe) { |
| 53 | + const $body = $iframe.contents().find('body'); |
| 54 | + // Check import form database upsell. |
| 55 | + const db_import = cy.wrap($body).find('.visualizer_source_query'); |
| 56 | + db_import.click(); |
| 57 | + db_import.should('have.class', 'only-pro-feature'); |
| 58 | + const db_import_upsell_url = cy.wrap($body).find('.visualizer_source_query .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 59 | + const db_import_search_params = new URLSearchParams(href); |
| 60 | + expect(db_import_search_params.get('utm_campaign')).to.equal('db-query'); |
| 61 | + }); |
| 62 | + }); |
| 63 | + |
| 64 | + cy.get('iframe') |
| 65 | + .then(function ($iframe) { |
| 66 | + const $body = $iframe.contents().find('body'); |
| 67 | + // Check import form manual data upsell. |
| 68 | + const manual_import = cy.wrap($body).find('.visualizer_source_manual'); |
| 69 | + manual_import.click(); |
| 70 | + manual_import.should('have.class', 'only-pro-feature'); |
| 71 | + const manual_import_upsell_url = cy.wrap($body).find('.visualizer_source_manual .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 72 | + const manual_import_search_params = new URLSearchParams(href); |
| 73 | + expect(manual_import_search_params.get('utm_campaign')).to.equal('manual-data'); |
| 74 | + }); |
| 75 | + }); |
| 76 | + }); |
| 77 | + |
| 78 | + it('Check Settings upsell links', function() { |
| 79 | + cy.get('iframe') |
| 80 | + .then(function ($iframe) { |
| 81 | + const $body = $iframe.contents().find('body'); |
| 82 | + cy.wrap($body).find('#toolbar input[type="submit"]').click(); |
| 83 | + cy.wait( Cypress.env('wait') ); |
| 84 | + }); |
| 85 | + |
| 86 | + cy.get('iframe') |
| 87 | + .then(function ($iframe) { |
| 88 | + const $body = $iframe.contents().find('body'); |
| 89 | + cy.wrap($body).find('#viz-tab-advanced').click(); |
| 90 | + cy.wait( Cypress.env('wait') ); |
| 91 | + }); |
| 92 | + |
| 93 | + cy.get('iframe') |
| 94 | + .then(function ($iframe) { |
| 95 | + const $body = $iframe.contents().find('body'); |
| 96 | + // Check setting chart data filter configuration upsell. |
| 97 | + const data_control = cy.wrap($body).find('#vz-data-controls'); |
| 98 | + data_control.click(); |
| 99 | + data_control.should('have.class', 'only-pro-feature'); |
| 100 | + const data_control_upsell_url = cy.wrap($body).find('#vz-data-controls .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 101 | + const data_control_search_params = new URLSearchParams(href); |
| 102 | + expect(data_control_search_params.get('utm_campaign')).to.equal('data-filter-configuration'); |
| 103 | + }); |
| 104 | + }); |
| 105 | + |
| 106 | + cy.get('iframe') |
| 107 | + .then(function ($iframe) { |
| 108 | + const $body = $iframe.contents().find('body'); |
| 109 | + // Check setting frontend actions upsell. |
| 110 | + const frontend_actions = cy.wrap($body).find('#vz-frontend-actions'); |
| 111 | + frontend_actions.click(); |
| 112 | + frontend_actions.should('have.class', 'only-pro-feature'); |
| 113 | + const frontend_actions_upsell_url = cy.wrap($body).find('#vz-frontend-actions .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 114 | + const frontend_actions_search_params = new URLSearchParams(href); |
| 115 | + expect(frontend_actions_search_params.get('utm_campaign')).to.equal('frontend-actions'); |
| 116 | + }); |
| 117 | + }); |
| 118 | + |
| 119 | + cy.get('iframe') |
| 120 | + .then(function ($iframe) { |
| 121 | + const $body = $iframe.contents().find('body'); |
| 122 | + // Check setting permissions upsell. |
| 123 | + const permissions = cy.wrap($body).find('#vz-permissions'); |
| 124 | + permissions.click(); |
| 125 | + permissions.should('have.class', 'only-pro-feature'); |
| 126 | + const permissions_upsell_url = cy.wrap($body).find('#vz-permissions .viz-group-content .only-pro-content .only-pro-container .only-pro-inner a').should('have.attr', 'href').then((href) => { |
| 127 | + const permissions_search_params = new URLSearchParams(href); |
| 128 | + expect(permissions_search_params.get('utm_campaign')).to.equal('chart-permissions'); |
| 129 | + }); |
| 130 | + }); |
| 131 | + }); |
| 132 | +}); |
0 commit comments