Skip to content

Commit d513d17

Browse files
committed
feat: add gherkin and test parsers
test: add tests on `parseTest` function
1 parent ba1732b commit d513d17

37 files changed

Lines changed: 1178 additions & 10 deletions

‎.eslintrc.yaml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ rules:
8888
- src/*/internal.ts
8989
- src/bin/*.ts
9090
- src/config.ts
91-
- src/createLocator.ts
92-
- src/getModulesGraph.ts
9391
- src/index.ts
9492
missingExports: true
9593
unusedExports: true
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {test} from 'autotests';
2+
import {expect} from 'e2ed';
3+
import {
4+
type Attributes,
5+
createSimpleLocator,
6+
createTestLocator,
7+
getCssSelectorFromAttributesChain,
8+
} from 'e2ed/createLocator';
9+
import {
10+
getModulesGraph,
11+
type Options,
12+
resolveImports,
13+
resolveReexports,
14+
} from 'e2ed/getModulesGraph';
15+
import {type Feature, parseGherkin, ParseGherkinError} from 'e2ed/parseGherkin';
16+
17+
test('External libraries are reexported correctly', {meta: {testId: '35'}}, async () => {
18+
await expect(typeof createSimpleLocator, '`createSimpleLocator` is a function').eql('function');
19+
20+
await expect(typeof createTestLocator, '`createTestLocator` is a function').eql('function');
21+
22+
await expect(
23+
typeof getCssSelectorFromAttributesChain,
24+
'`getCssSelectorFromAttributesChain` is a function',
25+
).eql('function');
26+
27+
await expect(typeof getModulesGraph, '`getModulesGraph` is a function').eql('function');
28+
29+
await expect(typeof resolveImports, '`resolveImports` is a function').eql('function');
30+
31+
await expect(typeof resolveReexports, '`resolveReexports` is a function').eql('function');
32+
33+
await expect(typeof parseGherkin, '`parseGherkin` is a function').eql('function');
34+
35+
await expect(typeof ParseGherkinError, '`ParseGherkinError` is a class').eql('function');
36+
37+
const locatorAttributes: Attributes = {};
38+
const modulesGraphOptions: Partial<Options> = {};
39+
const gherkinFeatures: readonly Feature[] = [];
40+
41+
await expect(
42+
typeof locatorAttributes === 'object' &&
43+
typeof modulesGraphOptions === 'object' &&
44+
gherkinFeatures.length === 0,
45+
'Types from external libraries are imported correctly',
46+
).ok();
47+
});

‎autotests/tests/internalTypeTests/createPageObjectsFromMultiSelector.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable max-classes-per-file */
22

3+
import {test} from 'autotests';
34
import {type CreateLocator, createRootLocator, type Locator, type Node} from 'e2ed/createLocator';
45
import {createPageObjectsFromMultiLocator} from 'e2ed/utils';
56

@@ -19,6 +20,8 @@ type BarMappedLocator = CreateLocator<Locator<{qux: Void}>, Selector>;
1920

2021
true satisfies IsEqual<typeof fooLocator, CreateLocator<FooLocator, Selector>>;
2122

23+
test('Skipped test', {meta: {testId: '26'}}, async () => {});
24+
2225
class Foo {
2326
readonly bar: string;
2427

‎autotests/tests/internalTypeTests/expect.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-call */
22

3+
import {test} from 'autotests';
34
import {htmlElementSelector} from 'autotests/selectors';
45
import {expect} from 'e2ed';
56

7+
test('Skipped test', {meta: {testId: '27'}}, async () => {});
8+
69
const someNumber = 3;
710

811
// ok

‎autotests/tests/internalTypeTests/mockApiRoute.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {test} from 'autotests';
12
import {CreateDevice, CreateProduct} from 'autotests/routes/apiRoutes';
23
import {Main} from 'autotests/routes/pageRoutes';
34
import {mockApiRoute, unmockApiRoute} from 'e2ed/actions';
@@ -29,6 +30,8 @@ const apiMockFunction = (
2930
return {responseBody};
3031
};
3132

33+
test('Skipped test', {meta: {testId: '28'}}, async () => {});
34+
3235
// @ts-expect-error: mockApiRoute require API route as first argument
3336
void mockApiRoute(Main, apiMockFunction);
3437

‎autotests/tests/internalTypeTests/mockWebSocketRoute.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {test} from 'autotests';
12
import {Main} from 'autotests/routes/pageRoutes';
23
import {Base, Score} from 'autotests/routes/webSocketRoutes';
34
import {mockWebSocketRoute, unmockWebSocketRoute} from 'e2ed/actions';
@@ -18,6 +19,8 @@ const webSocketMockFunction = (
1819
return {score: size > 2 ? size : 2};
1920
};
2021

22+
test('Skipped test', {meta: {testId: '29'}}, async () => {});
23+
2124
// @ts-expect-error: mockWebSocketRoute require WebSocket route as first argument
2225
void mockWebSocketRoute(Main, anyMockFunction);
2326

‎autotests/tests/internalTypeTests/pages.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
* @file Tests of TypeScript types for pages.
33
*/
44

5+
import {test} from 'autotests';
56
import {Main, Search, Services} from 'autotests/pageObjects/pages';
67
import {navigateToPage} from 'e2ed/actions';
78

9+
test('Skipped test', {meta: {testId: '30'}}, async () => {});
10+
811
/**
912
* PageParams = Readonly<{mobileDevice?: MobileDeviceModel, query?: string}>
1013
*/

‎autotests/tests/internalTypeTests/request.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {test} from 'autotests';
12
import {CreateDevice, UserSignUp} from 'autotests/routes/apiRoutes';
23
import {Main} from 'autotests/routes/pageRoutes';
34
import {getRandomId} from 'e2ed/generators';
@@ -9,6 +10,8 @@ declare const apiUserParams: ApiUserParams;
910
declare const model: MobileDeviceModel;
1011
declare const apiDeviceParams: ApiDeviceParams;
1112

13+
test('Skipped test', {meta: {testId: '31'}}, async () => {});
14+
1215
// @ts-expect-error: request require API route as first argument
1316
void request(Main, {requestBody: apiUserParams});
1417

‎autotests/tests/internalTypeTests/routes.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
* @file Tests of TypeScript types for routes.
55
*/
66

7+
import {test} from 'autotests';
78
import {CreateDevice, UserSignUp} from 'autotests/routes/apiRoutes';
89
import {Search} from 'autotests/routes/pageRoutes';
910

11+
test('Skipped test', {meta: {testId: '32'}}, async () => {});
12+
1013
/**
1114
* RouteParams = Readonly<{model: MobileDevice}>
1215
*/

‎autotests/tests/internalTypeTests/selectors.skip.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import {test} from 'autotests';
12
import {createSelector, htmlElementSelector, locator} from 'autotests/selectors';
23

34
import type {Selector} from 'e2ed/types';
45

6+
test('Skipped test', {meta: {testId: '33'}}, async () => {});
7+
58
// @ts-expect-error: wrong number of arguments
69
htmlElementSelector.findByTestId();
710
// ok

0 commit comments

Comments
 (0)