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

feat: VRT tag - tag order

https://youtrack.weseek.co.jp/issue/GW-7740
- Create spec.ts for order tag
I Komang Mudana 4 лет назад
Родитель
Сommit
23a552f1a5

+ 0 - 2
packages/app/test/cypress/integration/7-tag/rename-page.spec.ts

@@ -84,6 +84,4 @@ context('Rename page from generated tag', () => {
     cy.screenshot(`${ssPrefix}visit-ourus-page`, {capture: 'viewport'});
   });
 
-
-
 });

+ 66 - 0
packages/app/test/cypress/integration/7-tag/tag-order.spec.ts

@@ -0,0 +1,66 @@
+/* eslint-disable cypress/no-unnecessary-waiting */
+context('Tag order', () => {
+  const ssPrefix = 'tag-order-';
+
+  let connectSid: string | undefined;
+
+  before(() => {
+    // login
+    cy.fixture("user-admin.json").then(user => {
+      cy.login(user.username, user.password);
+    });
+    cy.getCookie('connect.sid').then(cookie => {
+      connectSid = cookie?.value;
+    });
+  });
+
+  beforeEach(() => {
+    if (connectSid != null) {
+      cy.setCookie('connect.sid', connectSid);
+    }
+  });
+
+  it('Tag order', () => {
+    const tag = 'we';
+
+    // Visit home
+    cy.visit('/');
+    cy.screenshot(`${ssPrefix}visit-home`, {capture: 'viewport'});
+
+    // Click tag that contain "we"
+     cy.get('#grw-subnav-container').within(()=>{
+      cy.get('a[href*="/_search?q=tag"]').contains(tag).click();
+    });
+    cy.wait(1500);
+    cy.screenshot(`${ssPrefix}click-tag-name`, {capture: 'viewport'});
+
+
+    // Order by relevance
+    cy.get('.grw-search-page-nav').within(() => {
+      cy.get('.search-sort-option-btn').click({force: true});
+      cy.get('.dropdown-menu-right').should('be.visible');
+      cy.get('.dropdown-menu-right > button:nth-child(1)').click({force: true});
+      cy.wait(1000);
+    });
+    cy.screenshot(`${ssPrefix}order-by-relevance`);
+
+    // Order by creation date
+     cy.get('.grw-search-page-nav').within(() => {
+      cy.get('.search-sort-option-btn').click({force: true});
+      cy.get('.dropdown-menu-right').should('be.visible');
+      cy.get('.dropdown-menu-right > button:nth-child(2)').click({force: true});
+      cy.wait(1000);
+    });
+    cy.screenshot(`${ssPrefix}order-by-creation-date`);
+
+     // Order by last update date
+     cy.get('.grw-search-page-nav').within(() => {
+      cy.get('.search-sort-option-btn').click({force: true});
+      cy.get('.dropdown-menu-right').should('be.visible');
+      cy.get('.dropdown-menu-right > button:nth-child(3)').click({force: true});
+      cy.wait(1000);
+    });
+    cy.screenshot(`${ssPrefix}order-by-last-update-date`);
+  });
+
+});