This repository has been archived by the owner on Oct 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: messages after the plugin installation
- Loading branch information
1 parent
71e8782
commit 1461293
Showing
7 changed files
with
249 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
includes/admin/views/html-notice-pagarme-documentation-link.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Notice: Pagar.me documentation link. | ||
* | ||
* @package WooCommerce_Pagarme/Admin/Notices | ||
*/ | ||
|
||
?> | ||
|
||
<div class="updated notice is-dismissible"> | ||
<p><?php esc_html_e( 'We recommend checking out our documentation before starting using', 'woocommerce-pagarme' ); ?> <strong><?php esc_html_e( 'WooCommerce Pagar.me', 'woocommerce-pagarme' ); ?></strong>!</p> | ||
<p> | ||
<a href="https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce" class="button button-primary" target="_blank"><?php esc_html_e( 'Pagar.me documentation', 'woocommerce-pagarme' ); ?></a> | ||
</p> | ||
<p><a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'woocommerce-pagarme-hide-notice', 'documentation_link' ) ) ); ?>" class="notice-dismiss" style="text-decoration:none;"></a></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
context('Wordpress admin notices', () => { | ||
describe('when go to the wordpress plugins page', () => { | ||
describe('and deactivate the woocommerce plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.deactivateWoocommercePlugin() | ||
}) | ||
|
||
it('should contain error message', () => { | ||
cy.get('.error a.button') | ||
.contains('WooCommerce') | ||
.should('have.attr', 'href') | ||
.and('match', /action\=activate\&plugin\=woocommerce/) | ||
}) | ||
|
||
describe('and when reactivate the woocommerce plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.activateWoocommercePlugin() | ||
}) | ||
|
||
it('should not contain the message anymore', () => { | ||
cy.get('.error a[href*="action=activate&plugin=woocommerce"]') | ||
.should('not.exist') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('and deactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.deactivateWoocommercePagarmePlugin() | ||
}) | ||
|
||
describe('and reactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.activateWoocommercePagarmePlugin() | ||
}) | ||
|
||
it('should contain a message with the Pagar.me documentation link button', () => { | ||
cy.get('.updated a.button-primary') | ||
.should('have.attr', 'href') | ||
.and('match', /docs.pagar.me/) | ||
}) | ||
}) | ||
|
||
describe('and when click to close the message', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=documentation_link"]') | ||
.click() | ||
}) | ||
|
||
it('should not contain the message anymore', () => { | ||
cy.get('.updated a[href*="docs.pagar.me"]') | ||
.should('not.exist') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('and deactivate the brazilian market plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.deactivateBrazilianMarketPlugin() | ||
}) | ||
|
||
describe('and deactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.deactivateWoocommercePagarmePlugin() | ||
}) | ||
|
||
describe('and reactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.activateWoocommercePagarmePlugin() | ||
}) | ||
|
||
it('should contain a message recommending the Brazilian Market plugin activation', () => { | ||
cy.get('.updated a.button-primary') | ||
.should('have.attr', 'href') | ||
.and('match', /action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil/) | ||
}) | ||
}) | ||
|
||
describe('and when click to close the message', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=missing_brazilian_market"]') | ||
.click() | ||
}) | ||
|
||
it('should not contain the message anymore', () => { | ||
cy.get('.updated a[href*="action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil"]') | ||
.should('not.exist') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('and deactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.deactivateWoocommercePagarmePlugin() | ||
}) | ||
|
||
describe('and reactivate the woocommerce-pagarme plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.activateWoocommercePagarmePlugin() | ||
}) | ||
|
||
it('should contain again a message recommending the Brazilian Market plugin activation', () => { | ||
cy.get('.updated a.button-primary') | ||
.should('have.attr', 'href') | ||
.and('match', /action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil/) | ||
}) | ||
}) | ||
|
||
describe('and when reactivate the brazilian market plugin', () => { | ||
before(() => { | ||
cy.goToPluginsPage() | ||
cy.activateBrazilianMarketPlugin() | ||
}) | ||
|
||
it('should not contain the message anymore', () => { | ||
cy.get('.updated a[href*="action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil"]') | ||
.should('not.exist') | ||
}) | ||
}) | ||
|
||
after(() => { | ||
cy.goToPluginsPage() | ||
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=documentation_link"]') | ||
.click() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters