第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用javascript函數(shù)關(guān)閉cypress中打開的打印窗口

如何使用javascript函數(shù)關(guān)閉cypress中打開的打印窗口

倚天杖 2021-12-02 19:19:10
print window單擊柏樹中的打印按鈕時(shí),如何關(guān)閉打開的窗口。我正在調(diào)用一個js函數(shù)來關(guān)閉窗口并且它沒有執(zhí)行關(guān)閉,有人可以就如何解決問題提出建議嗎?context('Print button tests', () => {  it.only('Verify the display of Print and close the window', () => {    cy.get('.timetable-filter-panel-button.btn.btn-primary > span')      .contains("Print current view")      .click();    printClose();      })})//關(guān)閉打開窗口的Javascript函數(shù):function printClose(){    window.close(); }
查看完整描述

1 回答

?
慕勒3428872

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超6個贊

您可以像這樣使用 Cypress 測試打印彈出窗口:


it('Print button renders & opens modal', () => {

  // Clicks & asserts the button that triggers the popup window to print

  cy.get('[data-test="button-print"]')

    .should('exist')

    .and('be.visible')

    .click();


  // Assert printing was called once

  cy.visit('/inner.html', {

    onBeforeLoad: win => {

      cy.stub(win, 'print');

    },

  });


  cy.window().then(win => {

    win.print();

    expect(win.print).to.be.calledOnce;


    // this line closes the print popup

    cy.document().type({ esc });

  });

});


查看完整回答
反對 回復(fù) 2021-12-02
  • 1 回答
  • 0 關(guān)注
  • 287 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號