Skip to content

Commit

Permalink
refactor(assertions): use alias cy.url in url
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 24, 2022
1 parent a255ba0 commit a336ace
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/assertions/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
* ```
*/
export function Then_I_see_URL(url: string) {
cy.location('href').should('equal', (Cypress.config().baseUrl || '') + url);
const baseUrl = Cypress.config().baseUrl || '';
cy.url().should('equal', baseUrl + url);
}

Then('I see URL {string}', Then_I_see_URL);
Expand All @@ -42,7 +43,7 @@ Then('I see URL {string}', Then_I_see_URL);
* ```
*/
export function Then_I_see_URL_contains(url: string) {
cy.location('href').should('contain', url);
cy.url().should('contain', url);
}

Then('I see URL contains {string}', Then_I_see_URL_contains);

0 comments on commit a336ace

Please sign in to comment.