Skip to content

Commit

Permalink
cypress@10.9.0 & deprecate And & But functions for step definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
yeongsheng-tan committed Oct 1, 2022
1 parent 22727dc commit d5ce6ec
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 228 deletions.
4 changes: 2 additions & 2 deletions cypress/step_definitions/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <reference types="../support" />
// @ts-check

import { And, Given, Then, When } from "@badeball/cypress-cucumber-preprocessor"
import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor"

When("I create a new circle {string} and copy the invitation code", (circleName: string) => {
cy.openCirclesSelector()
Expand Down Expand Up @@ -69,7 +69,7 @@ When("There is a notebook {string} in circle {string}", (title, circleName) => {
cy.testability().seedNotes([{ title }], "", circleName)
})

And("someone of my circle deletes the {string} notebook", (noteTitle: string) => {
When("someone of my circle deletes the {string} notebook", (noteTitle: string) => {
cy.noteByTitle(noteTitle).deleteNoteViaAPI()
})

Expand Down
12 changes: 6 additions & 6 deletions cypress/step_definitions/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <reference types="../support" />
// @ts-check

import { And, Then, When } from "@badeball/cypress-cucumber-preprocessor"
import { Then, When } from "@badeball/cypress-cucumber-preprocessor"
import "../support/string.extensions"

When("I start searching", () => {
Expand Down Expand Up @@ -48,32 +48,32 @@ When(
},
)

And("I should see the source note as {string}", (noteTitle: string) => {
When("I should see the source note as {string}", (noteTitle: string) => {
cy.findByText(noteTitle, { selector: "strong" }).should("be.visible")
})

And("I should see {string} as the possible duplicate", (noteTitlesAsString: string) => {
When("I should see {string} as the possible duplicate", (noteTitlesAsString: string) => {
cy.tick(500)
cy.expectExactLinkTargets(noteTitlesAsString.commonSenseSplit(",").map((i: string) => i.trim()))
})

And(
When(
"I should see {string} as targets only when searching {string}",
(noteTitlesAsString: string, searchKey: string) => {
cy.searchNote(searchKey, [])
cy.expectExactLinkTargets(noteTitlesAsString.commonSenseSplit(",").map((i: string) => i.trim()))
},
)

And(
When(
"I should see {string} as targets only when searching in all my notebooks {string}",
(noteTitlesAsString: string, searchKey: string) => {
cy.searchNote(searchKey, ["All My Notebooks And Subscriptions"])
cy.expectExactLinkTargets(noteTitlesAsString.commonSenseSplit(",").map((i: string) => i.trim()))
},
)

And(
When(
"I should see note cannot be found when searching in all my notebooks {string}",
(searchKey: string) => {
cy.searchNote(searchKey, ["All My Notebooks And Subscriptions"])
Expand Down
6 changes: 3 additions & 3 deletions cypress/step_definitions/wikidata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// <reference types="../support" />
// @ts-check

import { And, Given, Then, When } from "@badeball/cypress-cucumber-preprocessor"
import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor"

When("I associate the note {string} with wikidata id {string}", (title, wikiID) => {
cy.associateNoteWithWikidataId(title, wikiID)
Expand Down Expand Up @@ -72,12 +72,12 @@ Given(
},
)

And("I search with title {string} on Wikidata", (title: string) => {
When("I search with title {string} on Wikidata", (title: string) => {
cy.focused().clear().type(title)
cy.findByRole("button", { name: "Search on Wikidata" }).click()
})

And("I select wikidataID {string} from the Wikidata search result", (wikidataID: string) => {
When("I select wikidataID {string} from the Wikidata search result", (wikidataID: string) => {
cy.get('select[name="wikidataSearchResult"]').select(wikidataID)
})

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
},
"devDependencies": {
"@anev/ts-mountebank": "^1.6",
"@badeball/cypress-cucumber-preprocessor": "^12.2",
"@badeball/cypress-cucumber-preprocessor": "^13.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1",
"@testing-library/cypress": "8.0",
"@types/cypress-cucumber-preprocessor": "^4.0",
"@types/node": "^18.7",
"@typescript-eslint/eslint-plugin": "^5.37",
"@typescript-eslint/parser": "^5.37",
"cypress": "^10.8",
"cypress": "^10.9",
"cypress-file-upload": "^5.0",
"esbuild": "^0.15",
"eslint": "^8.22",
Expand Down
Loading

0 comments on commit d5ce6ec

Please sign in to comment.