Skip to content

Commit

Permalink
Add simply domain test
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Nechyporenko committed Jul 21, 2023
1 parent a8f7dd7 commit e8a394b
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
odoo.define('test_crnd_web_field_domain.field_domain_tour', function (require) {
odoo.define('test_crnd_web_field_domain.simply_domain_tour', function (require) {
'use strict';

var tour = require('web_tour.tour');

tour.register('test_crnd_web_field_domain_field_domain_tour', {
tour.register('test_crnd_web_field_domain_simply_domain_tour', {
test: true,
rainbowMan: false,
url: '/web',
Expand All @@ -12,10 +12,22 @@ odoo.define('test_crnd_web_field_domain.field_domain_tour', function (require) {
content: "Click menu 'Cars'",
trigger: "a[data-menu-xmlid='test_crnd_web_field_domain.car_rental_car_menu']",
},
{
content: "Check in menu 'Cars'",
trigger: "main.o_main_content div.o_control_panel ol.breadcrumb li.breadcrumb-item:containsExact('Car')",
},
{
content: "Check in menu 'Cars'",
trigger: "table:has(td.o_data_cell:contains('EcoCruiser'))",
},
{
content: "Check in menu 'Cars'",
trigger: "table:has(td.o_data_cell:contains('FamilyJourney'))",
},
{
content: "Click record with car 'EcoCruiser'",
trigger: "td.o_data_cell:containsExact('EcoCruiser')",
run: 'click',
trigger: "td.o_data_cell:first",
run: "click",
},
{
content: "Wait for download form",
Expand All @@ -42,6 +54,82 @@ odoo.define('test_crnd_web_field_domain.field_domain_tour', function (require) {
content: "Ensure dropdown list has 'GreenDrive' brand",
trigger: "ul.ui-autocomplete:has(a:contains('GreenDrive')) ",
},
// The brand record with id 2 is 'SpeedTech',
// so lets check this
{
content: "Input domain into domain field",
trigger: "input[name='brand_id_field_domain']",
run: "text [('id', '=', 2)]",
},
{
content: "Click Brand field",
trigger: "div[name='brand_id'] div.o_input_dropdown input",
run: "click",
},
{
content: "Ensure dropdown list has 'SpeedTech' brand",
trigger: "ul.ui-autocomplete:has(a:contains('SpeedTech')) ",
},
// Check no more other 4 records in dropdown list
{
content: "Ensure dropdown list not has 'GreenDrive' brand",
trigger: "ul.ui-autocomplete:not(a:contains('GreenDrive')) ",
},
{
content: "Ensure dropdown list not has 'CityWheels' brand",
trigger: "ul.ui-autocomplete:not(a:contains('CityWheels')) ",
},
{
content: "Ensure dropdown list not has 'ComfortCars' brand",
trigger: "ul.ui-autocomplete:not(a:contains('ComfortCars')) ",
},
{
content: "Ensure dropdown list not has 'TrekDrive' brand",
trigger: "ul.ui-autocomplete:not(a:contains('TrekDrive')) ",
},

// Input empty domain to make sure all records in dropdown list
{
content: "Input empty domain into domain field",
trigger: "input[name='brand_id_field_domain']",
run: "text []",
},
{
content: "Click Brand field",
trigger: "div[name='brand_id'] div.o_input_dropdown input",
run: "click",
},
{
content: "Ensure dropdown list has 'SpeedTech' brand",
trigger: "ul.ui-autocomplete:has(a:contains('SpeedTech')) ",
},
{
content: "Ensure dropdown list has 'GreenDrive' brand",
trigger: "ul.ui-autocomplete:has(a:contains('GreenDrive')) ",
},
{
content: "Ensure dropdown list has 'CityWheels' brand",
trigger: "ul.ui-autocomplete:has(a:contains('CityWheels')) ",
},
{
content: "Ensure dropdown list has 'ComfortCars' brand",
trigger: "ul.ui-autocomplete:has(a:contains('ComfortCars')) ",
},
{
content: "Ensure dropdown list has 'TrekDrive' brand",
trigger: "ul.ui-autocomplete:has(a:contains('TrekDrive')) ",
},

// Save record
{
content: "Click save button",
trigger: "button:contains('Save')",
run: "click",
},
{
content: "Check record saved",
trigger: "div.o_form_view.o_form_readonly",
},
]);
return {};
});
4 changes: 2 additions & 2 deletions test_crnd_web_field_domain/tests/test_tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
@tagged('post_install', '-at_install')
class TestCrndWebFieldDomain(WebTourCase):

def test_field_domain(self):
def test_simply_field_domain(self):
self.run_js_tour(
start_url='/web',
tour_name='test_crnd_web_field_domain_field_domain_tour',
tour_name='test_crnd_web_field_domain_simply_domain_tour',
login='admin')

0 comments on commit e8a394b

Please sign in to comment.