Просмотр исходного кода

feat: VRT Search all pages

https://youtrack.weseek.co.jp/issue/GW-7739
- Modify spec.ts
- remove data-testid props
I Komang Mudana 4 лет назад
Родитель
Сommit
f9d0a01f18

+ 0 - 1
packages/app/src/components/Navbar/GlobalSearch.tsx

@@ -108,7 +108,6 @@ const GlobalSearch: FC<Props> = (props: Props) => {
           onFocus={() => setFocused(true)}
           onInputChange={text => setText(text)}
           onSubmit={search}
-          data-testid="global-search-input"
         />
         { isIndicatorShown && (
           <span className="grw-shortcut-key-indicator">

+ 16 - 7
packages/app/test/cypress/integration/3-search/search-all-pages.spec.ts

@@ -1,9 +1,9 @@
 context('Search all pages', () => {
-  const ssPrefix = 'search-all-pages';
+  const ssPrefix = 'search-all-pages-';
 
   let connectSid: string | undefined;
 
-  before(() =>{
+  before(() => {
     // login
     cy.fixture("user-admin.json").then(user => {
       cy.login(user.username, user.password);
@@ -11,16 +11,25 @@ context('Search all pages', () => {
     cy.getCookie('connect.sid').then(cookie => {
       connectSid = cookie?.value;
     });
+    // collapse sidebar
+    cy.collapseSidebar(true);
   });
 
-  beforeEach(() =>{
-    if(connectSid != null){
+  beforeEach(() => {
+    if (connectSid != null) {
       cy.setCookie('connect.sid', connectSid);
     }
   });
 
-  it('Searching all pages', () => {
+  it('Search by typing help and press ENTER', () => {
+    const searchText = 'help';
     cy.visit('/');
-    cy.getByTestid('global-search-input').click();
-  })
+    cy.get('div.rbt-input-hint-container > input').click();
+    cy.screenshot(`${ssPrefix}search-input-focused`, { capture: "viewport"});
+    cy.get('div.rbt-input-hint-container > input').type(`${searchText}{enter}`);
+    cy.screenshot(`${ssPrefix}insert-search-text`, { capture: "viewport"});
+    cy.get('div.rbt-input-hint-container > input').type('{enter}');
+    cy.screenshot(`${ssPrefix}press-enter`, { capture: "viewport"});
+  });
+
 });