Aliendreamer

example

Sep 13th, 2020
757
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. export default class BasePage {
  3.  
  4.    static clearDbBeforeTests(){
  5.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').catalogs.drop()');
  6.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').headers.drop()');
  7.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').items.drop()');
  8.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\')[\'parent-catalogs\'].drop()');
  9.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\')[\'parent-screens\'].drop()');
  10.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').queries.drop()');
  11.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').rows.drop()');
  12.       cy.exec( 'docker exec -i mongo mongo -u mcadmin -p mcadmin  --eval db.getSiblingDB(\'local\').screens.drop()');
  13.  
  14.       cy.debug();
  15.    }
  16.    static loginBeforeTest(page="/"){
  17.       const token = localStorage.getItem('kc_token');
  18.       cy.visit(page);
  19.       if(!token)
  20.          cy.login()
  21.    }
  22. }
  23.  
  24.  
  25.  
  26. import BasePage from "./BasePage";
  27.  
  28. export default class ScreensPage extends BasePage{
  29.  
  30.  
  31. }
  32.  
  33.  
  34. import  ScreensPage  from"../pages/ScreensPage";
  35.  
  36. describe("should test screens",()=>{
  37.    before(() => {
  38.     ScreensPage.clearDbBeforeTests();
  39.     ScreensPage.loginBeforeTest();
  40.     })
  41.    it("should try login",()=>{
  42.       cy.visit("/")
  43.      
  44.    })
  45. })
  46.  
  47.  
RAW Paste Data