当前位置: 首页 > wzjs >正文

怎么在网站上做图片轮播织梦做中英文网站步骤

怎么在网站上做图片轮播,织梦做中英文网站步骤,成都小程序开发平台,网站教学视频网页五子棋对战测试报告 项目背景项目测试功能测试部分界面截图自动化测试UtilsRegisterTestLoginTestHallTestRoomTest 项目背景 初学springboot的第一个项目,这是一款基于SSM框架结合WebSocket技术打造的网页版五子棋游戏,免下载安装,打开网页就能随时…

网页五子棋对战测试报告

  • 项目背景
  • 项目测试
    • 功能测试
    • 部分界面截图
    • 自动化测试
      • Utils
      • RegisterTest
      • LoginTest
      • HallTest
      • RoomTest

项目背景

初学springboot的第一个项目,这是一款基于SSM框架结合WebSocket技术打造的网页版五子棋游戏,免下载安装,打开网页就能随时享受下棋乐趣。它最核心的功能是双人在线对战,在匹配系统中随机与其他玩家开启棋局。WebSocket技术确保了下棋过程中,双方落子信息能实时同步,几乎没有延迟,让对弈流畅又丝滑。在界面设计上,它简洁美观,棋盘与棋子的绘制精致,操作也十分简单,新手玩家能快速上手。除了实时对弈,游戏还贴心地提供了复盘功能,方便玩家回顾棋局,总结经验,提升棋艺。不管是想在闲暇时光杀上几盘,还是和棋友交流切磋,这款网页版五子棋都能满足你。

项目测试

功能测试

在这里插入图片描述

部分界面截图

在这里插入图片描述
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/bf6be8fd6bdd499e8e594f3a3d512805.png
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

自动化测试

因为写的比较着急,可能代码并不美观,请见谅

Utils

@Data
public class Utils {public static EdgeDriver driver;public static EdgeDriver createDriver() {if(driver == null) {WebDriverManager.edgedriver().setup();EdgeOptions options = new EdgeOptions();//允许访问所有的链接options.addArguments("--remote-allow-origins=*");driver = new EdgeDriver(options);//隐式等待(全局情况,查找元素的时候都让它等待2秒)driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(2));}return driver;}public Utils(String url) {driver = createDriver();driver.get(url);}public List<String> getTime(){//文件能不能按照天的维度按文件夹进行保存//文件格式 20230212-123030毫秒SimpleDateFormat sim1 = new SimpleDateFormat("yyyyMMdd-HHmmssSS");SimpleDateFormat sim2 = new SimpleDateFormat("yyyyMMdd");String filename = sim1.format(System.currentTimeMillis());String dirname = sim2.format(System.currentTimeMillis());List<String> list = new ArrayList<>();list.add(dirname);list.add(filename);return list;}/*** 获取屏幕截图,把所有的用例执行的结果保存下来*/public void getScreenShot(String str) throws IOException, AWTException {driver.quit();List<String> timeParts = getTime();// 构建路径String dirPath = Paths.get("./src/test/java/com/blogWebAutoTest", timeParts.get(0)).toString();String filename = String.format("%s_%s.png", str, timeParts.get(1));File destFile = new File(dirPath, filename);// 自动创建目录if (!destFile.getParentFile().exists()) {destFile.getParentFile().mkdirs(); // 创建多级目录}// 截图并保存// 使用 Robot 类截屏Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());BufferedImage screenFullImage = new Robot().createScreenCapture(screenRect);// 保存截图ImageIO.write(screenFullImage, "png", destFile);System.out.println("IDEA运行截图已保存至: " + destFile.getAbsolutePath());}}

RegisterTest

public class RegisterTest extends Utils {private static String url = "http://localhost:8080/register.html";public RegisterTest() {super(url);}public void registerFail() {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));// 空账号空密码测试driver.findElement(By.xpath("//*[@id=\"username\"]")).clear();driver.findElement(By.xpath("//*[@id=\"password\"]")).clear();driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("");driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("");driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();// 处理弹窗(确认)wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("laoliu1");driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("");driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("");driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("123");driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")}public void registerSuccess() throws InterruptedException {// 等待页面加载完成// 第一次注册WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
//        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"username\"]")));
//        driver.findElement(By.xpath("//*[@id=\"username\"]")).clear();
//        driver.findElement(By.xpath("//*[@id=\"password\"]")).clear();
//        driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("laoliu1");
//        driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("123");
//        driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();
//
//        // 处理第一个弹窗
//        try {
//            wait.until(ExpectedConditions.alertIsPresent());
//            Alert alert = driver.switchTo().alert();
//            alert.accept();
//        } catch (Exception e) {
//            System.out.println("第一个弹窗处理失败: " + e.getMessage());
//        }
        driver.get(url);
//        // 等待页面元素重新加载// 第二次注册wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"username\"]")));driver.findElement(By.xpath("//*[@id=\"username\"]")).clear();driver.findElement(By.xpath("//*[@id=\"password\"]")).clear();driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("ceshi");driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("123");driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();// 处理第二个弹窗try {wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert();alert.accept();} catch (Exception e) {System.out.println("第二个弹窗处理失败: " + e.getMessage());}// 等待页面跳转wait.until(ExpectedConditions.urlToBe("http://localhost:8080/login.html"));// 验证跳转String currentUrl = driver.getCurrentUrl();assert currentUrl.equals("http://localhost:8080/login.html") : "Expected URL: http://localhost:8080/login.html, but got: " + currentUrl;}public void registerT() throws InterruptedException {// 等待页面加载完成// 创建显式等待对象WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));// 等待输入框元素可见wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"username\"]")));// 输入注册信息driver.findElement(By.xpath("//*[@id=\"username\"]")).clear();driver.findElement(By.xpath("//*[@id=\"password\"]")).clear();driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("laoliu2");driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("123");// 点击提交按钮driver.findElement(By.xpath("//*[@id=\"submit\"]")).click();// 等待AJAX请求完成和弹窗出现try {wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert();alert.accept();} catch (Exception e) {System.out.println("弹窗处理失败: " + e.getMessage());throw e;}driver.quit();}
}

LoginTest

public class LoginTest extends Utils {private static String url = "http://localhost:8080/login.html";public LoginTest() {super(url);}public void LoginFail() {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"username\"]")));loginTest("", "");wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")loginTest("laoliu1", "");wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")loginTest("", "123");wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")loginTest("laoliu123", "123");wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")}public void LoginSuccess() {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));loginTest("ceshi", "123");wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")assert driver.getCurrentUrl().equals("http://localhost:8080/game_hall.html");
//        driver.quit();}private static void loginTest(String username, String number) {driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();driver.findElement(By.cssSelector("#username")).sendKeys(username);driver.findElement(By.cssSelector("#password")).sendKeys(number);driver.findElement(By.cssSelector("#submit")).click();}
}

