Rename data-e2e to data-test

This commit is contained in:
Tim Donohue
2022-03-17 11:51:18 -05:00
parent bc705df144
commit 15acb47afa
15 changed files with 51 additions and 51 deletions

View File

@@ -16,8 +16,8 @@ describe('Homepage', () => {
it('should have a working search box', () => {
const queryString = 'test';
cy.get('[data-e2e="search-box"]').type(queryString);
cy.get('[data-e2e="search-button"]').click();
cy.get('[data-test="search-box"]').type(queryString);
cy.get('[data-test="search-button"]').click();
cy.url().should('include', '/search');
cy.url().should('include', 'query=' + encodeURI(queryString));
});

View File

@@ -3,31 +3,31 @@ import { TEST_ADMIN_PASSWORD, TEST_ADMIN_USER, TEST_ENTITY_PUBLICATION } from 'c
const page = {
openLoginMenu() {
// Click the "Log In" dropdown menu in header
cy.get('ds-themed-navbar [data-e2e="login-menu"]').click();
cy.get('ds-themed-navbar [data-test="login-menu"]').click();
},
openUserMenu() {
// Once logged in, click the User menu in header
cy.get('ds-themed-navbar [data-e2e="user-menu"]').click();
cy.get('ds-themed-navbar [data-test="user-menu"]').click();
},
submitLoginAndPasswordByPressingButton(email, password) {
// Enter email
cy.get('ds-themed-navbar [data-e2e="email"]').type(email);
cy.get('ds-themed-navbar [data-test="email"]').type(email);
// Enter password
cy.get('ds-themed-navbar [data-e2e="password"]').type(password);
cy.get('ds-themed-navbar [data-test="password"]').type(password);
// Click login button
cy.get('ds-themed-navbar [data-e2e="login-button"]').click();
cy.get('ds-themed-navbar [data-test="login-button"]').click();
},
submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter
cy.get('ds-themed-navbar [data-e2e="email"]').type(email);
cy.get('ds-themed-navbar [data-e2e="password"]').type(password);
cy.get('ds-themed-navbar [data-e2e="password"]').type('{enter}');
cy.get('ds-themed-navbar [data-test="email"]').type(email);
cy.get('ds-themed-navbar [data-test="password"]').type(password);
cy.get('ds-themed-navbar [data-test="password"]').type('{enter}');
},
submitLogoutByPressingButton() {
// This is the POST command that will actually log us out
cy.intercept('POST', '/server/api/authn/logout').as('logout');
// Click logout button
cy.get('ds-themed-navbar [data-e2e="logout-button"]').click();
cy.get('ds-themed-navbar [data-test="logout-button"]').click();
// Wait until above POST command responds before continuing
// (This ensures next action waits until logout completes)
cy.wait('@logout');
@@ -102,10 +102,10 @@ describe('Login Modal', () => {
page.openLoginMenu();
// Registration link should be visible
cy.get('ds-themed-navbar [data-e2e="register"]').should('be.visible');
cy.get('ds-themed-navbar [data-test="register"]').should('be.visible');
// Click registration link & you should go to registration page
cy.get('ds-themed-navbar [data-e2e="register"]').click();
cy.get('ds-themed-navbar [data-test="register"]').click();
cy.location('pathname').should('eq', '/register');
cy.get('ds-register-email').should('exist');
});
@@ -116,10 +116,10 @@ describe('Login Modal', () => {
page.openLoginMenu();
// Forgot password link should be visible
cy.get('ds-themed-navbar [data-e2e="forgot"]').should('be.visible');
cy.get('ds-themed-navbar [data-test="forgot"]').should('be.visible');
// Click link & you should go to Forgot Password page
cy.get('ds-themed-navbar [data-e2e="forgot"]').click();
cy.get('ds-themed-navbar [data-test="forgot"]').click();
cy.location('pathname').should('eq', '/forgot');
cy.get('ds-forgot-email').should('exist');
});

View File

@@ -11,7 +11,7 @@ describe('My DSpace page', () => {
cy.get('ds-my-dspace-page').should('exist');
// At least one recent submission should be displayed
cy.get('[data-e2e="list-object"]').should('be.visible');
cy.get('[data-test="list-object"]').should('be.visible');
// Click each filter toggle to open *every* filter
// (As we want to scan filter section for accessibility issues as well)
@@ -43,7 +43,7 @@ describe('My DSpace page', () => {
cy.get('ds-my-dspace-page').should('exist');
// Click button in sidebar to display detailed view
cy.get('ds-search-sidebar [data-e2e="detail-view"]').click();
cy.get('ds-search-sidebar [data-test="detail-view"]').click();
cy.get('ds-object-detail').should('exist');
@@ -109,8 +109,8 @@ describe('My DSpace page', () => {
// This is the GET command that will actually run the search
cy.intercept('GET', '/server/api/discover/search/objects*').as('search-results');
// On MyDSpace, find the submission we just created via its ID
cy.get('[data-e2e="search-box"]').type(id);
cy.get('[data-e2e="search-button"]').click();
cy.get('[data-test="search-box"]').type(id);
cy.get('[data-test="search-button"]').click();
// Wait for search results to come back from the above GET command
cy.wait('@search-results');

View File

@@ -3,15 +3,15 @@ import { TEST_SEARCH_TERM } from 'cypress/support';
const page = {
fillOutQueryInNavBar(query) {
// Click the magnifying glass
cy.get('ds-themed-navbar [data-e2e="header-search-icon"]').click();
cy.get('ds-themed-navbar [data-test="header-search-icon"]').click();
// Fill out a query in input that appears
cy.get('ds-themed-navbar [data-e2e="header-search-box"]').type(query);
cy.get('ds-themed-navbar [data-test="header-search-box"]').type(query);
},
submitQueryByPressingEnter() {
cy.get('ds-themed-navbar [data-e2e="header-search-box"]').type('{enter}');
cy.get('ds-themed-navbar [data-test="header-search-box"]').type('{enter}');
},
submitQueryByPressingIcon() {
cy.get('ds-themed-navbar [data-e2e="header-search-icon"]').click();
cy.get('ds-themed-navbar [data-test="header-search-icon"]').click();
}
};
@@ -31,7 +31,7 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('[data-e2e="list-object"]').should('be.visible');
cy.get('[data-test="list-object"]').should('be.visible');
});
it('should go to search page with correct query if submitted (from search)', () => {
@@ -46,7 +46,7 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('[data-e2e="list-object"]').should('be.visible');
cy.get('[data-test="list-object"]').should('be.visible');
});
it('should allow user to also submit query by clicking icon', () => {
@@ -61,6 +61,6 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('[data-e2e="list-object"]').should('be.visible');
cy.get('[data-test="list-object"]').should('be.visible');
});
});

View File

@@ -7,20 +7,20 @@ describe('Search Page', () => {
const queryString = 'Another interesting query string';
cy.visit('/search');
// Type query in searchbox & click search button
cy.get('[data-e2e="search-box"]').type(queryString);
cy.get('[data-e2e="search-button"]').click();
cy.get('[data-test="search-box"]').type(queryString);
cy.get('[data-test="search-button"]').click();
cy.url().should('include', 'query=' + encodeURI(queryString));
});
it('should load results and pass accessibility tests', () => {
cy.visit('/search?query=' + TEST_SEARCH_TERM);
cy.get('[data-e2e="search-box"]').should('have.value', TEST_SEARCH_TERM);
cy.get('[data-test="search-box"]').should('have.value', TEST_SEARCH_TERM);
// <ds-search-page> tag must be loaded
cy.get('ds-search-page').should('exist');
// At least one search result should be displayed
cy.get('[data-e2e="list-object"]').should('be.visible');
cy.get('[data-test="list-object"]').should('be.visible');
// Click each filter toggle to open *every* filter
// (As we want to scan filter section for accessibility issues as well)
@@ -48,13 +48,13 @@ describe('Search Page', () => {
cy.visit('/search?query=' + TEST_SEARCH_TERM);
// Click button in sidebar to display grid view
cy.get('ds-search-sidebar [data-e2e="grid-view"]').click();
cy.get('ds-search-sidebar [data-test="grid-view"]').click();
// <ds-search-page> tag must be loaded
cy.get('ds-search-page').should('exist');
// At least one grid object (card) should be displayed
cy.get('[data-e2e="grid-object"]').should('be.visible');
cy.get('[data-test="grid-object"]').should('be.visible');
// Analyze <ds-search-page> for accessibility issues
testA11y('ds-search-page',

View File

@@ -78,8 +78,8 @@ describe('New Submission page', () => {
// This is the GET command that will actually run the search
cy.intercept('GET', '/server/api/discover/search/objects*').as('search-results');
// On MyDSpace, find the submission we just saved via its ID
cy.get('[data-e2e="search-box"]').type(id);
cy.get('[data-e2e="search-button"]').click();
cy.get('[data-test="search-box"]').type(id);
cy.get('[data-test="search-button"]').click();
// Wait for search results to come back from the above GET command
cy.wait('@search-results');

View File

@@ -3,8 +3,8 @@
<form [formGroup]="searchForm" (ngSubmit)="onSubmit(searchForm.value)" autocomplete="on">
<input #searchInput [@toggleAnimation]="isExpanded" [attr.aria-label]="('nav.search' | translate)" name="query"
formControlName="query" type="text" placeholder="{{searchExpanded ? ('nav.search' | translate) : ''}}"
class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" data-e2e="header-search-box">
<a class="submit-icon" [routerLink]="" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" data-e2e="header-search-icon">
class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" data-test="header-search-box">
<a class="submit-icon" [routerLink]="" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" data-test="header-search-icon">
<em class="fas fa-search fa-lg fa-fw"></em>
</a>
</form>

View File

@@ -1,7 +1,7 @@
<ul class="navbar-nav" [ngClass]="{'mr-auto': (isXsOrSm$ | async)}">
<li *ngIf="!(isAuthenticated | async) && !(isXsOrSm$ | async) && (showAuth | async)" class="nav-item"
(click)="$event.stopPropagation();">
<div ngbDropdown #loginDrop display="dynamic" placement="bottom-right" class="d-inline-block" data-e2e="login-menu" @fadeInOut>
<div ngbDropdown #loginDrop display="dynamic" placement="bottom-right" class="d-inline-block" data-test="login-menu" @fadeInOut>
<a href="javascript:void(0);" class="dropdownLogin px-1 " [attr.aria-label]="'nav.login' |translate" (click)="$event.preventDefault()" ngbDropdownToggle>
{{ 'nav.login' | translate }}
</a>
@@ -17,7 +17,7 @@
{{ 'nav.login' | translate }}<span class="sr-only">(current)</span>
</a>
</li>
<li *ngIf="(isAuthenticated | async) && !(isXsOrSm$ | async) && (showAuth | async)" class="nav-item" data-e2e="user-menu">
<li *ngIf="(isAuthenticated | async) && !(isXsOrSm$ | async) && (showAuth | async)" class="nav-item" data-test="user-menu">
<div ngbDropdown display="dynamic" placement="bottom-right" class="d-inline-block" @fadeInOut>
<a href="javascript:void(0);" role="button" [attr.aria-label]="'nav.logout' |translate" (click)="$event.preventDefault()" [title]="'nav.logout' | translate" class="px-1" ngbDropdownToggle>
<i class="fas fa-user-circle fa-lg fa-fw"></i></a>

View File

@@ -8,6 +8,6 @@
</ng-container>
<div class="dropdown-divider"></div>
<a class="dropdown-item" *ngIf="canRegister$ | async" [routerLink]="[getRegisterRoute()]" data-e2e="register">{{"login.form.new-user" | translate}}</a>
<a class="dropdown-item" [routerLink]="[getForgotRoute()]" data-e2e="forgot">{{"login.form.forgot-password" | translate}}</a>
<a class="dropdown-item" *ngIf="canRegister$ | async" [routerLink]="[getRegisterRoute()]" data-test="register">{{"login.form.new-user" | translate}}</a>
<a class="dropdown-item" [routerLink]="[getForgotRoute()]" data-test="forgot">{{"login.form.forgot-password" | translate}}</a>
</div>

View File

@@ -10,7 +10,7 @@
placeholder="{{'login.form.email' | translate}}"
required
type="email"
data-e2e="email">
data-test="email">
<label class="sr-only">{{"login.form.password" | translate}}</label>
<input [attr.aria-label]="'login.form.password' |translate"
autocomplete="off"
@@ -19,12 +19,12 @@
formControlName="password"
required
type="password"
data-e2e="password">
data-test="password">
<div *ngIf="(error | async) && hasError" class="alert alert-danger" role="alert"
@fadeOut>{{ (error | async) | translate }}</div>
<div *ngIf="(message | async) && hasMessage" class="alert alert-info" role="alert"
@fadeOut>{{ (message | async) | translate }}</div>
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" data-e2e="login-button"
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" data-test="login-button"
[disabled]="!form.valid"><i class="fas fa-sign-in-alt"></i> {{"login.form.submit" | translate}}</button>
</form>

View File

@@ -2,5 +2,5 @@
<div *ngIf="(error | async)" class="alert alert-danger" role="alert" @fadeOut>{{ error | async }}</div>
<button class="btn btn-lg btn-primary btn-block mt-3" (click)="logOut()" data-e2e="logout-button"><i class="fas fa-sign-out-alt"></i> {{"logout.form.submit" | translate}}</button>
<button class="btn btn-lg btn-primary btn-block mt-3" (click)="logOut()" data-test="logout-button"><i class="fas fa-sign-out-alt"></i> {{"logout.form.submit" | translate}}</button>
</div>

View File

@@ -13,7 +13,7 @@
(paginationChange)="onPaginationChange($event)">
<div class="card-columns row" *ngIf="objects?.hasSucceeded">
<div class="card-column col col-sm-6 col-lg-4" *ngFor="let column of (columns$ | async)" @fadeIn>
<div class="card-element" *ngFor="let object of column" data-e2e="grid-object">
<div class="card-element" *ngFor="let object of column" data-test="grid-object">
<ds-listable-object-component-loader [object]="object" [viewMode]="viewMode" [context]="context" [linkType]="linkType"></ds-listable-object-component-loader>
</div>
</div>

View File

@@ -12,7 +12,7 @@
(sortFieldChange)="onSortFieldChange($event)"
(paginationChange)="onPaginationChange($event)">
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" data-e2e="list-object">
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" data-test="list-object">
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
[object]="object"
[selectionConfig]="selectionConfig"

View File

@@ -4,10 +4,10 @@
<div *ngIf="showScopeSelector === true" class="input-group-prepend">
<button class="scope-button btn btn-outline-secondary text-truncate" [ngbTooltip]="(selectedScope | async)?.name" type="button" (click)="openScopeModal()">{{(selectedScope | async)?.name || ('search.form.scope.all' | translate)}}</button>
</div>
<input type="text" [(ngModel)]="query" name="query" class="form-control" attr.aria-label="{{ searchPlaceholder }}" data-e2e="search-box"
<input type="text" [(ngModel)]="query" name="query" class="form-control" attr.aria-label="{{ searchPlaceholder }}" data-test="search-box"
[placeholder]="searchPlaceholder">
<span class="input-group-append">
<button type="submit" class="search-button btn btn-{{brandColor}}" data-e2e="search-button"><i class="fas fa-search"></i> {{ ('search.form.search' | translate) }}</button>
<button type="submit" class="search-button btn btn-{{brandColor}}" data-test="search-button"><i class="fas fa-search"></i> {{ ('search.form.search' | translate) }}</button>
</span>
</div>
</div>

View File

@@ -7,7 +7,7 @@
routerLinkActive="active"
[class.active]="currentMode === viewModeEnum.ListElement"
class="btn btn-secondary"
data-e2e="list-view">
data-test="list-view">
<i class="fas fa-list" title="{{'search.view-switch.show-list' | translate}}"></i>
</a>
<a *ngIf="isToShow(viewModeEnum.GridElement)"
@@ -18,7 +18,7 @@
routerLinkActive="active"
[class.active]="currentMode === viewModeEnum.GridElement"
class="btn btn-secondary"
data-e2e="grid-view">
data-test="grid-view">
<i class="fas fa-th-large" title="{{'search.view-switch.show-grid' | translate}}"></i>
</a>
<a *ngIf="isToShow(viewModeEnum.DetailedListElement)"
@@ -29,7 +29,7 @@
routerLinkActive="active"
[class.active]="currentMode === viewModeEnum.DetailedListElement"
class="btn btn-secondary"
data-e2e="detail-view">
data-test="detail-view">
<i class="far fa-square" title="{{'search.view-switch.show-detail' | translate}}"></i>
</a>
</div>