welcome.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. module.exports = (theme = '') => {
  2. const baseUrl = require('./utils')(theme, 'welcomes')
  3. describe('Welcome Test', () => {
  4. it('Test From HTML', () => {
  5. cy.visit(`${baseUrl}from-html.html`)
  6. .get('.bootstrap-table').should('exist')
  7. .get('.fixed-table-toolbar > .columns').should('exist')
  8. .get('.fixed-table-toolbar > .search').should('exist')
  9. })
  10. it('Test From Data', () => {
  11. cy.visit(`${baseUrl}from-data.html`)
  12. .get('div.bootstrap-table tbody tr').should('have.length', 6)
  13. })
  14. it('Test From URL', () => {
  15. cy.visit(`${baseUrl}from-url.html`)
  16. .get('div.bootstrap-table tbody tr').should('have.length', 21)
  17. })
  18. it('Test No Data', () => {
  19. cy.visit(`${baseUrl}no-data.html`)
  20. .get('div.bootstrap-table').should('exist')
  21. .get('tr.no-records-found').should('be.visible')
  22. })
  23. it('Test Modal Table', () => {
  24. const html = theme ? `modal-table-${theme}.html` : 'modal-table.html'
  25. cy.visit(`${baseUrl}${html}`)
  26. .get('#button').wait(200).click()
  27. .get('.bootstrap-table').should('be.visible')
  28. .get('.fixed-table-container').should('have.css', 'height', '345px')
  29. .invoke('css', 'padding-bottom').then(str => parseInt(str)).should('be.greaterThan', 0)
  30. })
  31. it('Test Group Columns', () => {
  32. cy.visit(`${baseUrl}group-columns.html`)
  33. .get('.fixed-table-body thead tr:eq(0) th:eq(0)')
  34. .should('have.attr', 'colspan', '2')
  35. cy.get('.fixed-table-body thead tr:eq(0) th:eq(1)')
  36. .should('have.attr', 'rowspan', '2')
  37. cy.get('.columns .keep-open > button').click()
  38. if (theme === 'materialize') {
  39. cy.get('.columns input[data-field="name"]').parent().click()
  40. .get('.columns input[data-field="price"]').parent().click()
  41. } else {
  42. cy.get('.columns input[data-field="name"]').click()
  43. .get('.columns input[data-field="price"]').click()
  44. }
  45. cy.get('.fixed-table-body thead tr').should('have.length', 1)
  46. })
  47. it('Test Sub Table', () => {
  48. cy.visit(`${baseUrl}sub-table.html`)
  49. .get('a.detail-icon').click()
  50. .get('tr.detail-view a.detail-icon').click()
  51. .get('.bootstrap-table').should('have.length', 3)
  52. })
  53. it('Test Multiple Table', () => {
  54. cy.visit(`${baseUrl}multiple-table.html`)
  55. .get('.bootstrap-table').should('have.length', 4)
  56. })
  57. it('Test Flat Json', () => {
  58. cy.visit(`${baseUrl}flat-json.html`)
  59. .get('.bootstrap-table tr[data-index="0"] td:eq(1)').should('contain', 768)
  60. })
  61. it('Test Large data', () => {
  62. cy.visit(`${baseUrl}large-data.html`)
  63. .get('.bootstrap-table').should('exist')
  64. .get('#load').click()
  65. .get('#total').should('contain', '10000')
  66. cy.get('#append').click()
  67. .get('#total').should('contain', '20000')
  68. cy.get('#table tr[data-index]').should('have.length', 200)
  69. })
  70. it('Test Vue Component', () => {
  71. cy.visit(`${baseUrl}vue-component.html`)
  72. .get('.bootstrap-table').should('exist')
  73. .get('.fixed-table-toolbar > .columns').should('exist')
  74. .get('.fixed-table-toolbar > .search').should('exist')
  75. .get('.bootstrap-table tr[data-index]').should('have.length', 6)
  76. })
  77. })
  78. }