HallTest

public class HallTest extends Utils {private static String url = "http://localhost:8080/game_hall.html";public HallTest() {super(url);}public void hallFail() {// 清理登录状态driver.manage().deleteAllCookies();driver.get(url);WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));WebElement screen = wait.until(d -> {WebElement el = d.findElement(By.id("screen"));return el.getText().contains("玩家:") ? el : null;});// 获取所有文本节点(需注意浏览器兼容性)List<WebElement> textNodes = driver.findElements(By.cssSelector("#screen > *"));//解析整个文本String fullText = screen.getText();String[] lines = fullText.split("\n");assertEquals("玩家: undefined", lines[0]);driver.findElement(By.cssSelector("#match-button")).click();assert driver.findElement(By.cssSelector("#match-button")).getText().equals("开始匹配") : "未登入状态进入游戏大厅匹配异常";}public void hallSuccess() {driver.get("http://localhost:8080/login.html");WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"username\"]")));driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();driver.findElement(By.cssSelector("#username")).sendKeys("ceshi");driver.findElement(By.cssSelector("#password")).sendKeys("123");driver.findElement(By.cssSelector("#submit")).click();wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert(); // 切换到弹窗alert.accept(); // 点击确认(相当于点击"OK")// 等待页面跳转wait.until(ExpectedConditions.urlToBe(url));// 验证跳转String currentUrl = driver.getCurrentUrl();assert currentUrl.equals(url) :"Expected URL: http://localhost:8080/game_hall.html, but got: " + currentUrl;//        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"screen\"]/text()[1]")));;WebElement screen = wait.until(d -> {WebElement el = d.findElement(By.id("screen"));return el.getText().contains("玩家:") ? el : null;});// 获取所有文本节点(需注意浏览器兼容性)List<WebElement> textNodes = driver.findElements(By.cssSelector("#screen > *"));String fullText = screen.getText();String[] lines = fullText.split("\n");assertEquals("玩家: ceshi", lines[0]);driver.findElement(By.cssSelector("#match-button")).click();System.out.println(driver.findElement(By.cssSelector("#match-button")).getText());assert driver.findElement(By.cssSelector("#match-button")).getText().equals("匹配中...(点击取消)") : "登入状态点击开始匹配异常";driver.findElement(By.cssSelector("#match-button")).click();assert driver.findElement(By.cssSelector("#match-button")).getText().equals("开始匹配") : "登入状态点击取消匹配异常";//        driver.quit();}
}

RoomTest

public class RoomTest extends Utils {private static String url = "http://localhost:8080/game_room.html";public RoomTest() {super(url);}public void roomFail() {driver.manage().deleteAllCookies();driver.get(url);WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));wait.until(driver -> ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#screen")));assert driver.findElement(By.cssSelector("#screen")).getText().equals("等待玩家连接中...") : "无状态访问游戏房间异常";}//    public void roomSuccess() {
//
//    }
}

文章转载自:

http://4S8pRXWN.wqhLj.cn
http://1VQ9aGsX.wqhLj.cn
http://PDSXssRt.wqhLj.cn
http://y44giwex.wqhLj.cn
http://FmyJTFmI.wqhLj.cn
http://opFnortd.wqhLj.cn
http://iPrCcBGs.wqhLj.cn
http://2pxnXBwY.wqhLj.cn
http://HynLNqZm.wqhLj.cn
http://HIOfDwdg.wqhLj.cn
http://yN4ToLbL.wqhLj.cn
http://9TrKQbKU.wqhLj.cn
http://6hEByCn5.wqhLj.cn
http://I8GHjQhW.wqhLj.cn
http://9xDKyIW7.wqhLj.cn
http://SIwjMDrq.wqhLj.cn
http://YS24Zpu9.wqhLj.cn
http://7GOVtFv6.wqhLj.cn
http://VUy3Zrcm.wqhLj.cn
http://gMQ71FZT.wqhLj.cn
http://Q1cbfRVQ.wqhLj.cn
http://cek706sP.wqhLj.cn
http://7bwtcdKO.wqhLj.cn
http://knk9C1nT.wqhLj.cn
http://dN9q6lt8.wqhLj.cn
http://Th3OzIrG.wqhLj.cn
http://kEw4de28.wqhLj.cn
http://GDrY7KYV.wqhLj.cn
http://CFQjqM9y.wqhLj.cn
http://w2J2b4Da.wqhLj.cn
http://www.dtcms.com/wzjs/711277.html

相关文章:

