2020-11-22 15:50:07 -05:00
|
|
|
/*
|
2021-01-06 15:37:59 -05:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 15:50:07 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-07-16 05:22:53 -04:00
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
|
|
|
/**
|
|
|
|
* Custom command to check an external Link.
|
|
|
|
* @example cy.get(a#extern).checkExternalLink('http://example.com')
|
|
|
|
*/
|
2021-02-03 16:13:04 -05:00
|
|
|
checkExternalLink(url: string): Chainable<Element>
|
2020-07-16 05:22:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('checkExternalLink', { prevSubject: 'element' }, ($element: JQuery, url: string) => {
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.wrap($element).should('have.attr', 'href', url).should('have.attr', 'target', '_blank')
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|