1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

add testids for attachments (#9892)

This commit is contained in:
Nick Krantz 2024-07-01 11:01:31 -05:00 committed by GitHub
parent c63e50908b
commit b060c15836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View File

@ -4,8 +4,8 @@
<li *ngFor="let attachment of cipher.attachments">
<bit-item>
<bit-item-content>
{{ attachment.fileName }}
<span slot="secondary">{{ attachment.sizeName }}</span>
<span data-testid="file-name">{{ attachment.fileName }}</span>
<span slot="secondary" data-testid="file-size">{{ attachment.sizeName }}</span>
</bit-item-content>
<ng-container slot="end">
<bit-item-action>

View File

@ -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;