Skip to content

Commit

Permalink
Build: (db5368c) Merge pull request #110 from 10up/upkeep/83
Browse files Browse the repository at this point in the history
Upgrade to Cypress 13
  • Loading branch information
dkotter committed Aug 30, 2023
1 parent 79f9671 commit ca5a4da
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
24 changes: 14 additions & 10 deletions lib/commands/check-block-pattern-exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ const checkBlockPatternExists = ({ title, categoryValue = 'featured', }) => {
/* eslint-disable */
return new Promise(resolve => {
let elapsed = 0;
setInterval(function () {
const inverval = setInterval(function () {
var _a, _b;
if (elapsed > 2500) {
clearInterval(inverval);
resolve(false);
}
const { wp } = win;
const { getSettings } = wp.data.select('core/block-editor');
const allRegisteredPatterns = getSettings().__experimentalBlockPatterns;
if (undefined !== allRegisteredPatterns) {
for (let i = 0; i < allRegisteredPatterns.length; i++) {
if (title === allRegisteredPatterns[i].title &&
allRegisteredPatterns[i].categories &&
allRegisteredPatterns[i].categories.includes(categoryValue)) {
resolve(true);
return;
const getSettings = (_b = (_a = wp === null || wp === void 0 ? void 0 : wp.data) === null || _a === void 0 ? void 0 : _a.select('core/block-editor')) === null || _b === void 0 ? void 0 : _b.getSettings;
if (undefined !== getSettings) {
const allRegisteredPatterns = getSettings().__experimentalBlockPatterns;
if (undefined !== allRegisteredPatterns) {
for (let i = 0; i < allRegisteredPatterns.length; i++) {
if (title === allRegisteredPatterns[i].title &&
allRegisteredPatterns[i].categories &&
allRegisteredPatterns[i].categories.includes(categoryValue)) {
resolve(true);
return;
}
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions lib/commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ exports.login = void 0;
* ```
*/
const login = (username = 'admin', password = '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.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}`);
}
});
});
};
exports.login = login;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@wordpress/env": "^5.5.0",
"codecov": "^3.8.1",
"compare-versions": "^4.1.3",
"cypress": "^10.11.0",
"cypress": "^13.0.0",
"cypress-mochawesome-reporter": "^3.2.3",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
Expand Down

0 comments on commit ca5a4da

Please sign in to comment.