Skip to content

Commit

Permalink
Fix Search e2e tests (#5106)
Browse files Browse the repository at this point in the history
* Do not enter phone number because it is optional now

* Remove sessions due to state or timing conflict in tests
  • Loading branch information
rebeccahum authored Dec 19, 2023
1 parent b089da9 commit 8a37fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion tests/search/e2e/integration/features/woocommerce.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('WooCommerce Feature', { tags: '@slow' }, () => {
cy.get('#billing-address_1').type(userData.address);
cy.get('#billing-city').type(userData.city);
cy.get('#billing-postcode').type(userData.postCode);
cy.get('#billing-phone').type(userData.phoneNumber);
cy.get('button.wc-block-components-checkout-place-order-button').trigger('click'); // VIP: Need to use .trigger('click') because Cypress can't click on the button.

// VIP: Give some time for the order to be placed.
Expand Down
18 changes: 8 additions & 10 deletions tests/search/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ import 'cypress-file-upload';
import './commands/block-editor';

Cypress.Commands.add('login', (username = '[email protected]', password = 'password') => {
cy.session([username,password], () => {
cy.visit(`/wp-admin`);
cy.get('body').then(($body) => {
if ($body.find('#wpwrap').length === 0) {
cy.get('input#user_login').clear();
cy.get('input#user_login').click().type(username);
cy.get('input#user_pass').type(`${password}{enter}`);
}
});
})
cy.visit(`/wp-admin`);
cy.get('body').then(($body) => {
if ($body.find('#wpwrap').length === 0) {
cy.get('input#user_login').clear();
cy.get('input#user_login').click().type(username);
cy.get('input#user_pass').type(`${password}{enter}`);
}
});
});

Cypress.Commands.add('visitAdminPage', (page = 'index.php') => {
Expand Down

0 comments on commit 8a37fe7

Please sign in to comment.