Tests fixed
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
parent
e1e65e8b2e
commit
dbe6161c69
|
@ -12,6 +12,7 @@ let asyncActions = {
|
|||
clickIfExists: async function(selector) {
|
||||
let exists = await this.exists(selector);
|
||||
if (exists) await this.click(selector);
|
||||
return exists;
|
||||
},
|
||||
|
||||
// Salix specific extensions
|
||||
|
@ -29,8 +30,16 @@ let asyncActions = {
|
|||
|
||||
login: async function(userName) {
|
||||
if (currentUser !== userName) {
|
||||
this.clickIfExists('#logout')
|
||||
.clickIfExists('.vn-dialog.shown button[response=ACCEPT]');
|
||||
let logoutClicked = await this.clickIfExists('#logout');
|
||||
|
||||
if (logoutClicked) {
|
||||
let buttonSelector = '.vn-dialog.shown button[response=ACCEPT]';
|
||||
this.wait(buttonSelector => {
|
||||
return document.querySelector(buttonSelector) != null
|
||||
|| location.hash == '#!/login';
|
||||
}, buttonSelector);
|
||||
await this.clickIfExists(buttonSelector);
|
||||
}
|
||||
|
||||
try {
|
||||
await this.waitForURL('#!/login');
|
||||
|
@ -86,7 +95,7 @@ let asyncActions = {
|
|||
pickTime: async function(selector, time) {
|
||||
await this.wait(selector)
|
||||
.evaluate((selector, time) => {
|
||||
let input = document.querySelector(selector);
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = time;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, time);
|
||||
|
@ -481,11 +490,6 @@ let actions = {
|
|||
},
|
||||
};
|
||||
|
||||
Object.keys(actions).forEach(function(name) {
|
||||
let fn = actions[name];
|
||||
Nightmare.action(name, fn);
|
||||
});
|
||||
|
||||
for (let name in asyncActions) {
|
||||
let fn = asyncActions[name];
|
||||
|
||||
|
@ -495,3 +499,8 @@ for (let name in asyncActions) {
|
|||
.then(res => done(null, res), done);
|
||||
});
|
||||
}
|
||||
|
||||
Object.keys(actions).forEach(function(name) {
|
||||
let fn = actions[name];
|
||||
Nightmare.action(name, fn);
|
||||
});
|
||||
|
|
|
@ -363,7 +363,7 @@ export default {
|
|||
moreMenuMakeInvoice: '.vn-popover.shown .vn-drop-down li[name="Make invoice"]',
|
||||
moreMenuChangeShippedHour: '.vn-popover.shown .vn-drop-down li[name="Change shipped hour"]',
|
||||
changeShippedHourDialog: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"]',
|
||||
changeShippedHourInput: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"] vn-input-time[vn-id="newShipped"]',
|
||||
changeShippedHourInput: 'vn-dialog[vn-id="changeShippedDialog"] [ng-model="$ctrl.newShipped"]',
|
||||
addStowawayDialogFirstTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tbody vn-tr',
|
||||
shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
|
||||
thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)',
|
||||
|
@ -671,7 +671,7 @@ export default {
|
|||
saveButton: 'vn-worker-pbx vn-submit[label="Save"] input'
|
||||
},
|
||||
workerTimeControl: {
|
||||
timeDialogInput: 'vn-worker-time-control > vn-dialog input',
|
||||
timeDialogInput: '.vn-dialog.shown [ng-model="$ctrl.newTime"]',
|
||||
mondayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button > button > vn-icon',
|
||||
tuesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button > button > vn-icon',
|
||||
wednesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button > button > vn-icon',
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('Ticket descriptor path', () => {
|
|||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour)
|
||||
.write(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
|
||||
.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
|
||||
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
|
Loading…
Reference in New Issue