  • 淄博信息港呼和浩特网站seo
  • 个人互动网站app界面设计论文
  • 长沙铭万做网站网站开发难不难
  • plone网站开发企业网站备案号密码忘记
  • 营销网站建站公司聚美优品网站建设策划书
  • 国内哪个网站是做电子元器件的刚做的网站怎么搜索不出来的
  • 浏览有关小城镇建设的网站记录公众号管理平台入口
  • 做高仿网站有哪些四川网站设计成功柚米科技
  • 宠物网站制作内容佛山网站建设佛山网站制作
  • 关于网站开发与设计论文电商网站用什么框架做
  • 专门做视频点评的网站wordpress备案信息链接
  • 开封市城乡建设局网站sae wordpress 更新
  • 北京网站制作平台设计平面图
  • 台州临海市建设局网站搜索引擎营销广告
  • 如果做游戏的技术用来做网站扬州做网站的科技公司
  • asp.net mvc 网站开发之美 pdfsem运营是什么意思
  • sharepoint 网站开发外包做一个网站一般多少钱
  • 网站开发实用技术第2版课后答案揭阳网站制作
  • 可以在网上接网站做的网址豪华网站建设方案
  • 如何利用php开源系统建立php网站室内设计学校排行榜
  • 网站seo推广平台微信公众号登录不上
  • 动易门户网站价格ps做好的网站如何做链接
  • 免费建手机网站的软件建设银行网站收费吗
  • 网站域名怎么申请最火的做网站源码语言
  • 如何绑定网站域名wordpress+国内不使用
  • 佛山网站制作在线php做网站需要的技术
  • 滕州市建设局网站广昌网站建设制作
  • 国内室内设计网站推荐济南seo网站推广
  • 哪个网站可以做微信引导图青岛官网seo
  • 如何在凡科上做网站昆明企业免费建站