Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. describe('My Learning', () => {
  3.     let filterNames = ['Progress', 'Source', 'Types', 'On Going', 'Saved For Later', 'History', 'Pending Request', 'Deleted',
  4.         'Recommended', 'Assignment', 'My Selection', 'Learning', 'Path', 'Event', 'Podcast', 'Video', 'Text']
  5.  
  6.  
  7.     before(() => {
  8.         cy.visit("/dashboard")
  9.         cy.topUIChecker()
  10.         cy.botChecker()
  11.     })
  12.  
  13.     it("Unfiltered cards available , tags available", () => {
  14.  
  15.         // let Learning = ['Article', ''];
  16.         // let Path = [''];
  17.         // let Event = [''];
  18.         // let Podcast = [''];
  19.         // let Video = [''];
  20.         // let Text = ['']; TODO сделать проверку по фильтру
  21.  
  22.         //check unfiltered cards count(all types)
  23.  
  24.         cy.cardInfoChecker()
  25.         cy.get('.cardWrapper').its('length').should('be.gte', 10)
  26.         cy.get('.tags-text').its('length').should('be.gte', 10)
  27.  
  28.     })
  29.     it.only("Date filter available, logic of all data filters", () => {
  30.         cy.get('.sortDropdown').should('be.visible').last().click()
  31.         let sortSelector = cy.get('.MuiPaper-root.MuiPaper-elevation1.MuiPaper-rounded').children('div')
  32.         sortSelector.should('contain', "Sort")
  33.         sortSelector.should('contain', 'Latest').click().then(() => {
  34.             cy.get('.cardWrapper').should('contain', 'Deep')
  35.         })
  36.         sortSelector.should('contain', 'Oldest').click().then(() => {
  37.             cy.get('.cardWrapper').first().should('contain', 'Beautiful')
  38.         })
  39.  
  40.         sortSelector.should('contain', 'A-Z').click().then(() => {
  41.             cy.get('.cardWrapper').first().should('contain', '22222')
  42.         })
  43.         sortSelector.should('contain', 'Z-A').click().then(() => {
  44.             cy.get('.cardWrapper').first().should('contain', 'Medal')
  45.         })
  46.  
  47.  
  48.     })
  49.     it('Filter logic , available all filter positions, filter counter', () => {
  50.  
  51.         //filter available
  52.         cy.get('.sortDropdown').should('be.visible').first().click()
  53.  
  54.         //check all filter's text
  55.         cy.get('.MuiPaper-root.MuiPaper-elevation1.MuiPaper-rounded').should('be.visible')
  56.         for (let index in filterNames) {
  57.             cy.get('.MuiPaper-root.MuiPaper-elevation1.MuiPaper-rounded').should('contain', filterNames[index])
  58.         }
  59.  
  60.  
  61.         //filter's count visible-invisible
  62.         if (cy.get('.sortDropdown').first().not('.main_color_color')) {
  63.             cy.get('.sortDropdown').first().find(filterNames[3]).click()
  64.             cy.get('.main_color_color').should('be.visible')
  65.             cy.contains(filterNames[8]).click().then(() => {
  66.                 //filter count +1
  67.                 cy.get('.main_color_color').should('have.text', '(2)')
  68.             })
  69.         }
  70.     })
  71.     it('Sorted tags by filter (Filter tags)', () => {
  72.         //filter sorted tags visible
  73.         cy.get('.tags-text').should("have.length", "6").and('be.visible')
  74.  
  75.  
  76.     })
  77.  
  78.  
  79.     it('Visibility of Title, Card, Image, LvL, Text, textTags, Share btn, Delete btn, Report btn, Label', () => {
  80.         //TODO buttons,label
  81.         //title
  82.         cy.contains('My Learning').should('be.visible')
  83.  
  84.         //check filter result
  85.         cy.get('.cardInfo').should('be.visible').should('contain', 'Deep')
  86.         cy.get('.my-learning-smart-list').find('.cardWrapper')
  87.  
  88.  
  89.     })
  90. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement