From b060c1583645a5dec847b1c526d8af9d6b18b068 Mon Sep 17 00:00:00 2001
From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com>
Date: Mon, 1 Jul 2024 11:01:31 -0500
Subject: [PATCH] add testids for attachments (#9892)
---
.../cipher-attachments.component.html | 4 ++--
.../cipher-attachments.component.spec.ts | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.html b/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.html
index bcadf7a433..46e8092d90 100644
--- a/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.html
+++ b/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.html
@@ -4,8 +4,8 @@
- {{ attachment.fileName }}
- {{ attachment.sizeName }}
+ {{ attachment.fileName }}
+ {{ attachment.sizeName }}
diff --git a/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.spec.ts b/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.spec.ts
index 8b5a76b3f3..42c6c530ee 100644
--- a/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.spec.ts
+++ b/apps/browser/src/vault/popup/components/vault-v2/attachments/cipher-attachments/cipher-attachments.component.spec.ts
@@ -103,6 +103,24 @@ describe("CipherAttachmentsComponent", () => {
expect(component.cipher).toEqual(cipherView);
});
+ it("sets testids for automation testing", () => {
+ const attachment = {
+ id: "1234-5678",
+ fileName: "test file.txt",
+ sizeName: "244.2 KB",
+ } as AttachmentView;
+
+ component.cipher.attachments = [attachment];
+
+ fixture.detectChanges();
+
+ const fileName = fixture.debugElement.query(By.css('[data-testid="file-name"]'));
+ const fileSize = fixture.debugElement.query(By.css('[data-testid="file-size"]'));
+
+ expect(fileName.nativeElement.textContent).toEqual(attachment.fileName);
+ expect(fileSize.nativeElement.textContent).toEqual(attachment.sizeName);
+ });
+
describe("bitSubmit", () => {
beforeEach(() => {
component.submitBtn.disabled = undefined;