Skip to content

Commit 18c29ef

Browse files
committed
fix: update detect code page
1 parent e3fecf8 commit 18c29ef

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

__tests__/cases/non-parallel/pjax.general.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ describe(`in Gitako project page`, () => {
3333
page.goBack()
3434
await sleep(1000)
3535

36-
expect(await getTextContent(selectors.github.breadcrumbFileName)).toBe('analytics.ts')
36+
expect(await getTextContent(selectors.github.breadcrumbFileName)).toBe('/analytics.ts')
3737
})
3838
})

__tests__/cases/parallel/expand-to-target.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe(`in Gitako project page`, () => {
1010
// Expect Gitako sidebar to have expanded src to see contents
1111
await expectToFind(selectors.gitako.fileItemOf('src/components'))
1212

13-
await page.click(selectors.github.fileListItem('components'))
13+
await page.click(selectors.github.fileListItemOf('components'))
1414
await waitForRedirect()
1515

1616
// Expect Gitako sidebar to have expanded components and see contents

__tests__/selectors.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export const selectors = {
22
github: {
3-
breadcrumbFileName: `[data-testid="breadcrumbs-filename"] #file-name-id`,
3+
breadcrumbFileName: `[data-testid="breadcrumbs-filename"]`,
44
fileContent: 'textarea[aria-label="file content"]',
55
commitLinks: `main .TimelineItem-body ol li > div:nth-child(1) a[href*="/commit/"]`,
66
// assume title contains `.` is file item
7-
fileListItemFileLinks: `#repo-content-turbo-frame [aria-labelledby="folders-and-files"] tr.react-directory-row .react-directory-filename-column .react-directory-truncate[title*="."] a`,
8-
fileListItem: (name: string) =>
9-
`#repo-content-turbo-frame [aria-labelledby="folders-and-files"] tr.react-directory-row [title="${name}"]`,
7+
fileListItemFileLinks: `#repo-content-turbo-frame [aria-labelledby="folders-and-files"] tr.react-directory-row td:not(.react-directory-row-name-cell-small-screen) .react-directory-filename-column .react-directory-truncate[title*="."] a`,
8+
fileListItemOf: (name: string) =>
9+
`#repo-content-turbo-frame [aria-labelledby="folders-and-files"] tr.react-directory-row td:not(.react-directory-row-name-cell-small-screen) [title="${name}"]`,
1010
commitSummary: 'div.commit',
1111
navBarItemIssues: 'a[data-selected-links^="repo_issues "]',
1212
navBarItemPulls: 'a[data-selected-links^="repo_pulls "]',

src/platforms/GitHub/DOMHelper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { renderReact } from 'utils/general'
88
const selectors = {
99
normal: {
1010
reactApp: `react-app[app-name="react-code-view"] [data-target="react-app.reactRoot"]`,
11-
branchSwitcher: `summary[title="Switch branches or tags"]`,
11+
branchSwitcher: [`summary[title="Switch branches or tags"]`, `#branch-select-menu`].join(),
1212
fileNavigation: `.file-navigation`,
1313
breadcrumbs: `[data-testid="breadcrumbs"]`,
1414
breadcrumbsFilename: `[data-testid="breadcrumbs-filename"]`,

0 commit comments

Comments
 (0)