Bladeren bron

chore: Update Cypress 3 to 6 & fix test cases

version-14
Suraj Shetty 4 jaren geleden
bovenliggende
commit
39d0e72f94
5 gewijzigde bestanden met toevoegingen van 12 en 12 verwijderingen
  1. +2
    -2
      cypress/integration/file_uploader.js
  2. +4
    -5
      cypress/integration/form.js
  3. +1
    -1
      cypress/support/index.js
  4. +3
    -2
      frappe/commands/utils.py
  5. +2
    -2
      frappe/public/js/frappe/form/toolbar.js

+ 2
- 2
cypress/integration/file_uploader.js Bestand weergeven

@@ -21,7 +21,7 @@ context('FileUploader', () => {
open_upload_dialog();

cy.fixture('example.json').then(fileContent => {
cy.get_open_dialog().find('.file-upload-area').upload({
cy.get_open_dialog().find('.file-upload-area').attachFile({
fileContent,
fileName: 'example.json',
mimeType: 'application/json'
@@ -34,7 +34,7 @@ context('FileUploader', () => {
cy.server();
cy.route('POST', '/api/method/upload_file').as('upload_file');
cy.get_open_dialog().find('.btn-modal-primary').click();
cy.wait('@upload_file').its('status').should('be', 200);
cy.wait('@upload_file').its('status').should('eq', 200);
cy.get('.modal:visible').should('not.exist');
});
});


+ 4
- 5
cypress/integration/form.js Bestand weergeven

@@ -33,13 +33,12 @@ context('Form', () => {
cy.hide_dialog();
cy.get('.next-doc').click();
cy.wait(200);
cy.hide_dialog();
cy.contains('Test Form Contact 2').should('not.exist');
cy.get('.title-text').should('contain', 'Test Form Contact 1');
cy.get('.title-text').should('contain', 'Test Form Contact 3');
// clear filters
cy.window().its('frappe').then((frappe) => {
let list_view = frappe.get_list_view('Contact');
list_view.filter_area.filter_list.clear_filters();
});
cy.visit('/app/contact');
cy.clear_filters();
});
it('validates behaviour of Data options validations in child table', () => {
// test email validations for set_invalid controller


+ 1
- 1
cypress/support/index.js Bestand weergeven

@@ -21,5 +21,5 @@ import './commands';
// require('./commands')

Cypress.Cookies.defaults({
whitelist: 'sid'
preserve: 'sid'
});

+ 3
- 2
frappe/commands/utils.py Bestand weergeven

@@ -571,10 +571,11 @@ def run_ui_tests(context, app, headless=False):
plugin_path = "{0}/cypress-file-upload".format(node_bin)

# check if cypress in path...if not, install it.
if not (os.path.exists(cypress_path) or os.path.exists(plugin_path)):
if not (os.path.exists(cypress_path) or os.path.exists(plugin_path)) \
or not subprocess.getoutput("npm view cypress version").startswith("6."):
# install cypress
click.secho("Installing Cypress...", fg="yellow")
frappe.commands.popen("yarn add cypress@3 cypress-file-upload@^3.1 --no-lockfile")
frappe.commands.popen("yarn add cypress@^6 cypress-file-upload@^5 --no-lockfile")

# run for headless mode
run_or_open = 'run --browser chrome --record --key 4a48f41c-11b3-425b-aa88-c58048fa69eb' if headless else 'open'


+ 2
- 2
frappe/public/js/frappe/form/toolbar.js Bestand weergeven

@@ -222,10 +222,10 @@ frappe.ui.form.Toolbar = class Toolbar {
if (!this.frm.is_new() && !this.frm.meta.issingle) {
this.page.add_action_icon("left", () => {
this.frm.navigate_records(1);
}, 'prev-doc', __("Previous"));
}, 'prev-doc', __("Previous Document"));
this.page.add_action_icon("right", ()=> {
this.frm.navigate_records(0);
}, 'next-doc', __("Next"));
}, 'next-doc', __("Next Document"));
}
}



Laden…
Annuleren
Opslaan