2020-11-22 20:50:07 +00:00
|
|
|
/*
|
2021-01-06 20:37:59 +00:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-07-16 09:22:53 +00: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 21:13:04 +00:00
|
|
|
checkExternalLink(url: string): Chainable<Element>
|
2020-07-16 09:22:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('checkExternalLink', { prevSubject: 'element' }, ($element: JQuery, url: string) => {
|
2021-02-03 21:13:04 +00:00
|
|
|
cy.wrap($element)
|
|
|
|
.should('have.attr', 'href', url)
|
2020-07-16 09:22:53 +00:00
|
|
|
.should('have.attr', 'target', '_blank')
|
|
|
|
})
|