Skip to content

Commit 41a0dc9

Browse files
committed
chore: enforce sorting in locator files
1 parent f61911a commit 41a0dc9

File tree

14 files changed

+993
-1002
lines changed

14 files changed

+993
-1002
lines changed

eslint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,11 @@ export default tseslint.config(
8989
'perfectionist/sort-named-imports': 'off',
9090
'perfectionist/sort-union-types': 'off',
9191
},
92+
},
93+
{
94+
files: ['run/test/specs/locators/*'],
95+
rules: {
96+
'perfectionist/sort-modules': 'error',
97+
},
9298
}
9399
);

run/test/specs/locators/browsers.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
import { LocatorsInterface } from '.';
22

3-
// SHARED LOCATORS
4-
export class URLInputField extends LocatorsInterface {
3+
export class ChromeNotificationsNegativeButton extends LocatorsInterface {
54
public build() {
65
switch (this.platform) {
76
case 'android':
87
return {
98
strategy: 'id',
10-
selector: 'com.android.chrome:id/url_bar',
9+
selector: 'com.android.chrome:id/negative_button',
1110
} as const;
1211
case 'ios':
13-
return {
14-
strategy: 'accessibility id',
15-
selector: 'URL',
16-
} as const;
12+
throw new Error('Unsupported platform');
1713
}
1814
}
1915
}
2016

21-
// ANDROID ONLY
2217
export class ChromeUseWithoutAnAccount extends LocatorsInterface {
2318
public build() {
2419
switch (this.platform) {
@@ -34,43 +29,45 @@ export class ChromeUseWithoutAnAccount extends LocatorsInterface {
3429
}
3530
}
3631

37-
export class ChromeNotificationsNegativeButton extends LocatorsInterface {
32+
export class SafariAddressBar extends LocatorsInterface {
3833
public build() {
3934
switch (this.platform) {
4035
case 'android':
36+
throw new Error('Unsupported platform');
37+
case 'ios':
4138
return {
42-
strategy: 'id',
43-
selector: 'com.android.chrome:id/negative_button',
39+
strategy: 'accessibility id',
40+
selector: 'TabBarItemTitle',
4441
} as const;
45-
case 'ios':
46-
throw new Error('Unsupported platform');
4742
}
4843
}
4944
}
5045

51-
// iOS ONLY
52-
export class SafariAddressBar extends LocatorsInterface {
46+
export class SafariShareButton extends LocatorsInterface {
5347
public build() {
5448
switch (this.platform) {
5549
case 'android':
5650
throw new Error('Unsupported platform');
5751
case 'ios':
5852
return {
5953
strategy: 'accessibility id',
60-
selector: 'TabBarItemTitle',
54+
selector: 'ShareButton',
6155
} as const;
6256
}
6357
}
6458
}
65-
export class SafariShareButton extends LocatorsInterface {
59+
export class URLInputField extends LocatorsInterface {
6660
public build() {
6761
switch (this.platform) {
6862
case 'android':
69-
throw new Error('Unsupported platform');
63+
return {
64+
strategy: 'id',
65+
selector: 'com.android.chrome:id/url_bar',
66+
} as const;
7067
case 'ios':
7168
return {
7269
strategy: 'accessibility id',
73-
selector: 'ShareButton',
70+
selector: 'URL',
7471
} as const;
7572
}
7673
}

0 commit comments

Comments
 (0)