Skip to content

Commit

Permalink
feat(testcafe): add support for latest versions of testcafe (#138)
Browse files Browse the repository at this point in the history
No changes were need on the runner side so any version previously supported should still be
supported now

#133
  • Loading branch information
Arthy000 authored Aug 5, 2023
1 parent 0c67d3d commit 369175c
Show file tree
Hide file tree
Showing 7 changed files with 487 additions and 648 deletions.
4 changes: 2 additions & 2 deletions examples/custom-param-type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { When, Then } from '@cucumber/cucumber';
import { Selector as NativeSelector } from 'testcafe';
import { Selector as NativeSelector } from 'gherkin-testcafe';

const Selector = (input, t) => {
return NativeSelector(input).with({ boundTestRun: t });
Expand All @@ -11,6 +11,6 @@ When('I search for the "{color}" color on Google', async (t, [color]) => {
});

Then('I should see the "{word}" result in the page', async (t, [value]) => {
const result = Selector('div', t).withText(value);
const result = Selector('td', t).withText(value);
await t.expect(result.visible).ok();
});
8 changes: 3 additions & 5 deletions examples/datatable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Given, When, Then } from '@cucumber/cucumber';
import { Selector as NativeSelector } from 'testcafe';
import { Selector as NativeSelector } from 'gherkin-testcafe';

const Selector = (input, t) => {
return NativeSelector(input).with({ boundTestRun: t });
Expand All @@ -17,10 +17,8 @@ When('I click on 5 checkboxes', async (t, [], table) => {

Then(/^The amount of selected checkboxes should be "(.+)"$/, async (t, [amount]) => {
const selectedCheckboxes = Selector('input[type="checkbox"]').filter((checkbox) =>
Boolean(checkbox && checkbox.checked)
Boolean(checkbox && checkbox.checked),
);

const checkedCount = await selectedCheckboxes.count;

await t.expect(checkedCount).eql(Number(amount));
await t.expect(selectedCheckboxes.count).eql(Number(amount));
});
2 changes: 1 addition & 1 deletion examples/doc-strings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Given, Then } from '@cucumber/cucumber';
import { Selector } from 'testcafe';
import { Selector } from 'gherkin-testcafe';

Given("I opened TestCafe's demo page", async (t) => {
await t.navigateTo('https://devexpress.github.io/testcafe/example/');
Expand Down
4 changes: 2 additions & 2 deletions examples/google.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Given, When, Then, Before } from '@cucumber/cucumber';
import { Selector as NativeSelector } from '../src'; // use 'gherkin-testcafe' outside of this repository
import { Selector as NativeSelector } from 'gherkin-testcafe';

const Selector = (input, t) => {
return NativeSelector(input).with({ boundTestRun: t });
Expand Down Expand Up @@ -47,7 +47,7 @@ Then(
/^I should see that the first Google's result is "(.+)"$/,
async (t: TestController, [expectedSearchResult]: string[]) => {
await expectGoogleResult(t, expectedSearchResult);
}
},
);

Then(/^I should see that the first Google's result is as expected$/, async (t: TestController) => {
Expand Down
4 changes: 2 additions & 2 deletions examples/http-authentication-example.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { existsSync } from 'fs';
import { Given, When, Then } from '@cucumber/cucumber';
import { Selector } from 'testcafe';
import { Selector } from 'gherkin-testcafe';

const linkSelector = Selector(
'div.row:nth-child(3) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > a:nth-child(3)'
'div.row:nth-child(3) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > a:nth-child(3)',
);

Given('I created an HTTP authentication file for my feature', async (t) => {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@
"peerDependencies": {
"@cucumber/cucumber": "^9.1.0",
"@cucumber/cucumber-expressions": "^16.0.0",
"testcafe": "^2.0.0 <= 2.5.0"
"testcafe": "^2.0.0 <= 3.1.0"
},
"devDependencies": {
"@cucumber/cucumber": "^9.1.0",
"@cucumber/cucumber": "9.3.0",
"@cucumber/cucumber-expressions": "^16.1.2",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "3.3.0",
"jest": "^29.5.0",
"prettier": "^2.8.8",
"jest": "^29.6.2",
"prettier": "^3.0.1",
"standard-version": "^9.5.0",
"testcafe": "2.5.0"
"testcafe": "3.1.0"
},
"config": {
"commitizen": {
Expand Down
Loading

0 comments on commit 369175c

Please sign in to comment.