|
1 | | -import { apiHost, apiPort } from '../support/config.js'; |
| 1 | +// import { apiHost, apiPort } from '../support/config.js'; |
2 | 2 |
|
3 | 3 | // CSS does not require custom approach |
4 | 4 | // see https://docs.cypress.io/faq/questions/using-cypress-faq#How-do-I-use-special-characters-with-cy-get |
5 | | -export function treenode(id) { |
6 | | - return '[node-id=' + CSS.escape(id) + ']'; |
7 | | -} |
8 | | -export function checkbox() { |
9 | | - return 'span.checkbox'; |
10 | | -} |
11 | | -Cypress.formatDate = (date) => { |
12 | | - if (!date) { |
13 | | - date = new Date(); |
14 | | - } |
15 | | - var month = (date.getMonth() + 1).toString(); |
16 | | - var day = date.getDate().toString(); |
17 | | - if (month.length < 2) { |
18 | | - month = '0' + month; |
19 | | - } |
20 | | - if (day.length < 2) { |
21 | | - day = '0' + day; |
22 | | - } |
23 | | - return day + '-' + month + '-' + date.getUTCFullYear().toString() |
24 | | -} |
25 | | -Cypress.Commands.add('waitForLoading', (options) => cy.wait(50).get('.fs-icon.fa-spinner', { ...options, timeout: options?.timeout || 10000 }).should('not.exist').wait(50)); |
26 | | -Cypress.Commands.add('getMenuCommand', (command, options) => cy.get('.p-Widget.p-Menu .p-Menu-item[data-type=command][data-command=' + CSS.escape(command) + ']', options).should('exist').should('not.have.class', 'p-mod-disabled')); |
27 | | -Cypress.Commands.add('getSubMenu', (text, options) => cy.get('.p-Widget.p-Menu .p-Menu-item[data-type=submenu]', options).should('contain.text', text).should('not.have.class', 'p-mod-disabled')); |
28 | | -Cypress.Commands.add('getTreeNode', (id, options) => cy.get(treenode(id), options)); |
29 | | -Cypress.Commands.add('getCheckbox', (label, options) => { |
30 | | - const result = cy.get(checkbox(label), options); |
31 | | - return label ? result.contains(label) : result; |
32 | | -}); |
33 | | -Cypress.Commands.add('findCheckbox', { prevSubject: true }, (subject, label, options) => { |
34 | | - const result = cy.wrap(subject).find(checkbox(label), options); |
35 | | - return label ? result.contains(label) : result; |
36 | | -}); |
37 | | -Cypress.Commands.add('checked', { prevSubject: true }, subject => cy.wrap(subject).find('.checkbox-box').should('have.class', 'checked')); |
38 | | -Cypress.Commands.add('notChecked', { prevSubject: true }, subject => cy.wrap(subject).find('.checkbox-box').should('not.have.class', 'checked')); |
| 5 | +// export function treenode(id) { |
| 6 | +// return '[node-id=' + CSS.escape(id) + ']'; |
| 7 | +// } |
| 8 | +// export function checkbox() { |
| 9 | +// return 'span.checkbox'; |
| 10 | +// } |
| 11 | +// Cypress.formatDate = (date) => { |
| 12 | +// if (!date) { |
| 13 | +// date = new Date(); |
| 14 | +// } |
| 15 | +// var month = (date.getMonth() + 1).toString(); |
| 16 | +// var day = date.getDate().toString(); |
| 17 | +// if (month.length < 2) { |
| 18 | +// month = '0' + month; |
| 19 | +// } |
| 20 | +// if (day.length < 2) { |
| 21 | +// day = '0' + day; |
| 22 | +// } |
| 23 | +// return day + '-' + month + '-' + date.getUTCFullYear().toString() |
| 24 | +// } |
| 25 | +// Cypress.Commands.add('waitForLoading', (options) => cy.wait(50).get('.fs-icon.fa-spinner', { ...options, timeout: options?.timeout || 10000 }).should('not.exist').wait(50)); |
| 26 | +// Cypress.Commands.add('getMenuCommand', (command, options) => cy.get('.p-Widget.p-Menu .p-Menu-item[data-type=command][data-command=' + CSS.escape(command) + ']', options).should('exist').should('not.have.class', 'p-mod-disabled')); |
| 27 | +// Cypress.Commands.add('getSubMenu', (text, options) => cy.get('.p-Widget.p-Menu .p-Menu-item[data-type=submenu]', options).should('contain.text', text).should('not.have.class', 'p-mod-disabled')); |
| 28 | +// Cypress.Commands.add('getTreeNode', (id, options) => cy.get(treenode(id), options)); |
| 29 | +// Cypress.Commands.add('getCheckbox', (label, options) => { |
| 30 | +// const result = cy.get(checkbox(label), options); |
| 31 | +// return label ? result.contains(label) : result; |
| 32 | +// }); |
| 33 | +// Cypress.Commands.add('findCheckbox', { prevSubject: true }, (subject, label, options) => { |
| 34 | +// const result = cy.wrap(subject).find(checkbox(label), options); |
| 35 | +// return label ? result.contains(label) : result; |
| 36 | +// }); |
| 37 | +// Cypress.Commands.add('checked', { prevSubject: true }, subject => cy.wrap(subject).find('.checkbox-box').should('have.class', 'checked')); |
| 38 | +// Cypress.Commands.add('notChecked', { prevSubject: true }, subject => cy.wrap(subject).find('.checkbox-box').should('not.have.class', 'checked')); |
39 | 39 | // Cypress.Commands.add('addConnection', (name = 'localhost', server = apiHost + apiPort, username = 'admin', password = '') => { |
40 | 40 | // cy.get('#theia-top-panel .p-MenuBar-item').contains('File') |
41 | 41 | // .click() |
@@ -82,11 +82,11 @@ Cypress.Commands.add('notChecked', { prevSubject: true }, subject => cy.wrap(sub |
82 | 82 | // }); |
83 | 83 |
|
84 | 84 | // TODO: All of these need to replaced by meaningful selectors in the source-code |
85 | | -export const dialogOverlay = '.p-Widget.dialogOverlay#theia-dialog-shell'; |
86 | | -export const dialog = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock'; |
87 | | -export const dialogTitle = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogTitle'; |
88 | | -export const dialogBody = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogContent'; |
89 | | -export const dialogFooter = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl'; |
90 | | -export const dialogButtons = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button'; |
91 | | -export const dialogMainButton = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button.main'; |
92 | | -export const dialogSecondaryButton = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button.secondary'; |
| 85 | +// export const dialogOverlay = '.p-Widget.dialogOverlay#theia-dialog-shell'; |
| 86 | +// export const dialog = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock'; |
| 87 | +// export const dialogTitle = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogTitle'; |
| 88 | +// export const dialogBody = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogContent'; |
| 89 | +// export const dialogFooter = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl'; |
| 90 | +// export const dialogButtons = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button'; |
| 91 | +// export const dialogMainButton = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button.main'; |
| 92 | +// export const dialogSecondaryButton = '.p-Widget.dialogOverlay#theia-dialog-shell .dialogBlock .dialogControl .theia-button.secondary'; |
0 commit comments