Skip to content

Instantly share code, notes, and snippets.

View mhdsyarif's full-sized avatar
🏚️
Work From Home

Muhammad Syarif mhdsyarif

🏚️
Work From Home
View GitHub Profile
describe('Sales Order', () => {
context('Workflow Demo', () => {
it('Open Sales Menu', () => {
cy.openMenu('Sales','sale.sale_menu_root')
cy.wait(3000)
})
it('Create Quotation', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
before(() => {
// log in only once before any of the tests run.
// your app will likely set some sort of session cookie.
// you'll need to know the name of the cookie(s), which you can find
/*-----------------------------------------------------------------
OpenMenu
Click to menu using Name and XML_ID for this menu
EX: cy.openMenu('Orders','sale.menu_sale_order')
-----------------------------------------------------------------*/
Cypress.Commands.add('openMenu', (menuName, xmlId) => {
cy.get('[data-menu-xmlid="' + xmlId + '"]')
.contains(menuName)
.click({ force: true })
cy.wait(4000)
/*-----------------------------------------------------------------
Login
Login to odoo using user/ password
EX: cy.login()
-----------------------------------------------------------------*/
const user = Cypress.env("user")
const password = Cypress.env("password")
const path = "web/login"
/*-----------------------------------------------------------------
Login
Login to odoo using user/ password
EX: cy.login()
-----------------------------------------------------------------*/
const user = Cypress.env("user")
const password = Cypress.env("password")
const path = "web/login"
{
"baseUrl": "http://localhost:8013",
"env": {
"user": "[email protected]",
"password": "syarif"
}
}
quants = env['stock.quant'].search([])
move_line_ids = []
warning = ''
for quant in quants:
move_lines = env["stock.move.line"].search([
('product_id', '=', quant.product_id.id),
('location_id', '=', quant.location_id.id),
('lot_id', '=', quant.lot_id.id),
('package_id', '=', quant.package_id.id),
('owner_id', '=', quant.owner_id.id),
@mhdsyarif
mhdsyarif / test_create_data.py
Last active April 7, 2019 13:54
Sample function test
def test_create_data(self):
# Create a new project with the test
test_project = self.env['project.project'].create({
'name': 'TestProject'
})
# Add a test task to the project
test_project_task = self.env['project.task'].create({
'name': 'ExampleTask',
'project_id': test_project.id
@mhdsyarif
mhdsyarif / test_project.py
Last active April 7, 2019 14:12
Sample Test Odoo
# -*- coding: utf-8 -*-
from odoo.tests import common
class TestProject(common.TransactionCase):
def test_create_data(self):
# Create a new project with the test
test_project = self.env['project.project'].create({
'name': 'TestProject'
@mhdsyarif
mhdsyarif / __init__.py
Last active April 5, 2019 10:52
demo_unittest_project Init Odoo
# -*- coding: utf-8 -*-
from . import test_project