From 09283e1be4209ccdb59caf3c8b6064bf564fb57a Mon Sep 17 00:00:00 2001 From: Nick Lucas Date: Sun, 7 Nov 2021 22:12:08 +0000 Subject: [PATCH] Add support for validating tags --- packages/giterm-e2e/GuiValidator.ts | 16 ++++++++++++++++ packages/giterm-e2e/giterm.spec.ts | 4 ++++ .../app/renderer/components/sidebar/Tags.tsx | 8 ++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/packages/giterm-e2e/GuiValidator.ts b/packages/giterm-e2e/GuiValidator.ts index 6eb6cc03..7b4d568b 100644 --- a/packages/giterm-e2e/GuiValidator.ts +++ b/packages/giterm-e2e/GuiValidator.ts @@ -5,6 +5,9 @@ const REPO_STATUS = '[data-testid="StatusBar_Status"]' const BRANCH_STATUS = '[data-testid="StatusBar_Branch"]' const SHOW_REMOTE_SELECTOR = '[data-testid="StatusBar_ShowRemote"]' +const TAGS_OUTER = '[data-testid="tags"]' +const TAG_ROW = `[data-testid="tag"]` +const TAG_ROW_BY_NAME = (name: string) => `[data-tagid="${name}"]` const BRANCHES_OUTER = '[data-testid="branches"]' const BRANCH_ROW = `[data-testid="branch"]` const BRANCH_ROW_BY_NAME = (name: string) => `[data-branchid="${name}"]` @@ -52,6 +55,7 @@ interface CheckScreen { remote?: RemoteBranchInfo } branches: Omit[] + tags: Omit[] commits: number commitChecks: { index: number @@ -107,6 +111,7 @@ export class GuiValidator { await this.status(expected.status) await this.currentBranch(expected.currentBranch.name) await this.branches(expected.branches) + await this.tags(expected.tags) await this.commits(expected.commits) for (const commit of expected.commitChecks) { @@ -142,6 +147,17 @@ export class GuiValidator { } } + tags = async (tags: Omit[]) => { + const tagsSection = await this.exists(TAGS_OUTER) + + const tagRows = await tagsSection.$$(TAG_ROW) + expect(tagRows.length).toBe(tags.length) + + for (const tag of tags) { + await this.exists(TAG_ROW_BY_NAME(tag.name), tagsSection) + } + } + commits = async (count: number) => { const commits = await this.wd.$$(COMMIT_ROW) expect(commits.length).toBe(count) diff --git a/packages/giterm-e2e/giterm.spec.ts b/packages/giterm-e2e/giterm.spec.ts index 8221a1d9..e201a121 100644 --- a/packages/giterm-e2e/giterm.spec.ts +++ b/packages/giterm-e2e/giterm.spec.ts @@ -72,6 +72,7 @@ describe('giterm', () => { }, }, branches: [], + tags: [], commits: 0, commitChecks: [], }) @@ -94,6 +95,7 @@ describe('giterm', () => { }, }, branches: [], + tags: [], commits: 0, commitChecks: [], }) @@ -119,6 +121,7 @@ describe('giterm', () => { name: branchName, }, ], + tags: [], commits: 1, commitChecks: [ { @@ -169,6 +172,7 @@ describe('giterm', () => { }, }, ], + tags: [], commits: 1, commitChecks: [ { diff --git a/packages/giterm/app/renderer/components/sidebar/Tags.tsx b/packages/giterm/app/renderer/components/sidebar/Tags.tsx index 3204cf73..5176cc62 100644 --- a/packages/giterm/app/renderer/components/sidebar/Tags.tsx +++ b/packages/giterm/app/renderer/components/sidebar/Tags.tsx @@ -20,11 +20,15 @@ export function Tags() { }, [tags]) return ( -
}> +
}> {tags.map((tag, index) => { return ( - + {tag.name}