fix:Test cases for opportinity
This commit is contained in:
parent
dc218ebeeb
commit
5e9c7e2203
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ erpnext/docs/current
|
||||
__pycache__
|
||||
*~
|
||||
.idea/
|
||||
node_modules
|
3
cypress.json
Normal file
3
cypress.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"baseUrl": "http://test_site_ui:8000"
|
||||
}
|
5
cypress/fixtures/example.json
Normal file
5
cypress/fixtures/example.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
32
cypress/integration/opportunity/lost_reason_detail.js
Normal file
32
cypress/integration/opportunity/lost_reason_detail.js
Normal file
@ -0,0 +1,32 @@
|
||||
context('Form', () => {
|
||||
before(() => {
|
||||
cy.login('Administrator', 'qwe');
|
||||
cy.visit('/desk');
|
||||
});
|
||||
|
||||
it('create a new opportunity', () => {
|
||||
cy.visit('/desk#Form/Opportunity/New Opportunity 1');
|
||||
cy.get('.page-title').should('contain', 'Not Saved');
|
||||
cy.fill_field('enquiry_from', 'Customer', 'Select');
|
||||
cy.fill_field('customer', 'Test Customer', 'Link').blur();
|
||||
cy.get('.primary-action').click();
|
||||
cy.get('.page-title').should('contain', 'Open');
|
||||
cy.get('.form-inner-toolbar button:contains("Lost")').click({ force: true });
|
||||
cy.get('.modal input[data-fieldname="lost_reason"]').as('input')
|
||||
cy.get('@input').focus().type('Higher', { delay: 200 })
|
||||
cy.get('.modal .awesomplete ul')
|
||||
.should('be.visible')
|
||||
.get('li:contains("Higher Price")')
|
||||
.click({ force: true })
|
||||
cy.get('@input').focus().type('No Followup', { delay: 200 })
|
||||
cy.get('.modal .awesomplete ul')
|
||||
.should('be.visible')
|
||||
.get('li:contains("No Followup")')
|
||||
.click()
|
||||
|
||||
cy.fill_field('detailed_reason', 'Test Detailed Reason', 'Text');
|
||||
cy.get('.modal button:contains("Declare Lost")').click({ force: true });
|
||||
cy.get('.page-title').should('contain', 'Lost');
|
||||
});
|
||||
});
|
||||
|
17
cypress/plugins/index.js
Normal file
17
cypress/plugins/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
25
cypress/support/commands.js
Normal file
25
cypress/support/commands.js
Normal file
@ -0,0 +1,25 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
22
cypress/support/index.js
Normal file
22
cypress/support/index.js
Normal file
@ -0,0 +1,22 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// import frappe commands
|
||||
import '../../../frappe/cypress/support/index'
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
@ -9,28 +9,6 @@ from frappe.utils.selenium_testdriver import TestDriver
|
||||
from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
|
||||
|
||||
class TestLostReason(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.driver = TestDriver()
|
||||
|
||||
def test_opportunity_lost(self):
|
||||
doc = make_opportunity(with_items=0)
|
||||
doc.save()
|
||||
self.assertEqual(doc.status, "Open")
|
||||
|
||||
self.driver.set_route('Form', 'Opportinuty', doc.name)
|
||||
time.sleep(2)
|
||||
|
||||
lost = self.driver.find('.form-inner-toolbar')[1]
|
||||
lost.click()
|
||||
time.sleep(2)
|
||||
|
||||
self.driver.set_text_editor('order_lost_reason', 'Test reason for detailed reason')
|
||||
|
||||
self.driver.click_primary_action()
|
||||
self.assertEqual(doc.status, "Lost")
|
||||
self.assertEqual(doc.order_lost_reason, "Test reason for detailed reason")
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.close()
|
||||
pass
|
||||
|
||||
|
||||
|
5
package.json
Normal file
5
package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"cypress": "^3.1.4"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user