Skip to content

Commit b4ff197

Browse files
Fix GitHub tests (#112)
1 parent 4e1d9c5 commit b4ff197

File tree

2 files changed

+21
-43
lines changed

2 files changed

+21
-43
lines changed

src/button/button-contributions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ export const buttonContributions: ButtonContributionParams[] = [
194194
id: "gh-repo",
195195
exampleUrls: [
196196
// disabled testing, because the new layout doesn't show as an anonymous user
197-
// "https://github.com/svenefftinge/browser-extension-test",
198-
// "https://github.com/svenefftinge/browser-extension-test/tree/my-branch",
197+
"https://github.com/svenefftinge/browser-extension-test",
198+
"https://github.com/svenefftinge/browser-extension-test/tree/my-branch",
199199
],
200-
selector: `xpath://html/body/div[1]/div[6]/div/main/turbo-frame/div/div/div/div[2]/div[1]/react-partial/div/div/div[2]/div[2]`,
200+
selector: `xpath://*[@id="repo-content-pjax-container"]/div/div/div[2]/div[1]/react-partial/div/div/div[2]/div[2]`,
201201
containerElement: createElement("div", {}),
202202
additionalClassNames: ["medium"],
203203
application: "github",

test/src/button-contributions-copy.ts

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ export interface ButtonContributionParams {
3838
id: string,
3939

4040
/**
41-
*
41+
*
4242
*/
4343
exampleUrls: string[],
4444

4545
/**
4646
* A CSS selector that matches the parent element in which the button should be inserted.
47-
*
47+
*
4848
* Use the developer tools -> right click on the element -> "copy JS path" to get the selector.
4949
*/
5050
selector: string,
5151

5252
/**
5353
* The element in which the button should be inserted.
54-
*
54+
*
5555
* This element will be inserted into teh main document and allows for styling within the original page.
56-
*
56+
*
5757
* The structure looks like this:
58-
*
58+
*
5959
* <selector>
6060
* <some other elements/> ....
6161
* <containerElement>
@@ -94,7 +94,7 @@ export interface ButtonContributionParams {
9494

9595
/**
9696
* A list of manipulations that should be applied to the document.
97-
*
97+
*
9898
* Each manipulation contains a CSS selector (element) that is used to find the element to manipulate and optionally
9999
* the classnames to remove and add.
100100
*/
@@ -126,7 +126,7 @@ export const buttonContributions: ButtonContributionParams[] = [
126126
application: "gitlab",
127127
manipulations: [
128128
{
129-
// make the clone button secondary
129+
// make the clone button secondary
130130
element: "#clone-dropdown",
131131
remove: "btn-confirm",
132132
}
@@ -143,7 +143,7 @@ export const buttonContributions: ButtonContributionParams[] = [
143143
application: "gitlab",
144144
manipulations: [
145145
{
146-
// make the clone button secondary
146+
// make the clone button secondary
147147
element: "#fileHolder > div.js-file-title.file-title-flex-parent > div.gl-display-flex.gl-flex-wrap.file-actions > div.gl-sm-ml-3.gl-mr-3 > div > button",
148148
remove: "btn-confirm",
149149
}
@@ -161,7 +161,7 @@ export const buttonContributions: ButtonContributionParams[] = [
161161
insertBefore: "#content-body > div.merge-request > div.detail-page-header.border-bottom-0.gl-display-block.gl-pt-5.gl-md-display-flex\\!.is-merge-request > div.detail-page-header-actions.gl-align-self-start.is-merge-request.js-issuable-actions.gl-display-flex > div.gl-display-flex.gl-justify-content-end.gl-w-full.gl-relative",
162162
manipulations: [
163163
{
164-
// make the clone button secondary
164+
// make the clone button secondary
165165
element: "#content-body > div.merge-request > div.detail-page-header.border-bottom-0.gl-display-block.gl-pt-5.gl-md-display-flex\\!.is-merge-request > div.detail-page-header-actions.gl-align-self-start.is-merge-request.js-issuable-actions.gl-display-flex > div.gl-md-ml-3.dropdown.gl-dropdown.gl-display-none\\!.gl-md-display-flex\\! > button",
166166
remove: "btn-confirm",
167167
}
@@ -188,16 +188,16 @@ export const buttonContributions: ButtonContributionParams[] = [
188188
},
189189
],
190190
},
191-
191+
192192
// GitHub
193193
{
194-
id: "gh-new-repo",
194+
id: "gh-repo",
195195
exampleUrls: [
196196
// disabled testing, because the new layout doesn't show as an anonymous user
197-
// "https://github.com/svenefftinge/browser-extension-test",
198-
// "https://github.com/svenefftinge/browser-extension-test/tree/my-branch",
197+
"https://github.com/svenefftinge/browser-extension-test",
198+
"https://github.com/svenefftinge/browser-extension-test/tree/my-branch",
199199
],
200-
selector: `xpath://*[@id="repo-content-pjax-container"]/div/div/div[2]/div[1]/react-partial/div/div/div[1]/div/div/div[2]/div[2]/div/div[3]/div[1]/div[2]`,
200+
selector: `xpath://*[@id="repo-content-pjax-container"]/div/div/div[2]/div[1]/react-partial/div/div/div[2]/div[2]`,
201201
containerElement: createElement("div", {}),
202202
additionalClassNames: ["medium"],
203203
application: "github",
@@ -220,7 +220,7 @@ export const buttonContributions: ButtonContributionParams[] = [
220220
application: "github",
221221
additionalClassNames: ["medium"],
222222
},
223-
223+
224224
{
225225
id: "gh-issues",
226226
exampleUrls: [
@@ -234,7 +234,7 @@ export const buttonContributions: ButtonContributionParams[] = [
234234
application: "github",
235235
manipulations: [
236236
{
237-
// make the code button secondary
237+
// make the code button secondary
238238
element: "#partial-discussion-header > div.gh-header-show > div > div > a",
239239
remove: "Button--primary",
240240
add: "Button--secondary"
@@ -253,28 +253,6 @@ export const buttonContributions: ButtonContributionParams[] = [
253253
match: /\/pull\//,
254254
application: "github",
255255
},
256-
// Look into removing since GitHub is shifting to the new repo layout (see gh-new-repo)
257-
{
258-
id: "gh-repo",
259-
exampleUrls: [
260-
"https://github.com/svenefftinge/browser-extension-test",
261-
"https://github.com/svenefftinge/browser-extension-test/tree/my-branch",
262-
],
263-
selector: "#repo-content-turbo-frame > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.file-navigation.mb-3.d-flex.flex-items-start,#repo-content-pjax-container > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.file-navigation.mb-3.d-flex.flex-items-start",
264-
containerElement: createElement("div", {
265-
marginLeft: "8px",
266-
}),
267-
application: "github",
268-
additionalClassNames: ["medium"],
269-
manipulations: [
270-
{
271-
// make the code button secondary
272-
element: "#repo-content-pjax-container > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.file-navigation.mb-3.d-flex.flex-items-start > span.d-none.d-md-flex.ml-2 > get-repo > details > summary",
273-
remove: "Button--primary",
274-
add: "Button--secondary"
275-
}
276-
],
277-
},
278256
{
279257
id: "gh-file",
280258
exampleUrls: [
@@ -309,7 +287,7 @@ export const buttonContributions: ButtonContributionParams[] = [
309287
}
310288
}
311289
]
312-
290+
313291
},
314292
// Bitbucket Server
315293
{
@@ -391,4 +369,4 @@ export const buttonContributions: ButtonContributionParams[] = [
391369
}),
392370
application: "bitbucket",
393371
}
394-
];
372+
];

0 commit comments

Comments
 (0)